axe basic

This commit is contained in:
jshipsey 2020-11-08 13:22:34 -05:00
parent 33e87de17e
commit 92aa6a1b12
8 changed files with 295 additions and 302 deletions

View File

@ -193,7 +193,7 @@
color: None
),
"common.items.weapons.axe.orc_axe-0": (
vox_spec: ("weapon.axe.2haxe_orc-0", (-1.5, -3.0, -4.5)),
vox_spec: ("weapon.axe.2haxe_orc-0", (-1.5, -6.0, -4.5)),
color: None
),
"common.items.weapons.axe.worn_iron_axe-0": (

View File

@ -186,7 +186,7 @@ impl Tool {
range: 3.5,
angle: 50.0,
base_buildup_duration: Duration::from_millis(350),
base_swing_duration: Duration::from_millis(75),
base_swing_duration: Duration::from_millis(75), //75
base_recover_duration: Duration::from_millis(400),
forward_movement: 0.5,
},
@ -199,8 +199,8 @@ impl Tool {
range: 3.5,
angle: 30.0,
base_buildup_duration: Duration::from_millis(500),
base_swing_duration: Duration::from_millis(75),
base_recover_duration: Duration::from_millis(1000),
base_swing_duration: Duration::from_millis(100), //75
base_recover_duration: Duration::from_millis(500),
forward_movement: 0.25,
},
],
@ -290,8 +290,8 @@ impl Tool {
Bow => vec![
BasicRanged {
energy_cost: 0,
buildup_duration: Duration::from_millis(100),
recover_duration: Duration::from_millis(400),
buildup_duration: Duration::from_millis(200),
recover_duration: Duration::from_millis(300),
projectile: Projectile {
hit_solid: vec![projectile::Effect::Stick],
hit_entity: vec![

View File

@ -102,56 +102,53 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_y(slow * -1.3)
* Quaternion::rotation_z(1.4 + slow * -0.5);
},
if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.l_hand.position = Vec3::new(-0.75, -1.0, 2.5);
next.l_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.position = Vec3::new(0.75, -1.5, -0.5);
next.r_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05; //next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.position = Vec3::new(0.0, 1.5, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
//* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(3.14);
Some(ToolKind::Axe(_)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
next.head.position = Vec3::new(
0. + movement2 * 2.0,
s_a.head.0 + movement2 * 2.0,
s_a.head.1,
);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
-9.0 + movement1 * 0.0 + movement2 * -0.2 + movement3 * 0.0,
//7.0 + movement1 * -4.0 + movement2 * 5.0 + movement3 * -1.5,
7.0 + movement1 * -4.0 + movement2 * 5.0 + movement3 * -1.5,
2.0 + movement1 * 1.0 + movement2 * -6.0 + movement3 * 4.0,
s_a.ac.0 + movement1 * -1.0 + movement2 * -2.0 + movement3 * 0.0,
s_a.ac.1 + movement1 * -3.0 + movement2 * 3.0 + movement3 * -3.5,
s_a.ac.2 + movement1 * 6.0 + movement2 * -15.0 + movement3 * -2.0,
);
next.control.orientation = Quaternion::rotation_x(
s_a.ac.3 + movement1 * 0.0 + movement2 * -3.0 + movement3 * 0.4,
) * Quaternion::rotation_y(
s_a.ac.4 + movement1 * -0.0 + movement2 * -0.6 + movement3 * 0.8,
) * Quaternion::rotation_z(
s_a.ac.5 + movement1 * -2.0 + movement2 * -1.0 + movement3 * 2.5,
);
next.control.orientation =
//Quaternion::rotation_x(0.2 + movement1 * 0.5 + movement2 * -1.8 + movement3 * 1.6)
Quaternion::rotation_x(0.2 + movement1 * 0.3 + movement2 * -1.8 + movement3 * 1.6)
* Quaternion::rotation_y(
//-0.5 + movement1 * 0.5 + movement2 * -1.0 + movement3 * 0.8,
-0.5 + movement1 * 0.5 + movement2 * -0.7 + movement3 * 0.8,
)
* Quaternion::rotation_z(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
);
next.control.scale = Vec3::one();
next.chest.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.4 + movement2 * -0.6 + movement3 * 0.4)
* Quaternion::rotation_y(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
)
* Quaternion::rotation_z(
0.0 + movement1 * 1.5 + movement2 * -2.5 + movement3 * 1.5,
);
next.head.orientation =
Quaternion::rotation_z(0.0 + movement1 * -1.0 + movement2 * 2.5 + movement3 * -1.8);
};
next.chest.orientation = Quaternion::rotation_x(
0.0 + movement1 * 0.6 + movement2 * -0.6 + movement3 * 0.4,
) * Quaternion::rotation_y(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
) * Quaternion::rotation_z(
0.0 + movement1 * 1.5 + movement2 * -2.5 + movement3 * 1.5,
);
next.head.orientation = Quaternion::rotation_z(
0.0 + movement1 * -1.5 + movement2 * 2.5 + movement3 * -1.0,
);
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.orientation =

View File

@ -136,7 +136,7 @@ impl Animation for RunAnimation {
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
Quaternion::rotation_x(-0.05 + short * 0.02 + noisea * 0.02 + noiseb * 0.02);
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 + s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(0.2)

View File

@ -2,12 +2,20 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
use common::{comp::item::ToolKind, states::utils::StageSection};
pub struct ShootAnimation;
impl Animation for ShootAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f32, f64);
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f32,
Vec3<f32>,
Vec3<f32>,
f64,
Option<StageSection>,
);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -17,12 +25,21 @@ impl Animation for ShootAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, velocity, _global_time): Self::Dependency,
(
active_tool_kind,
_second_tool_kind,
velocity,
orientation,
last_ori,
_global_time,
stage_section,
): Self::Dependency,
anim_time: f64,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let mut next = (*skeleton).clone();
@ -38,22 +55,6 @@ impl Animation for ShootAnimation {
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(exp * -0.4)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(exp * 0.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0 - exp * 1.5, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(0.4 + exp * 1.0)
* Quaternion::rotation_x(0.0 + exp * 0.2)
* Quaternion::rotation_y(exp * -0.08);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + exp * 1.0, s_a.belt.1);
next.belt.orientation = next.chest.orientation * -0.1;
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + exp * 1.0, s_a.shorts.1);
next.shorts.orientation = next.chest.orientation * -0.08;
match active_tool_kind {
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
@ -72,54 +73,50 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + exp * 1.5);
},
Some(ToolKind::Bow) => {
next.hand_l.position = Vec3::new(
s_a.bhl.0 - exp * 2.0,
s_a.bhl.1 - exp * 4.0,
s_a.bhl.2 + exp * 6.0,
);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3)
* Quaternion::rotation_y(s_a.bhl.4 + exp * 0.8)
* Quaternion::rotation_z(s_a.bhl.5 + exp * 0.9);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhl.3)
* Quaternion::rotation_y(s_a.bhr.4)
* Quaternion::rotation_z(s_a.bhr.5);
Some(ToolKind::Bow(_)) => {
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(
s_a.bhl.0 + movement2 * -5.0,
s_a.bhl.1 + movement2 * -10.0,
s_a.bhl.2 + movement2 * -7.0,
);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3 + movement2 * 0.5);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, 4.0 + s_a.bc.2);
next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + exp * 0.4);
next.hold.position = Vec3::new(0.0, -1.0, -5.2 + movement2 * 5.0);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0 * (1.0 - movement2);
next.control.position = Vec3::new(s_a.bc.0 + 11.0, s_a.bc.1 + 2.0, s_a.bc.2 + 8.0);
next.control.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(s_a.bc.4 - 1.25)
* Quaternion::rotation_z(s_a.bc.5 - 0.1);
next.chest.orientation = Quaternion::rotation_z(0.8);
next.head.position = Vec3::new(0.0 + movement1 * -2.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(movement1 * -0.8);
if speed < 0.5 {
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + 5.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 - 3.0, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.3);
} else {
};
},
_ => {},
}
if velocity > 0.5 {
next.foot_l.position = Vec3::new(
-s_a.foot.0 - foot * 1.0 + exp * -1.0,
foote * 0.8 + exp * 1.5,
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(exp * 0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.15);
next.foot_r.position = Vec3::new(
s_a.foot.0 + foot * 1.0 + exp * 1.0,
foote * -0.8 + exp * -1.0,
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(exp * -0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.0);
next.torso.orientation = Quaternion::rotation_x(-0.15);
} else {
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + exp * 2.5);
next.foot_l.orientation =
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - exp * 2.0, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
}
next.back.orientation = Quaternion::rotation_x(-0.3);

View File

@ -5,15 +5,13 @@ use super::{
use common::{comp::item::ToolKind, states::utils::StageSection};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct SpinAnimation;
impl Animation for SpinAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
Option<StageSection>,
);
@ -25,7 +23,7 @@ impl Animation for SpinAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spin")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency,
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -34,7 +32,6 @@ impl Animation for SpinAnimation {
let mut next = (*skeleton).clone();
let lab = 1.0;
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(1.8), 0.0),
@ -54,157 +51,178 @@ impl Animation for SpinAnimation {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
if let Some(ToolKind::Sword) = active_tool_kind {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0 + movement1 * 2.0 + movement2 * -4.0 + movement3 * -7.0,
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement3 * -10.0,
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
);
next.control.orientation = Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
next.head.position = Vec3::new(
0.0 + 2.0 + movement2 * -2.0,
2.0 + movement2 * -2.0 + s_a.head.0,
s_a.head.1,
);
next.head.orientation = Quaternion::rotation_z(movement2 * -0.4);
next.control.position = Vec3::new(
s_a.sc.0 + movement1 * 2.0 + movement2 * -4.0 + movement3 * -7.0,
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement3 * -10.0,
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57);
next.head.position = Vec3::new(
0.0 + 2.0 + movement2 * -2.0,
2.0 + movement2 * -2.0 + s_a.head.0,
s_a.head.1,
);
next.head.orientation = Quaternion::rotation_z(movement2 * -0.4);
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
* Quaternion::rotation_z(
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
* Quaternion::rotation_z(
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
);
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 0.5);
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 1.5);
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
},
Some(ToolKind::Axe(_)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(
s_a.ac.0 + (-3.0 + movement1 * 0.0 + movement2 * -2.0) * (1.0 - movement3),
s_a.ac.1 + (-3.5 + movement1 * -4.6 + movement2 * 5.0) * (1.0 - movement3),
s_a.ac.2 + (-11.0 + movement1 * 10.0 + movement2 * -4.0) * (1.0 - movement3),
);
next.control.orientation = Quaternion::rotation_x(
s_a.ac.3 + (-2.6 + movement1 * 0.0 + movement2 * -0.6) * (1.0 - movement3),
) * Quaternion::rotation_y(
s_a.ac.4 + (0.2 + movement1 * -0.5 + movement2 * 0.0) * (1.0 - movement3),
) * Quaternion::rotation_z(
s_a.ac.5 + (-0.5 + movement1 * -3.0 + movement2 * 0.5) * (1.0 - movement3),
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation =
Quaternion::rotation_x((0.4 + movement2 * -0.5) * (1.0 - movement3))
* Quaternion::rotation_y(
(0.0 + movement1 * -0.1 + movement2 * 0.0) * (1.0 - movement3),
)
* Quaternion::rotation_z(
(0.5 + movement1 * -0.6 + movement2 * 0.6) * (1.0 - movement3),
);
next.belt.orientation = Quaternion::rotation_x(movement1 * -0.2 + movement2 * 0.2);
next.shorts.orientation =
Quaternion::rotation_x(0.0 + movement1 * -0.2 + movement2 * 0.2);
next.head.orientation =
Quaternion::rotation_y(0.0 + movement1 * 0.0 + movement3 * -0.0)
* Quaternion::rotation_z(
(1.0 + movement1 * -0.5 + movement2 * 0.0) * (1.0 - movement3),
);
next.torso.position = Vec3::new(
0.0,
0.0,
(-1.0
+ 1.0 * (movement1 * 0.5 * PI).sin()
+ 1.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin())
* (1.0 - movement3),
);
next.torso.orientation = Quaternion::rotation_z(
(movement1.powf(2.0) * -6.0 + movement2 * -1.7 + movement3 * 1.4),
);
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 0.5);
next.foot_l.position = Vec3::new(
-s_a.foot.0 + (movement1 * -1.0 + movement2 * -3.0) * (1.0 - movement3),
s_a.foot.1,
s_a.foot.2 + (movement2 * 6.0) * (1.0 - movement3),
);
next.foot_l.orientation =
Quaternion::rotation_x((movement1 * 0.2 + movement2 * 0.5) * (1.0 - movement3))
* Quaternion::rotation_y((movement2 * 0.5) * (1.0 - movement3));
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 1.5);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + (movement1 * -2.0 + movement2 * -3.0) * (1.0 - movement3),
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(
(movement1 * -0.5 + movement2 * -0.5) * (1.0 - movement3),
);
},
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28);
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.l_hand.position = Vec3::new(-0.75, -1.0, 2.5);
next.l_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.position = Vec3::new(0.75, -1.5, -0.5);
next.r_hand.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05; //next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.position = Vec3::new(0.0, 1.5, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
//* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(PI);
* Quaternion::rotation_z(0.0);
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
next.control.orientation = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0 + spin * -0.8, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
* Quaternion::rotation_x(0.0 + spin * -0.1)
* Quaternion::rotation_y(spin * -0.2);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
next.control.position = Vec3::new(
//-9.2 + movement1 * 0.0 + movement2.powf(2.0) * 9.0 + movement3 * 0.0,
-9.2 + movement1 * 0.0 + movement2 * 9.0 + movement3 * 0.0,
6.5 + movement1 * 0.6 + movement2 * 3.0 + movement3 * -0.0,
//1.0 + movement1 * 7.0 + movement2.powf(2.0) * -9.5 + movement3 * -0.0,
1.0 + (movement1 * 0.75 * PI).sin() * 5.0 + movement2 * -7.0 + movement3 * -0.0,
);
next.control.orientation =
//Quaternion::rotation_x(0.5 + movement1 * 1.0 + movement2 * -2.6 + movement3 * -0.0)
Quaternion::rotation_x(0.5 + (movement1 * 1.5 * PI).sin() * 1.0 + movement2 * -0.6 + movement3 * -0.0)
* Quaternion::rotation_y(
-0.2 + movement1 * 0.2 + movement2 * 0.0 + movement3 * 0.0,
)
* Quaternion::rotation_z(
0.0 + movement1 * 0.0 + movement2 * 0.0 + movement3 * 0.0,
);
next.control.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = next.chest.orientation * -0.1;
next.chest.orientation =
Quaternion::rotation_x(0.2 + movement1 * 0.0 + movement2 * -0.5 + movement3 * 0.0)
* Quaternion::rotation_y(
0.0 + movement1 * -0.1 + movement2 * 0.0 + movement3 * -0.0,
)
* Quaternion::rotation_z(
0.5 + movement1 * -0.6 + movement2 * 0.6 + movement3 * 0.0,
);
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.belt.orientation = next.chest.orientation * -0.08;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
next.belt.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.0 + movement2 * -0.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
next.shorts.orientation =
Quaternion::rotation_x(0.0 + movement1 * 0.0 + movement2 * -0.0);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.head.orientation =
Quaternion::rotation_y(0.0 + movement1 * 0.0 + movement3 * -0.0)
* Quaternion::rotation_z(
-0.3 + movement1 * 0.4 + movement2 * -0.5 + movement3 * 0.0,
);
next.torso.position = Vec3::new(
0.0,
0.0,
-1.0 + 1.0 * (movement1 * 0.5 * PI).sin()
+ 1.0 * (movement2 * 0.5 * PI + 0.5 * PI).sin(),
);
next.torso.orientation =
Quaternion::rotation_z(movement1.powf(2.0) * -6.0 + movement2 * -0.7);
next.lantern.orientation =
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.lantern.orientation =
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
},
_ => {},
}
if let Some( ToolKind::Hammer(_) | ToolKind::Dagger(_)) = active_tool_kind
{
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
next.control.orientation = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0 + spin * -0.8, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
* Quaternion::rotation_x(0.0 + spin * -0.1)
* Quaternion::rotation_y(spin * -0.2);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = next.chest.orientation * -0.1;
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.belt.orientation = next.chest.orientation * -0.08;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.lantern.orientation =
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
}
next
}
}

View File

@ -90,7 +90,9 @@ impl Animation for SpinMeleeAnimation {
next.belt.orientation = Quaternion::rotation_x(0.1);
next.shorts.orientation = Quaternion::rotation_x(0.2);
},
Some(ToolKind::Axe) => {
Some(ToolKind::Axe(_)) => {
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, s_a.head.1 + 1.0);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI);

View File

@ -825,31 +825,35 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::BasicRanged(data) => {
if data.exhausted {
anim::character::ShootAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
} else {
anim::character::ChargeAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
CharacterState::BasicRanged(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::character::ShootAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::ChargedMelee(s) => {
let stage_time = s.timer.as_secs_f64();
@ -881,32 +885,6 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::ChargedRanged(data) => {
if data.exhausted {
anim::character::ShootAnimation::update_skeleton(
&target_base,
(active_tool_kind, second_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
} else {
anim::character::ChargeAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0.magnitude(),
ori,
state.last_ori,
time,
),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
},
CharacterState::RepeaterRanged(s) => {
let stage_time = s.timer.as_secs_f64();
@ -1199,6 +1177,7 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
vel.0,
time,
Some(s.stage_section),
),