From 58e2d3a4adb41d625551fb2146566416d23a4472 Mon Sep 17 00:00:00 2001 From: Snowram Date: Wed, 30 Sep 2020 22:33:24 +0200 Subject: [PATCH] More bipedlarge anim work --- .../voxel/biped_large_central_manifest.ron | 12 +- .../voxel/weapon/hammer/2hhammer_wendigo.vox | 2 +- .../voxel/weapon/staff/firestaff_ogre.vox | 2 +- .../voxel/weapon/sword/long_2h_lizardman.vox | 2 +- voxygen/src/anim/src/biped_large/alpha.rs | 564 ++++++++++++------ voxygen/src/anim/src/biped_large/beta.rs | 6 +- voxygen/src/anim/src/biped_large/charge.rs | 95 ++- voxygen/src/anim/src/biped_large/dash.rs | 17 +- voxygen/src/anim/src/biped_large/mod.rs | 2 + voxygen/src/anim/src/biped_large/run.rs | 4 + voxygen/src/anim/src/biped_large/shoot.rs | 73 ++- voxygen/src/anim/src/biped_large/spin.rs | 6 +- voxygen/src/anim/src/biped_large/spinmelee.rs | 258 ++++++++ voxygen/src/anim/src/biped_large/wield.rs | 202 +++++-- voxygen/src/scene/figure/mod.rs | 37 ++ 15 files changed, 987 insertions(+), 295 deletions(-) create mode 100644 voxygen/src/anim/src/biped_large/spinmelee.rs diff --git a/assets/voxygen/voxel/biped_large_central_manifest.ron b/assets/voxygen/voxel/biped_large_central_manifest.ron index 1c2b6921d3..f193dd1005 100644 --- a/assets/voxygen/voxel/biped_large_central_manifest.ron +++ b/assets/voxygen/voxel/biped_large_central_manifest.ron @@ -56,7 +56,7 @@ ), main: ( offset: (-2.5, -5.5, -5.0), - central: ("weapon.hammer.2hhammer_ogre"), + central: ("weapon.staff.firestaff_ogre"), ) ), (Cyclops, Male): ( @@ -145,7 +145,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -6.5, -4.0), + offset: (-3.0, -3.5, -8.0), central: ("weapon.hammer.2hhammer_wendigo"), ) ), @@ -385,7 +385,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -9.0, -10.0), + offset: (-3.5, -3.0, -5.0), central: ("weapon.staff.firestaff_lizardman"), ) ), @@ -415,7 +415,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.5, -2.0, -10.0), + offset: (-3.5, -3.0, -5.0), central: ("weapon.staff.firestaff_lizardman"), ) ), @@ -445,7 +445,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -9.0, -10.0), + offset: (-1.5, -3.0, -5.0), central: ("weapon.sword.long_2h_lizardman"), ) ), @@ -475,7 +475,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -9.0, -10.0), + offset: (-1.5, -3.0, -5.0), central: ("weapon.sword.long_2h_lizardman"), ) ), diff --git a/assets/voxygen/voxel/weapon/hammer/2hhammer_wendigo.vox b/assets/voxygen/voxel/weapon/hammer/2hhammer_wendigo.vox index 9a7315e863..2088c702b1 100644 --- a/assets/voxygen/voxel/weapon/hammer/2hhammer_wendigo.vox +++ b/assets/voxygen/voxel/weapon/hammer/2hhammer_wendigo.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:05f0896ab240939bb5a1d89fa0bdbc1e51da5a9a2a2b1c86cc25935ad5aafb8c +oid sha256:3c24338cead72ad5f1dee1a80e5793c16aac0c5db6595f089fd8a0e79a48d488 size 3112 diff --git a/assets/voxygen/voxel/weapon/staff/firestaff_ogre.vox b/assets/voxygen/voxel/weapon/staff/firestaff_ogre.vox index 20337015cc..9720db64e2 100644 --- a/assets/voxygen/voxel/weapon/staff/firestaff_ogre.vox +++ b/assets/voxygen/voxel/weapon/staff/firestaff_ogre.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ae78b481491fa24dfa9ada77861a2094985f59288e88b8e47513ffb20cafff40 +oid sha256:1a7e0f7afd15aae9d17febd8d04873a35bac6aac7ffa8cdb19a8836779bb55db size 2040 diff --git a/assets/voxygen/voxel/weapon/sword/long_2h_lizardman.vox b/assets/voxygen/voxel/weapon/sword/long_2h_lizardman.vox index 514829a2d4..2f08f321fd 100644 --- a/assets/voxygen/voxel/weapon/sword/long_2h_lizardman.vox +++ b/assets/voxygen/voxel/weapon/sword/long_2h_lizardman.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e5ac6c2aa4e33816037279a9a3970c0b489a89d0cc5a3e2217064cccfb1f340 +oid sha256:7e5602954a5d79868eacffbec4a5e27048383753e0d46ab96e2b01532ddd6238 size 1548 diff --git a/voxygen/src/anim/src/biped_large/alpha.rs b/voxygen/src/anim/src/biped_large/alpha.rs index 85dc9f05c1..8c2c7f2b65 100644 --- a/voxygen/src/anim/src/biped_large/alpha.rs +++ b/voxygen/src/anim/src/biped_large/alpha.rs @@ -24,204 +24,420 @@ impl Animation for AlphaAnimation { const UPDATE_FN: &'static [u8] = b"biped_large_alpha\0"; #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_alpha")] + #[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, stage_section): Self::Dependency, anim_time: f64, - _rate: &mut f32, + rate: &mut f32, skeleton_attr: &SkeletonAttr, ) -> Self::Skeleton { + *rate = 1.0; let mut next = (*skeleton).clone(); - let lab = 0.55; + let lab = 1.0; - let slower = (((1.0) - / (0.05 - + 0.95 - * ((anim_time as f32 * lab as f32 * 10.0 - 0.8 * PI).sin()).powf(2.0 as f32))) + let foot = (((1.0) + / (0.2 + + 0.8 + * ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * lab as f32 * 10.0 - 0.8 * PI).sin()); - + * ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin()); let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin(); - - let foothoril = (((1.0) - / (0.4 - + (0.6) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) + let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos(); + let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos(); + let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos(); + let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin(); + let push = anim_time as f32 * lab as f32 * 4.0; + let slow = (((5.0) + / (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); - let foothorir = (((1.0) - / (0.4 - + (0.6) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) + * ((anim_time as f32 * lab as f32 * 9.0).sin()); + let quick = (((5.0) + / (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 18.0).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - - let footrotl = (((5.0) - / (2.5 - + (2.5) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) + * ((anim_time as f32 * lab as f32 * 18.0).sin()); + let axe = (((1.0) + / (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); - - let footrotr = (((5.0) - / (1.0 - + (4.0) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) + * ((anim_time as f32 * lab as f32 * 8.0).sin()); + let staff = (((1.0) + / (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 10.0).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); + * ((anim_time as f32 * lab as f32 * 10.0).sin()); + let slower = (((1.0) + / (0.0001 + 0.999 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 4.0).sin()); - let short = (anim_time as f32 * lab as f32 * 16.0).sin(); + let movement = anim_time as f32 * 1.0; + let test = (anim_time as f32 * 1.75).sin(); - next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_z(slower * 1.0) * Quaternion::rotation_x(0.0); - next.head.scale = Vec3::one() * 1.02; + if let Some(ToolKind::Sword(_)) = active_tool_kind { + next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); + next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); + next.hand_l.scale = Vec3::one() * 1.04; + next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); + next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); + next.hand_r.scale = Vec3::one() * 1.05; + next.main.position = Vec3::new(0.0, 5.0, 2.0); + next.main.orientation = Quaternion::rotation_x(-0.1) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.57) - * Quaternion::rotation_z(1.0); - next.main.scale = Vec3::one() * 1.02; + next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1); - next.second.position = Vec3::new(0.0, 0.0, 0.0); - next.second.orientation = - Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); - next.second.scale = Vec3::one() * 0.0; + if let Some(stage_section) = stage_section { + match stage_section { + StageSection::Buildup => { + //println!("{:.3} build", anim_time); + next.control.position = + Vec3::new(-7.0, 7.0 + movement * -4.0, 2.0 + movement * 1.0); + next.control.orientation = Quaternion::rotation_x(movement * -0.5) + * Quaternion::rotation_y(movement * -1.0) + * Quaternion::rotation_z(movement * -1.2); - next.hand_l.position = Vec3::new( - -skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, - ); - next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_l.scale = Vec3::one() * 1.02; + next.upper_torso.orientation = Quaternion::rotation_z(movement * 1.5); + next.head.orientation = Quaternion::rotation_z(movement * -0.9); + }, + StageSection::Swing => { + //println!("{:.3} swing", anim_time); + next.control.position = Vec3::new(-7.0, 3.0 + movement * 16.0, 3.0); + next.control.orientation = + Quaternion::rotation_x(-0.5 + movement * -1.0 * 0.0) + * Quaternion::rotation_y(-1.0 + movement * -0.6) + * Quaternion::rotation_z(-1.2 + movement * 1.3); - next.hand_r.position = Vec3::new( - skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, - ); - next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.scale = Vec3::one() * 1.02; + next.upper_torso.orientation = Quaternion::rotation_z(1.5 + test * -3.0); + next.head.orientation = Quaternion::rotation_z(-0.9 + test * 2.5); + //next.head.orientation = Quaternion::rotation_z(-test + // * 0.8); next.upper_torso. + // orientation = Quaternion::rotation_x(test * 0.15) + //* Quaternion::rotation_y(movement * 0.3) + //* Quaternion::rotation_z(movement * 1.5); + //next.belt.orientation = Quaternion::rotation_z(test2 + // * 0.5); next.lower_torso. + // orientation = Quaternion::rotation_z(test2 * 1.5); + // next.torso.orientation = Quaternion::rotation_z(test2 + // * 7.2); + }, + StageSection::Recover => { + //println!("{:.3} recover", anim_time); + next.control.position = Vec3::new(-7.0, 15.0, 2.0); + next.control.orientation = Quaternion::rotation_x(-0.5) + * Quaternion::rotation_y(-1.57 + movement * 1.0) + * Quaternion::rotation_z(0.0); + next.control.scale = Vec3::one(); + next.upper_torso.orientation = Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-1.57 + movement * 0.5); - next.upper_torso.position = Vec3::new( - 0.0, - skeleton_attr.upper_torso.0, - skeleton_attr.upper_torso.1, - ); - next.upper_torso.orientation = - Quaternion::rotation_z(slower * -1.2) * Quaternion::rotation_x(-0.3); - next.upper_torso.scale = Vec3::one(); - - next.control.position = Vec3::new(7.0, 9.0, -10.0); - next.control.orientation = Quaternion::rotation_x(slowersmooth * 0.35) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(slowersmooth * -0.5 + slower * -0.5); - next.control.scale = Vec3::one(); - if velocity < 0.5 { - next.lower_torso.position = Vec3::new( - 0.0, - skeleton_attr.lower_torso.0, - skeleton_attr.lower_torso.1, - ); - next.lower_torso.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2); - next.lower_torso.scale = Vec3::one() * 1.02; - - next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1 * 0.0); - next.jaw.orientation = Quaternion::rotation_z(0.0); - next.jaw.scale = Vec3::one(); - - next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); - next.tail.orientation = Quaternion::rotation_z(0.0); - next.tail.scale = Vec3::one(); - - next.shoulder_l.position = Vec3::new( - -skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1, - skeleton_attr.shoulder.2, - ); - next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.shoulder_l.scale = Vec3::one(); - - next.shoulder_r.position = Vec3::new( - skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1, - skeleton_attr.shoulder.2, - ); - next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.shoulder_r.scale = Vec3::one(); - - next.leg_l.position = Vec3::new( - -skeleton_attr.leg.0, - skeleton_attr.leg.1, - skeleton_attr.leg.2, - ) * 1.02; - next.leg_l.orientation = Quaternion::rotation_z(0.0); - next.leg_l.scale = Vec3::one() * 1.02; - - next.leg_r.position = Vec3::new( - skeleton_attr.leg.0, - skeleton_attr.leg.1, - skeleton_attr.leg.2, - ) * 1.02; - next.leg_r.orientation = Quaternion::rotation_z(0.0); - next.leg_r.scale = Vec3::one() * 1.02; - - next.foot_l.position = Vec3::new( - -skeleton_attr.foot.0, - skeleton_attr.foot.1, - skeleton_attr.foot.2, - ) / 8.0; - next.foot_l.orientation = Quaternion::rotation_z(0.0); - next.foot_l.scale = Vec3::one() / 8.0; - - next.foot_r.position = Vec3::new( - skeleton_attr.foot.0, - skeleton_attr.foot.1, - skeleton_attr.foot.2, - ) / 8.0; - next.foot_r.orientation = Quaternion::rotation_z(0.0); - next.foot_r.scale = Vec3::one() / 8.0; - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(0.0); - next.torso.scale = Vec3::one() / 8.0; - } else { - next.lower_torso.position = Vec3::new( - 0.0, - skeleton_attr.lower_torso.0, - skeleton_attr.lower_torso.1, - ); - next.lower_torso.orientation = - Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14); - next.lower_torso.scale = Vec3::one() * 1.02; - - next.shoulder_l.position = Vec3::new( - -skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1 + foothoril * -1.0, - skeleton_attr.shoulder.2, - ); - next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16) - * Quaternion::rotation_y(0.1) - * Quaternion::rotation_z(footrotl * 0.1); - next.shoulder_l.scale = Vec3::one(); - - next.shoulder_r.position = Vec3::new( - skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1 + foothorir * -1.0, - skeleton_attr.shoulder.2, - ); - next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) - * Quaternion::rotation_y(-0.1) - * Quaternion::rotation_z(footrotr * -0.1); - next.shoulder_r.scale = Vec3::one(); - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25); - next.torso.scale = Vec3::one() / 8.0; + next.head.orientation = Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(1.57 + movement * -0.5); + }, + _ => {}, + } + } } + match active_tool_kind { + //TODO: Inventory + Some(ToolKind::Dagger(_)) => { + next.head.position = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); + next.head.orientation = Quaternion::rotation_z(slow * -0.25) + * Quaternion::rotation_x(0.0 + slow * 0.15) + * Quaternion::rotation_y(slow * -0.15); + next.head.scale = Vec3::one() * 1.01; + + next.upper_torso.position = Vec3::new(0.0, skeleton_attr.upper_torso.0, skeleton_attr.upper_torso.1); + next.upper_torso.orientation = Quaternion::rotation_z(slow * 0.4) + * Quaternion::rotation_x(0.0 + slow * -0.2) + * Quaternion::rotation_y(slow * 0.2); + next.upper_torso.scale = Vec3::one(); + + next.lower_torso.position = + Vec3::new(0.0, skeleton_attr.lower_torso.0, skeleton_attr.lower_torso.1); + next.lower_torso.orientation = next.upper_torso.orientation * -0.45; + + // TODO: Fix animation + next.hand_l.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_l.scale = Vec3::one() * 1.12; + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.hand_r.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); + next.hand_r.scale = Vec3::one() * 1.12; + + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_x(0.0); + + // next.r_control.position = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, + // 2.0); next.r_control.orientation = + // Quaternion::rotation_x(-1.4 + slow * 0.4) + // * Quaternion::rotation_y(slow * -1.3) + // * Quaternion::rotation_z(1.4 + slow * -0.5); + // next.r_control.scale = Vec3::one(); + + // next.hand_r.position = Vec3::new(0.75, -1.5, -5.5); + // next.hand_r.orientation = Quaternion::rotation_x(1.27); + // next.hand_r.scale = Vec3::one() * 1.05; + + // next.control.position = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0); + // next.control.orientation = Quaternion::rotation_x(-1.4 + slow * 0.4) + // * Quaternion::rotation_y(slow * -1.3) + // * Quaternion::rotation_z(1.4 + slow * -0.5); + // next.control.scale = Vec3::one(); + + next.foot_l.position = Vec3::new( + -skeleton_attr.foot.0, + slow * -3.0 + quick * 3.0 - 4.0, + skeleton_attr.foot.2, + ) / 8.0; + next.foot_l.orientation = Quaternion::rotation_x(slow * 0.6) + * Quaternion::rotation_y((slow * -0.2).max(0.0)); + next.foot_l.scale = Vec3::one() / 8.0; + + next.foot_r.position = Vec3::new( + skeleton_attr.foot.0, + slow * 3.0 + quick * -3.0 + 5.0, + skeleton_attr.foot.2, + ) / 8.0; + next.foot_r.orientation = Quaternion::rotation_x(slow * -0.6) + * Quaternion::rotation_y((slow * 0.2).min(0.0)); + next.foot_r.scale = Vec3::one() / 8.0; + + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + }, + Some(ToolKind::Axe(_)) => { + next.head.position = + Vec3::new(0.0, 0.0 + skeleton_attr.head.0, skeleton_attr.head.1); + next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.2); + next.head.scale = Vec3::one() * 1.01; + + next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0); + next.upper_torso.orientation = Quaternion::rotation_z(0.2 + axe * 0.2); + next.upper_torso.scale = Vec3::one(); + + next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0); + next.lower_torso.orientation = Quaternion::rotation_z(0.2 + axe * -0.2); + + next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(0.0); + next.hand_l.scale = Vec3::one() * 1.08; + next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(0.0); + next.hand_r.scale = Vec3::one() * 1.06; + next.main.position = Vec3::new(-0.0, -2.0, -1.0); + next.main.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + + next.control.position = Vec3::new(2.0 + axe * -7.0, 11.0, 3.0); + next.control.orientation = Quaternion::rotation_x(1.6) + * Quaternion::rotation_y(-2.0 + axe * 0.5) + * Quaternion::rotation_z(PI * 0.4); + + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + }, + Some(ToolKind::Hammer(_)) => { + next.hand_l.position = Vec3::new(-15.0, 0.0, 0.0); + next.hand_l.orientation = + Quaternion::rotation_x(-0.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-PI / 2.0);; + next.hand_l.scale = Vec3::one() * 1.08; + next.hand_r.position = Vec3::new(3.0, 0.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-PI / 2.0); + next.hand_r.scale = Vec3::one() * 1.06; + next.main.position = Vec3::new(2.0, 0.0, -12.0); + next.main.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(-1.57) + * Quaternion::rotation_z(1.57); + + next.head.position = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); + next.head.orientation = Quaternion::rotation_z(slower * 0.03) + * Quaternion::rotation_x(slowersmooth * 0.1) + * Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06) + * Quaternion::rotation_z((slowersmooth * -0.4).max(0.0)); + next.head.scale = Vec3::one() * 1.01; + + next.upper_torso.position = Vec3::new( + 0.0, + skeleton_attr.upper_torso.0, + skeleton_attr.upper_torso.1, + ); + next.upper_torso.orientation = + Quaternion::rotation_z(slower * 0.18 + slowersmooth * 0.15) + * Quaternion::rotation_x(0.0 + slower * 0.18 + slowersmooth * 0.15) + * Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15); + + next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0); + next.lower_torso.orientation = + Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075) + * Quaternion::rotation_x(0.0 + slower * -0.1) + * Quaternion::rotation_y(slower * -0.1); + + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_z(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + + if velocity > 0.5 { + next.foot_l.position = + Vec3::new(-skeleton_attr.foot.0, foot * -6.0, skeleton_attr.foot.2) / 8.0; + next.foot_l.orientation = Quaternion::rotation_x(foot * -0.4) + * Quaternion::rotation_z((slower * 0.3).max(0.0)); + next.foot_l.scale = Vec3::one() / 8.0; + + next.foot_r.position = + Vec3::new(skeleton_attr.foot.0, foot * 6.0, skeleton_attr.foot.2) / 8.0; + next.foot_r.orientation = Quaternion::rotation_x(foot * 0.4) + * Quaternion::rotation_z((slower * 0.3).max(0.0)); + next.foot_r.scale = Vec3::one() / 8.0; + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.15); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + } else { + next.foot_l.position = Vec3::new( + -skeleton_attr.foot.0, + -2.5, + skeleton_attr.foot.2 + (slower * 2.5).max(0.0), + ) / 8.0; + next.foot_l.orientation = Quaternion::rotation_x(slower * -0.2 - 0.2) + * Quaternion::rotation_z((slower * 1.0).max(0.0)); + next.foot_l.scale = Vec3::one() / 8.0; + + next.foot_r.position = Vec3::new( + skeleton_attr.foot.0, + 3.5 - slower * 2.0, + skeleton_attr.foot.2, + ) / 8.0; + next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1) + * Quaternion::rotation_z((slower * 0.5).max(0.0)); + next.foot_r.scale = Vec3::one() / 8.0; + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_z(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + } + + next.control.scale = Vec3::one(); + next.control.position = Vec3::new(-8.0, 7.0, 1.0); + next.control.orientation = Quaternion::rotation_x(-1.5 + slower * 1.5) + * Quaternion::rotation_y(slowersmooth * 0.35 - 0.3) + * Quaternion::rotation_z(1.4 + slowersmooth * 0.2); + next.control.scale = Vec3::one(); + + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_z(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + }, + Some(ToolKind::Staff(_)) => { + next.head.orientation = + Quaternion::rotation_x(staff * 0.2) * Quaternion::rotation_z(staff * 0.2); + next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); + next.hand_l.orientation = + Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); + next.hand_l.scale = Vec3::one() * 1.02; + next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); + next.hand_r.orientation = + Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); + next.hand_r.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(12.0, 8.5, 13.2); + next.main.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(3.14) + * Quaternion::rotation_z(0.0); + next.upper_torso.orientation = Quaternion::rotation_z(staff * 0.3); + next.lower_torso.orientation = Quaternion::rotation_z(staff * 0.4); + + next.control.position = Vec3::new(-20.0, 5.0 + staff * 3.0, 1.0); + next.control.orientation = Quaternion::rotation_x(staff * 1.2) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.control.scale = Vec3::one(); + }, + Some(ToolKind::Shield(_)) => { + next.head.position = Vec3::new( + 0.0, + 0.0 + skeleton_attr.head.0 + decel * 0.8, + skeleton_attr.head.1, + ); + next.head.orientation = Quaternion::rotation_z(decel * 0.25) + * Quaternion::rotation_x(0.0 + decel * 0.1) + * Quaternion::rotation_y(decel * -0.1); + next.head.scale = Vec3::one() * 1.01; + + next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0); + next.upper_torso.orientation = Quaternion::rotation_z(decel * -0.2) + * Quaternion::rotation_x(0.0 + decel * -0.2) + * Quaternion::rotation_y(decel * 0.2); + + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.scale = Vec3::one() / 8.0 * 1.01; + + next.lower_torso.position = Vec3::new(0.0, 0.0, 0.0); + + next.hand_l.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(0.0); + next.hand_l.scale = Vec3::one() * 1.01; + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_z(0.0); + + next.hand_r.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0); + next.hand_r.scale = Vec3::one() * 1.01; + + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_x(0.0); + }, + Some(ToolKind::Debug(_)) => { + next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0); + next.hand_l.orientation = Quaternion::rotation_x(1.27) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.hand_l.scale = Vec3::one() * 1.01; + next.main.position = Vec3::new(-5.0, 5.0, 23.0); + next.main.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(PI) + * Quaternion::rotation_y(0.0); + next.main.scale = Vec3::one(); + next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; + next.torso.orientation = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 8.0 * 1.01; + }, + _ => {}, + } + next.shoulder_l.scale = Vec3::one(); + next.shoulder_r.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.hands()), + second_tool_kind.map(|tk| tk.hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/biped_large/beta.rs b/voxygen/src/anim/src/biped_large/beta.rs index da1e1afbab..5ba21e8bb9 100644 --- a/voxygen/src/anim/src/biped_large/beta.rs +++ b/voxygen/src/anim/src/biped_large/beta.rs @@ -64,7 +64,7 @@ impl Animation for BetaAnimation { next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(0.0, 0.0, 2.0); + next.main.position = Vec3::new(0.0, 5.0, 2.0); next.main.orientation = Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -219,7 +219,7 @@ impl Animation for BetaAnimation { skeleton_attr.shoulder.2, ); next.shoulder_l.orientation = Quaternion::rotation_x(0.0); - next.shoulder_l.scale = Vec3::one() * 1.1; + next.shoulder_l.scale = Vec3::one(); next.shoulder_r.position = Vec3::new( skeleton_attr.shoulder.0, @@ -227,7 +227,7 @@ impl Animation for BetaAnimation { skeleton_attr.shoulder.2, ); next.shoulder_r.orientation = Quaternion::rotation_x(0.0); - next.shoulder_r.scale = Vec3::one() * 1.1; + next.shoulder_r.scale = Vec3::one(); next.second.scale = match ( active_tool_kind.map(|tk| tk.hands()), diff --git a/voxygen/src/anim/src/biped_large/charge.rs b/voxygen/src/anim/src/biped_large/charge.rs index 8a21bd9bfd..943b1e5620 100644 --- a/voxygen/src/anim/src/biped_large/charge.rs +++ b/voxygen/src/anim/src/biped_large/charge.rs @@ -152,7 +152,7 @@ impl Animation for ChargeAnimation { skeleton_attr.jaw.1 + slow * 0.2, ); next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; + next.jaw.scale = Vec3::one() * 0.98; next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); next.tail.orientation = @@ -223,33 +223,13 @@ impl Animation for ChargeAnimation { skeleton_attr.jaw.1 + slow * 0.2, ); next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; + next.jaw.scale = Vec3::one() * 0.98; next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); next.tail.scale = Vec3::one(); - next.shoulder_l.position = Vec3::new( - -skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1 + foothoril * -1.0, - skeleton_attr.shoulder.2, - ); - next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16) - * Quaternion::rotation_y(0.1) - * Quaternion::rotation_z(footrotl * 0.1); - next.shoulder_l.scale = Vec3::one(); - - next.shoulder_r.position = Vec3::new( - skeleton_attr.shoulder.0, - skeleton_attr.shoulder.1 + foothorir * -1.0, - skeleton_attr.shoulder.2, - ); - next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) - * Quaternion::rotation_y(-0.1) - * Quaternion::rotation_z(footrotr * -0.1); - next.shoulder_r.scale = Vec3::one(); - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25); next.torso.scale = Vec3::one() / 8.0; @@ -294,28 +274,62 @@ impl Animation for ChargeAnimation { } match active_tool_kind { Some(ToolKind::Bow(_)) => { - next.hand_l.position = Vec3::new(1.0, -2.0 + stop * -1.0, 0.0); + next.hand_l.position = Vec3::new(2.0, -2.0 + stop * -1.0, 0.0); next.hand_l.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.hand_l.scale = Vec3::one() * 1.05; - next.hand_r.position = Vec3::new(4.9, 1.0, -5.0); + + next.hand_r.position = Vec3::new(5.9, 0.0, -5.0); next.hand_r.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(8.0, 2.0, -14.0); + + next.shoulder_l.position = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothoril * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_l.orientation = Quaternion::rotation_x(1.4 + footrotl * -0.06) + * Quaternion::rotation_y(-0.9) + * Quaternion::rotation_z(footrotl * -0.05); + next.shoulder_l.scale = Vec3::one(); + + next.shoulder_r.position = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothorir * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_r.orientation = Quaternion::rotation_x(1.3 + footrotr * -0.06) + * Quaternion::rotation_y(-0.5) //1.9 + * Quaternion::rotation_z(footrotr * -0.05); + next.shoulder_r.scale = Vec3::one(); + + next.jaw.position = Vec3::new( + 0.0, + skeleton_attr.jaw.0, + skeleton_attr.jaw.1, + ); + next.jaw.orientation = Quaternion::rotation_x(stop * 0.05); + + next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); + next.tail.orientation = + Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0) * Quaternion::rotation_x(-0.2 * stop); + next.tail.scale = Vec3::one(); + + next.main.position = Vec3::new(7.0, 2.0, -13.0); next.main.orientation = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.3) * Quaternion::rotation_z(-0.6); - next.hold.position = Vec3::new(0.4, -0.3, -5.8); + next.hold.position = Vec3::new(1.4, -0.3, -13.8); next.hold.orientation = Quaternion::rotation_x(-1.6) * Quaternion::rotation_y(-0.1) * Quaternion::rotation_z(0.0); next.hold.scale = Vec3::one() * 1.0; - next.control.position = Vec3::new(-10.0 + stop * 13.0, 6.0 + stop * 4.0, 4.0); + next.control.position = Vec3::new(-10.0 + stop * 13.0, 6.0 + stop * 4.0, -2.0); next.control.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(stop * -0.4) * Quaternion::rotation_z(stop * -0.6); @@ -325,10 +339,37 @@ impl Animation for ChargeAnimation { next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); next.hand_l.orientation = Quaternion::rotation_x(1.27); next.hand_l.scale = Vec3::one() * 1.05; + next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); next.hand_r.scale = Vec3::one() * 1.05; + + next.shoulder_l.position = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothoril * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16) + * Quaternion::rotation_y(0.1) + * Quaternion::rotation_z(footrotl * 0.1); + next.shoulder_l.scale = Vec3::one(); + + next.shoulder_r.position = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothorir * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) + * Quaternion::rotation_y(-0.1) + * Quaternion::rotation_z(footrotr * -0.1); + next.shoulder_r.scale = Vec3::one(); + + next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); + next.tail.orientation = + Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0) * Quaternion::rotation_x(-0.2 * stop); + next.tail.scale = Vec3::one(); + next.main.position = Vec3::new(8.0, 8.5, 13.2); next.main.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(3.14) diff --git a/voxygen/src/anim/src/biped_large/dash.rs b/voxygen/src/anim/src/biped_large/dash.rs index 98b7157c80..744830b35b 100644 --- a/voxygen/src/anim/src/biped_large/dash.rs +++ b/voxygen/src/anim/src/biped_large/dash.rs @@ -75,10 +75,10 @@ impl Animation for DashAnimation { next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); - next.hand_l.scale = Vec3::one() * 1.04; + next.hand_l.scale = Vec3::one() * 1.02; next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); - next.hand_r.scale = Vec3::one() * 1.05; + next.hand_r.scale = Vec3::one() * 1.02; next.main.position = Vec3::new(0.0, 0.0, 2.0); next.main.orientation = Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.0) @@ -103,13 +103,13 @@ impl Animation for DashAnimation { -skeleton_attr.foot.0, skeleton_attr.foot.1 + movement * -12.0, skeleton_attr.foot.2, - ); + ) / 8.0; next.foot_l.orientation = Quaternion::rotation_x(movement * -1.0); next.foot_r.position = Vec3::new( skeleton_attr.foot.0, skeleton_attr.foot.1, skeleton_attr.foot.2, - ); + ) / 8.0; }, StageSection::Charge => { next.head.position = Vec3::new( @@ -143,7 +143,7 @@ impl Animation for DashAnimation { 2.0 - skeleton_attr.foot.0, skeleton_attr.foot.1 + foothoril * -7.5, 2.0 + skeleton_attr.foot.2 + ((footvertl * -4.0).max(-1.0)), - ); + ) / 8.0; next.foot_l.orientation = Quaternion::rotation_x(-0.6 + footrotl * -0.6) * Quaternion::rotation_z(-0.2); @@ -152,7 +152,7 @@ impl Animation for DashAnimation { 2.0 + skeleton_attr.foot.0, skeleton_attr.foot.1 + foothorir * -7.5, 2.0 + skeleton_attr.foot.2 + ((footvertr * -4.0).max(-1.0)), - ); + ) / 8.0; next.foot_r.orientation = Quaternion::rotation_x(-0.6 + footrotr * -0.6) * Quaternion::rotation_z(-0.2); @@ -180,6 +180,7 @@ impl Animation for DashAnimation { Quaternion::rotation_x(-1.5) * Quaternion::rotation_y(-1.0); next.control.scale = Vec3::one(); }, + _ => {}, } } }, @@ -203,10 +204,10 @@ impl Animation for DashAnimation { next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5); next.hand_l.orientation = Quaternion::rotation_x(1.27); - next.hand_l.scale = Vec3::one() * 1.04; + next.hand_l.scale = Vec3::one() * 1.02; next.hand_r.position = Vec3::new(0.75, -1.5, -5.5); next.hand_r.orientation = Quaternion::rotation_x(1.27); - next.hand_r.scale = Vec3::one() * 1.05; + next.hand_r.scale = Vec3::one() * 1.02; next.main.position = Vec3::new(0.0, 6.0, -1.0); next.main.orientation = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index b3f7772713..28339bb07f 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -8,11 +8,13 @@ pub mod shoot; pub mod charge; pub mod dash; pub mod spin; +pub mod spinmelee; // Reexports pub use self::{ alpha::AlphaAnimation, beta::BetaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, wield::WieldAnimation, charge::ChargeAnimation, shoot::ShootAnimation, dash::DashAnimation, spin::SpinAnimation, + spinmelee::SpinMeleeAnimation, }; use super::{make_bone, vek::*, FigureBoneData, Skeleton}; diff --git a/voxygen/src/anim/src/biped_large/run.rs b/voxygen/src/anim/src/biped_large/run.rs index e1824e8f4a..15e4dbb574 100644 --- a/voxygen/src/anim/src/biped_large/run.rs +++ b/voxygen/src/anim/src/biped_large/run.rs @@ -213,6 +213,8 @@ impl Animation for RunAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25); next.torso.scale = Vec3::one() / 8.0; + + next.hold.scale = Vec3::one() * 0.0; } else { next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02; next.head.orientation = Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05); @@ -335,6 +337,8 @@ impl Animation for RunAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25); next.torso.scale = Vec3::one() / 8.0; + + next.hold.scale = Vec3::one() * 0.0; } next } diff --git a/voxygen/src/anim/src/biped_large/shoot.rs b/voxygen/src/anim/src/biped_large/shoot.rs index c25edfb31d..98f5c6e29b 100644 --- a/voxygen/src/anim/src/biped_large/shoot.rs +++ b/voxygen/src/anim/src/biped_large/shoot.rs @@ -128,7 +128,7 @@ impl Animation for ShootAnimation { skeleton_attr.jaw.1 + slow * 0.2, ); next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; + next.jaw.scale = Vec3::one() * 0.98; next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); next.tail.orientation = @@ -293,22 +293,51 @@ impl Animation for ShootAnimation { match active_tool_kind { Some(ToolKind::Bow(_)) => { next.hand_l.position = - Vec3::new(1.0 - exp * 2.0, -4.0 - exp * 4.0, -1.0 + exp * 6.0); + Vec3::new(-10.0 - exp * 2.0, -4.0 - exp * 4.0, -1.0 + exp * 6.0); next.hand_l.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6 + exp * 0.8) * Quaternion::rotation_z(-0.3 + exp * 0.9); - next.hand_l.scale = Vec3::one() * 1.05; + next.hand_l.scale = Vec3::one() * 1.02; + next.hand_r.position = Vec3::new(4.9, 3.0, -4.0); next.hand_r.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); - next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(3.0, 2.0, -13.0); + next.hand_r.scale = Vec3::one() * 1.02; + + next.shoulder_l.position = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothoril * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_l.orientation = Quaternion::rotation_x(1.4 + footrotl * -0.06) + * Quaternion::rotation_y(-0.9) + * Quaternion::rotation_z(footrotl * -0.05); + next.shoulder_l.scale = Vec3::one(); + + next.shoulder_r.position = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1 + foothorir * -1.0, + skeleton_attr.shoulder.2, + ); + next.shoulder_r.orientation = Quaternion::rotation_x(1.8 + footrotr * -0.06) + * Quaternion::rotation_y(-0.5) //1.9 + * Quaternion::rotation_z(footrotr * -0.05); + next.shoulder_r.scale = Vec3::one(); + + next.jaw.position = Vec3::new( + 0.0, + skeleton_attr.jaw.0, + skeleton_attr.jaw.1, + ); + next.jaw.orientation = Quaternion::rotation_x(-0.2); + + next.main.position = Vec3::new(7.0, 5.0, -13.0); next.main.orientation = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.3) * Quaternion::rotation_z(-0.6); - next.control.position = Vec3::new(-9.0, 6.0, 8.0); + next.control.position = Vec3::new(6.0, 6.0, 8.0); next.control.orientation = Quaternion::rotation_x(exp * 0.4) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -318,12 +347,38 @@ impl Animation for ShootAnimation { next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - next.hand_l.scale = Vec3::one() * 1.05; + next.hand_l.scale = Vec3::one() * 1.02; + next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(8.0, 8.5, 13.2); + next.hand_r.scale = Vec3::one() * 1.02; + + next.jaw.position = Vec3::new( + 0.0, + skeleton_attr.jaw.0, + skeleton_attr.jaw.1, + ); + + next.shoulder_l.position = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); + next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(2.0); + next.shoulder_l.scale = Vec3::one(); + + next.shoulder_r.position = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); + next.shoulder_r.orientation = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(2.0); + next.shoulder_r.scale = Vec3::one(); + + next.jaw.orientation = Quaternion::rotation_x(-0.2); + + next.main.position = Vec3::new(10.0, 12.5, 13.2); next.main.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(3.14) * Quaternion::rotation_z(0.0); diff --git a/voxygen/src/anim/src/biped_large/spin.rs b/voxygen/src/anim/src/biped_large/spin.rs index ff0b469dc8..4e07a848e3 100644 --- a/voxygen/src/anim/src/biped_large/spin.rs +++ b/voxygen/src/anim/src/biped_large/spin.rs @@ -60,11 +60,11 @@ impl Animation for SpinAnimation { if let Some(ToolKind::Sword(_)) = active_tool_kind { next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); - next.hand_l.scale = Vec3::one() * 1.04; + next.hand_l.scale = Vec3::one() * 1.02; next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); - next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(0.0, 0.0, 2.0); + next.hand_r.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(0.0, 5.0, 2.0); next.main.orientation = Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); diff --git a/voxygen/src/anim/src/biped_large/spinmelee.rs b/voxygen/src/anim/src/biped_large/spinmelee.rs new file mode 100644 index 0000000000..94145f87ed --- /dev/null +++ b/voxygen/src/anim/src/biped_large/spinmelee.rs @@ -0,0 +1,258 @@ +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; +use common::{ + comp::item::{Hands, ToolKind}, + states::utils::StageSection, +}; +use std::f32::consts::PI; + +pub struct SpinMeleeAnimation; + +impl Animation for SpinMeleeAnimation { + type Dependency = ( + Option, + Option, + Vec3, + f64, + Option, + ); + type Skeleton = BipedLargeSkeleton; + + #[cfg(feature = "use-dyn-lib")] + const UPDATE_FN: &'static [u8] = b"biped_large_spinmelee\0"; + + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_spinmelee")] + #[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, stage_section): Self::Dependency, + anim_time: f64, + rate: &mut f32, + skeleton_attr: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + let lab = 1.0; + let speed = Vec2::::from(velocity).magnitude(); + let mut next = (*skeleton).clone(); + //torso movement + let xshift = if velocity.z.abs() < 0.1 { + ((anim_time as f32 - 1.1) * lab as f32 * 3.0).sin() + } else { + 0.0 + }; + let yshift = if velocity.z.abs() < 0.1 { + ((anim_time as f32 - 1.1) * lab as f32 * 3.0 + PI / 2.0).sin() + } else { + 0.0 + }; + + let spin = if anim_time < 1.1 && velocity.z.abs() < 0.1 { + 0.5 * ((anim_time as f32).powf(2.0)) + } else { + lab as f32 * anim_time as f32 * 0.9 + }; + let movement = anim_time as f32 * 1.0; + + //feet + let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin(); + let quick = (anim_time as f32 * lab as f32 * 8.0).sin(); + + match active_tool_kind { + Some(ToolKind::Sword(_)) => { + next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); + next.hand_l.orientation = + Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); + next.hand_l.scale = Vec3::one() * 1.02; + next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); + next.hand_r.orientation = + Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); + next.hand_r.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(0.0, 5.0, 2.0); + next.main.orientation = Quaternion::rotation_x(-0.1) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.head.position = + Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1); + + if let Some(stage_section) = stage_section { + match stage_section { + StageSection::Buildup => { + next.control.position = + Vec3::new(-7.0, 7.0 + movement * -8.0, 2.0 + movement * -6.0); + next.control.orientation = Quaternion::rotation_x(movement * -0.5) + * Quaternion::rotation_y(movement * 0.3) + * Quaternion::rotation_z(movement * -1.5); + next.upper_torso.position = Vec3::new( + 0.0, + skeleton_attr.upper_torso.0 + movement * -1.0, + skeleton_attr.upper_torso.1 + movement * -2.5, + ); + next.upper_torso.orientation = Quaternion::rotation_x(movement * -1.1) + * Quaternion::rotation_z(movement * -0.35); + next.lower_torso.orientation = Quaternion::rotation_z(movement * 0.5); + next.head.position = Vec3::new( + 0.0, + skeleton_attr.head.0 - 2.0 + movement * -6.0, + skeleton_attr.head.1 + movement * -4.0, + ); + next.head.orientation = Quaternion::rotation_x(movement * 0.9) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(movement * 0.05); + + next.foot_l.position = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1 + movement * 4.0, + skeleton_attr.foot.2, + ) / 8.0; + next.foot_l.orientation = Quaternion::rotation_x(movement * 0.2); + next.foot_r.position = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1 + movement * -12.0, + skeleton_attr.foot.2 + movement * 1.0 + quick * 1.0, + ) / 8.0; + next.foot_r.orientation = Quaternion::rotation_x(movement * -1.0) + * Quaternion::rotation_z(movement * -0.8); + }, + StageSection::Swing => { + next.head.position = + Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1); + + next.control.position = Vec3::new(-7.0, 7.0, 2.0); + next.control.orientation = Quaternion::rotation_x(-PI / 2.0) + * Quaternion::rotation_z(-PI / 2.0); + next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0); + + next.upper_torso.position = + Vec3::new(0.0, skeleton_attr.upper_torso.0, skeleton_attr.upper_torso.1); + next.upper_torso.orientation = Quaternion::rotation_y(0.3); + next.head.position = + Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1); + next.head.orientation = Quaternion::rotation_x(-0.15); + next.lower_torso.orientation = Quaternion::rotation_x(0.2); + }, + StageSection::Recover => { + next.head.position = + Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1); + next.control.position = Vec3::new(-7.0, 7.0, 2.0); + next.control.orientation = + Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0) + * Quaternion::rotation_z(-PI / 2.0 + movement * PI / 2.0); + next.head.orientation = Quaternion::rotation_x(-0.15 + movement * 0.15); + next.upper_torso.orientation = Quaternion::rotation_y(0.3 + movement * -0.3) + }, + _ => {}, + } + } + }, + Some(ToolKind::Axe(_)) => { + next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(PI); + next.hand_l.scale = Vec3::one() * 1.08; + next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(0.0); + next.hand_r.scale = Vec3::one() * 1.06; + next.main.position = Vec3::new(-0.0, -2.0, -1.0); + next.main.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + + next.control.position = Vec3::new(0.0, 16.0, 3.0); + next.control.orientation = Quaternion::rotation_x(-1.4) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(1.4); + next.control.scale = Vec3::one(); + + next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1); + next.head.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(-0.15) + * Quaternion::rotation_y(0.08); + next.upper_torso.position = Vec3::new( + 0.0, + skeleton_attr.upper_torso.0 - 3.0, + skeleton_attr.upper_torso.1 - 2.0, + ); + next.upper_torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(-0.1) + * Quaternion::rotation_y(0.3); + next.upper_torso.scale = Vec3::one(); + + next.lower_torso.position = Vec3::new(0.0, 3.0, -2.5); + next.lower_torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.7) + * Quaternion::rotation_y(0.0); + next.lower_torso.scale = Vec3::one(); + next.torso.position = Vec3::new( + -xshift * (anim_time as f32).min(0.6), + -yshift * (anim_time as f32).min(0.6), + 0.0, + ) * 1.01; + next.torso.orientation = Quaternion::rotation_z(spin * -16.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.torso.scale = Vec3::one() / 11.0 * 1.01; + if velocity.z.abs() > 0.1 { + next.foot_l.position = + Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0); + next.foot_l.orientation = + Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0); + next.foot_l.scale = Vec3::one(); + + next.foot_r.position = + Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0); + next.foot_r.orientation = Quaternion::rotation_x(1.0); + next.foot_r.scale = Vec3::one(); + } else if speed < 0.5 { + next.foot_l.position = Vec3::new( + -skeleton_attr.foot.0, + 2.0 + quick * -6.0, + skeleton_attr.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2) + * Quaternion::rotation_z(0.0); + next.foot_l.scale = Vec3::one(); + + next.foot_r.position = + Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2) + * Quaternion::rotation_y(-0.4); + next.foot_r.scale = Vec3::one(); + } else { + next.foot_l.position = Vec3::new( + -skeleton_attr.foot.0, + 2.0 + quick * -6.0, + skeleton_attr.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2) + * Quaternion::rotation_z(0.0); + next.foot_l.scale = Vec3::one(); + + next.foot_r.position = Vec3::new( + skeleton_attr.foot.0, + 2.0 + quick * 6.0, + skeleton_attr.foot.2, + ); + next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2) + * Quaternion::rotation_z(0.0); + next.foot_r.scale = Vec3::one(); + }; + }, + _ => {}, + } + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.hands()), + second_tool_kind.map(|tk| tk.hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + + next + } +} diff --git a/voxygen/src/anim/src/biped_large/wield.rs b/voxygen/src/anim/src/biped_large/wield.rs index fde65bf713..ba58b5ae41 100644 --- a/voxygen/src/anim/src/biped_large/wield.rs +++ b/voxygen/src/anim/src/biped_large/wield.rs @@ -23,6 +23,18 @@ impl Animation for WieldAnimation { skeleton_attr: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 3.0) + .floor() + .mul(7331.0) + .sin() + * 0.2, + ((global_time + anim_time) as f32 / 3.0) + .floor() + .mul(1337.0) + .sin() + * 0.1, + ); let lab = 0.55; let breathe = (anim_time as f32 + 1.5 * PI).sin(); @@ -152,7 +164,7 @@ impl Animation for WieldAnimation { skeleton_attr.jaw.1 + slow * 0.2, ); next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; + next.jaw.scale = Vec3::one() * 0.98; next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); next.tail.orientation = @@ -216,7 +228,7 @@ impl Animation for WieldAnimation { skeleton_attr.jaw.1 + slow * 0.2, ); next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; + next.jaw.scale = Vec3::one() * 0.98; next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1); next.tail.orientation = @@ -280,15 +292,108 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(test * 0.02) * Quaternion::rotation_z(test * 0.02); next.control.scale = Vec3::one(); + + next.hold.scale = Vec3::one() * 0.0; } match active_tool_kind { + Some(ToolKind::Sword(_)) => { + next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); + next.hand_l.orientation = + Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); + next.hand_l.scale = Vec3::one() * 1.02; + next.hand_r.position = Vec3::new(3.75, -1.5, -0.5); + next.hand_r.orientation = + Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); + next.hand_r.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(1.0, 6.0, 1.0); + next.main.orientation = Quaternion::rotation_x(-0.1); + + next.control.position = Vec3::new(-7.0, 7.0, -10.0); + next.control.orientation = Quaternion::rotation_x(u_slow * 0.15) + * Quaternion::rotation_z(u_slowalt * 0.08); + next.control.scale = Vec3::one(); + }, + Some(ToolKind::Dagger(_)) => { + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.position = Vec3::new(0.0, 0.0, 0.0); + + next.hand_l.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.hand_l.scale = Vec3::one() * hand_scale; + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + + next.hand_r.position = Vec3::new(0.0, 0.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.hand_r.scale = Vec3::one() * hand_scale; + + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + }, + Some(ToolKind::Axe(_)) => { + if velocity < 0.5 { + next.head.position = Vec3::new( + 0.0, + -3.5 + skeleton_attr.head.0, + skeleton_attr.head.1 + u_slow * 0.1, + ); + next.head.orientation = Quaternion::rotation_z(head_look.x) + * Quaternion::rotation_x(0.35 + head_look.y.abs()); + next.head.scale = Vec3::one() * 1.01; + next.upper_torso.orientation = Quaternion::rotation_x(-0.35) + * Quaternion::rotation_y(u_slowalt * 0.04) + * Quaternion::rotation_z(0.15); + next.lower_torso.position = + Vec3::new(0.0, 1.0 + skeleton_attr.lower_torso.0, skeleton_attr.lower_torso.1); + next.lower_torso.orientation = + Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25); + next.control.orientation = Quaternion::rotation_x(1.8) + * Quaternion::rotation_y(-0.5) + * Quaternion::rotation_z(PI - 0.2); + next.control.scale = Vec3::one(); + } else { + next.control.orientation = Quaternion::rotation_x(2.1) + * Quaternion::rotation_y(-0.4) + * Quaternion::rotation_z(PI - 0.2); + next.control.scale = Vec3::one(); + } + next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(0.0); + next.hand_l.scale = Vec3::one() * 1.08; + next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + * Quaternion::rotation_z(0.0) + * Quaternion::rotation_y(0.0); + next.hand_r.scale = Vec3::one() * 1.06; + next.main.position = Vec3::new(-0.0, -2.0, -1.0); + next.main.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + + next.control.position = Vec3::new(-3.0, 11.0, 3.0); + }, Some(ToolKind::Bow(_)) => { - next.hand_l.position = Vec3::new(2.0, 1.5, 0.0); + next.hand_l.position = Vec3::new(3.0, 2.5, 0.0); next.hand_l.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.hand_l.scale = Vec3::one() * 1.05; - next.hand_r.position = Vec3::new(5.9, 4.5, -5.0); + next.hand_r.position = Vec3::new(5.9, 5.5, -5.0); next.hand_r.orientation = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); @@ -298,13 +403,13 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(0.3) * Quaternion::rotation_z(-0.6); - next.hold.position = Vec3::new(1.2, -1.0, -5.2); + next.hold.position = Vec3::new(1.2, -1.0, -14.2); next.hold.orientation = Quaternion::rotation_x(-1.7) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(-0.1); next.hold.scale = Vec3::one() * 1.0; - next.control.position = Vec3::new(-7.0, 3.0, -6.0); + next.control.position = Vec3::new(-7.0, 3.0, -8.0); next.control.orientation = Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1); next.control.scale = Vec3::one(); @@ -339,66 +444,39 @@ impl Animation for WieldAnimation { next.main.scale = Vec3::one() * 1.02; }, Some(ToolKind::Staff(_)) => { - next.hand_l.position = Vec3::new( - -skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, - ); - next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_l.scale = Vec3::one() * 1.02; - - next.hand_r.position = Vec3::new( - skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, - ); - next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.scale = Vec3::one() * 1.02; - next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.scale = Vec3::one() * 1.02; - - next.control.position = Vec3::new(7.0, 9.0, -10.0); - next.control.orientation = Quaternion::rotation_x(test * 0.02) - * Quaternion::rotation_y(test * 0.02) - * Quaternion::rotation_z(test * 0.02); - next.control.scale = Vec3::one(); + next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); + next.hand_l.orientation = + Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); + next.hand_l.scale = Vec3::one() * 1.05; + next.hand_r.position = Vec3::new(17.0, 7.5, 2.0); + next.hand_r.orientation = + Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.8); + next.hand_r.scale = Vec3::one() * 1.05; - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.57) - * Quaternion::rotation_z(1.0); - next.main.scale = Vec3::one() * 1.02; - }, - Some(ToolKind::Sword(_)) => { - next.hand_l.position = Vec3::new( - -skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, + next.shoulder_l.position = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, ); - next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_l.scale = Vec3::one() * 1.02; - - next.hand_r.position = Vec3::new( - skeleton_attr.hand.0 - 7.0, - skeleton_attr.hand.1 - 7.0, - skeleton_attr.hand.2 + 10.0, + next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.shoulder_l.scale = Vec3::one(); + + next.shoulder_r.position = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, ); - next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.scale = Vec3::one() * 1.02; - next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.scale = Vec3::one() * 1.02; - - next.control.position = Vec3::new(7.0, 9.0, -10.0); - next.control.orientation = Quaternion::rotation_x(test * 0.02) - * Quaternion::rotation_y(test * 0.02) - * Quaternion::rotation_z(test * 0.02); - next.control.scale = Vec3::one(); + next.shoulder_r.orientation = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(1.0); + next.shoulder_r.scale = Vec3::one(); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.57) - * Quaternion::rotation_z(1.0); - next.main.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(10.0, 12.5, 13.2); + next.main.orientation = Quaternion::rotation_y(3.14); + + next.control.position = Vec3::new(-18.0, 1.0, -2.0); + next.control.orientation = Quaternion::rotation_x(-0.3 + u_slow * 0.1) + * Quaternion::rotation_y(0.15) + * Quaternion::rotation_z(u_slowalt * 0.08); + next.control.scale = Vec3::one(); }, _ => {}, } diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 7c2cf86334..3cc76803ca 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2338,6 +2338,7 @@ impl FigureMgr { StageSection::Recover => { stage_time / s.static_data.recover_duration.as_secs_f64() }, + _ => 0.0, }; anim::biped_large::DashAnimation::update_skeleton( &target_base, @@ -2417,6 +2418,42 @@ impl FigureMgr { ), } }, + CharacterState::SpinMelee(s) => { + let stage_progress = match active_tool_kind { + Some(ToolKind::Sword(_)) => { + let stage_time = s.timer.as_secs_f64(); + match s.stage_section { + StageSection::Buildup => { + stage_time + / s.static_data.buildup_duration.as_secs_f64() + }, + StageSection::Swing => { + stage_time / s.static_data.swing_duration.as_secs_f64() + }, + StageSection::Recover => { + stage_time + / s.static_data.recover_duration.as_secs_f64() + }, + _ => 0.0, + } + }, + _ => state.state_time, + }; + + anim::biped_large::SpinMeleeAnimation::update_skeleton( + &target_base, + ( + active_tool_kind, + second_tool_kind, + vel.0, + time, + Some(s.stage_section), + ), + stage_progress, + &mut state_animation_rate, + skeleton_attr, + ) + }, // TODO! _ => target_base, };