diff --git a/voxygen/src/anim/src/biped_large/alpha.rs b/voxygen/src/anim/src/biped_large/alpha.rs index eadcb440cd..fc349d2667 100644 --- a/voxygen/src/anim/src/biped_large/alpha.rs +++ b/voxygen/src/anim/src/biped_large/alpha.rs @@ -24,7 +24,7 @@ impl Animation for AlphaAnimation { #[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, + (active_tool_kind, _second_tool_kind, velocity, global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -35,157 +35,149 @@ impl Animation for AlphaAnimation { let lab = 1.0; 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), }; + 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 * 2.0 * velocity).sin()); let slowersmooth = (anim_time as f32 * lab as f32 * 4.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 * lab as f32 * 9.0).sin()); - - let slower = (((1.0) - / (0.05 - + 0.95 - * ((anim_time as f32 * lab as f32 * 8.0 - 0.5 * PI).sin()).powf(2.0 as f32))) + 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 * lab as f32 * 8.0 - 0.5 * PI).sin()) - + 1.0; - let twist = (anim_time as f32 * lab as f32 * 4.0).sin() + 0.5; - - let random = ((((2.0 - * (((global_time as f32 - anim_time as f32) * 10.0) - - (((global_time as f32 - anim_time as f32) * 10.0).round()))) - .abs()) - * 10.0) - .round()) - / 10.0; - - let switch = if random > 0.5 { 1.0 } else { -1.0 }; - - next.hand_l.scale = Vec3::one() * 1.04; - next.hand_r.scale = Vec3::one() * 1.04; - next.torso.scale = Vec3::one() / 8.0; + * ((anim_time as f32 * lab as f32 * 8.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()); + next.torso.position = Vec3::new(0.0, 0.0, 0.1); + next.torso.orientation = Quaternion::rotation_z(0.0); match active_tool_kind { Some(ToolKind::Sword(_)) => { - next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5); - next.hand_l.orientation = - Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); - 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.main.position = Vec3::new(0.0, 5.0, -6.0); - next.main.orientation = Quaternion::rotation_x(-0.1); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + 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( - -7.0, - 7.0 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0, - 2.0 + movement1 * 1.0, + s_a.sc.0, + s_a.sc.1 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0, + s_a.sc.2 + movement1 * 1.0, ); - next.control.orientation = Quaternion::rotation_x(movement1 * -0.5) - * Quaternion::rotation_y(movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0) - * Quaternion::rotation_z(movement1 * -1.2 + movement2 * 1.3); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + movement1 * -0.5) + * Quaternion::rotation_y( + s_a.sc.4 + movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0, + ) + * Quaternion::rotation_z(s_a.sc.5 + movement1 * -1.2 + movement2 * 1.3); next.upper_torso.orientation = Quaternion::rotation_z( movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5, ); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.position = Vec3::new(0.0 + movement2 * 2.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_z( movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5, ); }, + Some(ToolKind::Axe(_)) => { + next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.2); + + 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.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); + next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); + next.main.position = Vec3::new(-0.0, -2.0, -1.0); + next.main.orientation = Quaternion::rotation_x(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); + }, Some(ToolKind::Hammer(_)) => { - next.hand_l.position = - Vec3::new(-s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0); + next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0); next.hand_l.orientation = - Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - - next.hand_r.position = - Vec3::new(s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0); - next.hand_r.orientation = - Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - + Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0); + 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); next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.0); + next.main.orientation = + Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_z(slower * 0.03) - * Quaternion::rotation_x(-0.3 + slowersmooth * 0.1) + * 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.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); next.upper_torso.orientation = Quaternion::rotation_z(slower * 0.18 + slowersmooth * 0.15) - * Quaternion::rotation_x(slower * 0.05 + slowersmooth * 0.05); + * 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, s_a.lower_torso.0, s_a.lower_torso.1); 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.control.position = Vec3::new(-8.0, 7.0 + slower * 4.0, 1.0 + slower * -9.0); - next.control.orientation = - Quaternion::rotation_x(-1.5 + slower * -1.2) * Quaternion::rotation_z(1.5); - }, - Some(ToolKind::NpcWeapon(_)) => { - if switch > 0.0 { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0)) - * Quaternion::rotation_x(-0.2); + if velocity > 0.5 { + next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_x(foot * -0.4) + * Quaternion::rotation_z((slower * 0.3).max(0.0)); - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); - next.upper_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0)); - - next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); - next.lower_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0)); - - next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_r.orientation = Quaternion::rotation_z(-1.5); - - next.arm_control_r.position = Vec3::new(0.0, 0.0, -4.0); - next.arm_control_r.orientation = - Quaternion::rotation_x(1.0) * Quaternion::rotation_y(slow * -1.35); - - next.tail.orientation = Quaternion::rotation_z(twist * 0.5); + next.foot_r.position = Vec3::new(s_a.foot.0, foot * 6.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(foot * 0.4) + * Quaternion::rotation_z((slower * 0.3).max(0.0)); + next.torso.orientation = Quaternion::rotation_x(-0.15); } else { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0)) - * Quaternion::rotation_x(-0.2); + next.foot_l.position = + Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + (slower * 2.5).max(0.0)); + next.foot_l.orientation = Quaternion::rotation_x(slower * -0.2 - 0.2) + * Quaternion::rotation_z((slower * 1.0).max(0.0)); - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); - next.upper_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0)) - * Quaternion::rotation_x(0.0); + next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - slower * 2.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1) + * Quaternion::rotation_z((slower * 0.5).max(0.0)); + } - next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); - next.lower_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0)) - * Quaternion::rotation_x(0.0); - - next.arm_control_l.position = Vec3::new(0.0, 0.0, -4.0); - next.arm_control_l.orientation = - Quaternion::rotation_x(1.0) * Quaternion::rotation_y(slow * 1.35); - - next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_l.orientation = Quaternion::rotation_z(1.5); - - next.tail.orientation = Quaternion::rotation_z(twist * -0.5); - }; + 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); + }, + Some(ToolKind::Debug(_)) => { + next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0); + next.hand_l.orientation = Quaternion::rotation_x(1.27); + next.main.position = Vec3::new(-5.0, 5.0, 23.0); + next.main.orientation = Quaternion::rotation_x(PI); }, _ => {}, } - next } } diff --git a/voxygen/src/anim/src/biped_large/beam.rs b/voxygen/src/anim/src/biped_large/beam.rs index 3286e4c15e..53b0cc9dc2 100644 --- a/voxygen/src/anim/src/biped_large/beam.rs +++ b/voxygen/src/anim/src/biped_large/beam.rs @@ -43,11 +43,13 @@ impl Animation for BeamAnimation { next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); next.hand_r.position = Vec3::new(0.0, 0.0, 2.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.main.position = Vec3::new(0.0, 8.0, 13.2); + next.main.position = Vec3::new(0.0, 0.0, 13.2); next.main.orientation = Quaternion::rotation_y(PI); next.control.position = Vec3::new(-4.0, 7.0, 4.0); - next.control.orientation = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.15); + next.control.orientation = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.15) + * Quaternion::rotation_z(0.0); match active_tool_kind { Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { @@ -110,6 +112,7 @@ impl Animation for BeamAnimation { }, _ => {}, } + next } } diff --git a/voxygen/src/anim/src/biped_large/beta.rs b/voxygen/src/anim/src/biped_large/beta.rs index fb9e219e15..af1850e773 100644 --- a/voxygen/src/anim/src/biped_large/beta.rs +++ b/voxygen/src/anim/src/biped_large/beta.rs @@ -31,57 +31,48 @@ impl Animation for BetaAnimation { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + 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), }; match active_tool_kind { Some(ToolKind::Sword(_)) => { - next.hand_l.position = Vec3::new(-4.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.04; - next.main.position = Vec3::new(0.0, 5.0, -6.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); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + 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( - -8.0 + movement1 * -5.0 - + (movement2 as f32 * 2.5).sin() * 30.0 - + movement3 * -5.0, - 1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0, - 2.0 - (movement1 as f32 * 8.0).sin() * 0.4, + s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3), + s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3), + s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)), ); - next.control.orientation = Quaternion::rotation_x(-1.57) - * Quaternion::rotation_y( - 0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5, - ) - * Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0); - next.upper_torso.orientation = Quaternion::rotation_y(-0.1) + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3)) + * Quaternion::rotation_y( + s_a.sc.4 + + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), + ) + * Quaternion::rotation_z( + s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3), + ); + next.upper_torso.orientation = Quaternion::rotation_x(0.15) + * Quaternion::rotation_y((-0.1) * (1.0 - movement3)) * Quaternion::rotation_z( - 0.4 + movement1 * 1.5 - + (movement2 as f32 * 2.5).sin() * -0.5 - + movement3 * 1.0, - ); - next.head.orientation = Quaternion::rotation_y(0.1) - * Quaternion::rotation_z( - -0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5, + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), ); + next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3)); }, _ => {}, } - next.hold.scale = Vec3::one() * 0.0; - next } } diff --git a/voxygen/src/anim/src/biped_large/charge.rs b/voxygen/src/anim/src/biped_large/charge.rs index 202745a5ad..3e9529f954 100644 --- a/voxygen/src/anim/src/biped_large/charge.rs +++ b/voxygen/src/anim/src/biped_large/charge.rs @@ -31,72 +31,24 @@ impl Animation for ChargeAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 0.55; - let breathe = (anim_time as f32 + 1.5 * PI).sin(); - let test = (anim_time as f32 + 36.0 * PI).sin(); + let lab = 1.0; - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); - - let tailmove = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, - ); - - 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))) - .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))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - - let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).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))) - .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))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - - let quick = (((5.0) - / (3.5 + 1.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) + let foot = (((5.0) + / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) .sqrt()) * ((anim_time as f32 * lab as f32 * 8.0).sin()); - let quicka = (((5.0) - / (3.5 - + 1.5 - * ((anim_time as f32 * lab as f32 * 8.0 + PI / 2.0).sin()).powf(2.0 as f32))) + let foote = (((5.0) + / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0 + PI / 2.0).sin()); + * ((anim_time as f32 * lab as f32 * 8.0).sin()); let stress = (((5.0) / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 20.0).cos()).powf(2.0 as f32))) .sqrt()) * ((anim_time as f32 * lab as f32 * 20.0).cos()); - - let short = (anim_time as f32 * lab as f32 * 16.0).sin(); + let quick = (((5.0) + / (3.5 + 1.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 8.0).sin()); let stop = ((anim_time as f32).powf(0.3 as f32)).min(1.2); let stopa = ((anim_time as f32).powf(0.9 as f32)).min(5.0); @@ -114,10 +66,10 @@ impl Animation for ChargeAnimation { 0.0 } * 1.3; - next.head.position = Vec3::new(stop * -2.0, -3.5 + stop * 2.5 + s_a.head.0, s_a.head.1); + next.head.position = Vec3::new(stop * -2.0, -1.5 + stop * 2.5 + s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_z(stop * -1.0 + tilt * -2.0) * Quaternion::rotation_y(stop * -0.3); - next.head.scale = Vec3::one() * 1.02; + next.head.scale = Vec3::one(); next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); next.upper_torso.orientation = @@ -126,187 +78,84 @@ impl Animation for ChargeAnimation { next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); next.lower_torso.orientation = Quaternion::rotation_z(stop * -0.7 + tilt * 4.0); - if velocity < 0.5 { - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.leg_l.position = - Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.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(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.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(-s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_z(0.0); - - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_z(0.0); - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(test * 0.0); - next.torso.scale = Vec3::one() / 8.0; - - 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); - } else { - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.jaw.scale = Vec3::one() * 1.02; - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - 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.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98; - next.leg_l.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3); - next.leg_l.scale = Vec3::one() * 0.98; - - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98; - - next.leg_r.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3); - next.leg_r.scale = Vec3::one() * 0.98; - - next.foot_l.position = Vec3::new( - -s_a.foot.0, - 4.0 + s_a.foot.1 + foothoril * 8.5, - s_a.foot.2 + ((footvertl * 6.5).max(0.0)), - ); - next.foot_l.orientation = - Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0); - - next.foot_r.position = Vec3::new( - s_a.foot.0, - 4.0 + s_a.foot.1 + foothorir * 8.5, - s_a.foot.2 + ((footvertr * 6.5).max(0.0)), - ); - next.foot_r.orientation = - Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0); - } match active_tool_kind { - Some(ToolKind::Bow(_)) => { - 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.04; + Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); - 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.04; - - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1 + foothoril * -1.0, - s_a.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_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1 + foothorir * -1.0, - s_a.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.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); - next.jaw.orientation = Quaternion::rotation_x(stop * 0.05); - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0) - * Quaternion::rotation_x(-0.2 * stop); - - 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(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, -2.0); - next.control.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(stop * -0.4) - * Quaternion::rotation_z(stop * -0.6); - }, - Some(ToolKind::Staff(_)) => { - 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.04; - - next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); next.hand_r.orientation = - Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.hand_r.scale = Vec3::one() * 1.04; + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1 + foothoril * -1.0, - s_a.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_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1 + foothorir * -1.0, - s_a.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.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0) - * Quaternion::rotation_x(-0.2 * stop); - - next.main.position = Vec3::new(8.0, 8.5, 13.2); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(PI) - * Quaternion::rotation_z(0.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); next.control.position = Vec3::new( - -7.0 + quick * 3.5 * (1.0 / (stopa + 0.1)), - 6.0 + quicka * 3.5 * (1.0 / (stopa + 0.1)), - 6.0 - stop * 3.0, + s_a.stc.0 + quick * 3.5 * (1.0 / (stopa + 0.1)), + s_a.stc.1, + s_a.stc.2 - stop * 3.0, ); - next.control.orientation = - Quaternion::rotation_x(stop * -0.2) * Quaternion::rotation_z(stop * 0.2); + next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + stop * -0.2) + * Quaternion::rotation_y(s_a.stc.4) + * Quaternion::rotation_z(s_a.stc.5 + stop * 0.2); + }, + Some(ToolKind::Bow(_)) => { + 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, s_a.bhl.1, s_a.bhl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); + 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.hold.position = Vec3::new(0.0, -1.0, -15.2); + next.hold.orientation = Quaternion::rotation_x(-1.57); + next.hold.scale = Vec3::one() * 1.0; + + next.control.position = Vec3::new( + 3.0 + s_a.bc.0 + stop * 13.0, + -5.0 + s_a.bc.1 + stop * 4.0, + 6.0 + s_a.bc.2, + ); + next.control.orientation = Quaternion::rotation_x(0.2 + s_a.bc.3) + * Quaternion::rotation_y(-0.8 + s_a.bc.4 + stop * -0.4) + * Quaternion::rotation_z(s_a.bc.5 + stop * -0.6); }, _ => {}, } + if velocity > 0.2 { + next.foot_l.position = Vec3::new( + -s_a.foot.0 - foot * 1.5, + s_a.foot.1 + foote * 2.0, + s_a.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(foote * -0.1) + * Quaternion::rotation_z(0.4) + * Quaternion::rotation_y(0.15); + + next.foot_r.position = Vec3::new( + s_a.foot.0 + foot * 1.5, + s_a.foot.1 + foote * -1.5, + s_a.foot.2, + ); + next.foot_r.orientation = Quaternion::rotation_z(0.4); + } else { + next.foot_l.position = Vec3::new( + -s_a.foot.0, + -2.5 + stop * -1.3, + s_a.foot.2 + tilt * -4.0 * foot, + ); + next.foot_l.orientation = + Quaternion::rotation_x(stop * -0.2 - 0.2 + stop * stress * 0.02) + * Quaternion::rotation_z(stop * 0.1) + * Quaternion::rotation_y(stop * 0.08); + + next.foot_r.position = + Vec3::new(s_a.foot.0, 3.5 + stop * 1.5, s_a.foot.2 + tilt * 4.0 * foot); + next.foot_r.orientation = + Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1); + } + next } } diff --git a/voxygen/src/anim/src/biped_large/equip.rs b/voxygen/src/anim/src/biped_large/equip.rs index 328dc1e40e..73dfac08a1 100644 --- a/voxygen/src/anim/src/biped_large/equip.rs +++ b/voxygen/src/anim/src/biped_large/equip.rs @@ -42,8 +42,8 @@ impl Animation for EquipAnimation { next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0); }, Some(ToolKind::Hammer(_)) => { - next.hand_l.position = Vec3::new(-5.0, -5.0, 13.0); - next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0); + next.hand_l.position = Vec3::new(-5.0 - 10.0, -5.0, 13.0 - 10.0); + next.hand_r.position = Vec3::new(-3.0 - 10.0, -4.5, 10.0 - 10.0); }, Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { next.hand_l.position = Vec3::new(-3.0, -5.0, 8.0); diff --git a/voxygen/src/anim/src/biped_large/idle.rs b/voxygen/src/anim/src/biped_large/idle.rs index 88a2a2c80e..4a9412707c 100644 --- a/voxygen/src/anim/src/biped_large/idle.rs +++ b/voxygen/src/anim/src/biped_large/idle.rs @@ -2,12 +2,13 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; +use common::comp::item::ToolKind; use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = (Option, Option, f64); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +17,7 @@ impl Animation for IdleAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_idle")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - global_time: Self::Dependency, + (active_tool_kind, _second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, @@ -88,9 +89,28 @@ impl Animation for IdleAnimation { next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2) * Quaternion::rotation_x(0.0); - next.main.position = Vec3::new(-5.0, -7.0, 7.0); - next.main.orientation = - Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Bow(_)) => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { + next.main.position = Vec3::new(-6.0, -5.0, -12.0); + next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Sword(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Hammer(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + _ => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + } next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); next.shoulder_l.orientation = Quaternion::rotation_x(breathe); diff --git a/voxygen/src/anim/src/biped_large/jump.rs b/voxygen/src/anim/src/biped_large/jump.rs index 8d9618b9cd..f09aefa242 100644 --- a/voxygen/src/anim/src/biped_large/jump.rs +++ b/voxygen/src/anim/src/biped_large/jump.rs @@ -2,12 +2,13 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; +use common::comp::item::ToolKind; use std::f32::consts::PI; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = f64; + type Dependency = (Option, Option, f64); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +17,7 @@ impl Animation for JumpAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_jump")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - _global_time: Self::Dependency, + (active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, @@ -58,10 +59,28 @@ impl Animation for JumpAnimation { Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.second.scale = Vec3::one() * 0.0; - next.main.position = Vec3::new(-5.0, -7.0, 7.0); - next.main.orientation = - Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); - next.main.scale = Vec3::one() * 1.02; + match active_tool_kind { + Some(ToolKind::Bow(_)) => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { + next.main.position = Vec3::new(-6.0, -5.0, -12.0); + next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Sword(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Hammer(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + _ => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + } next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.5); diff --git a/voxygen/src/anim/src/biped_large/leapmelee.rs b/voxygen/src/anim/src/biped_large/leapmelee.rs index 36b3a0b90e..642c124a66 100644 --- a/voxygen/src/anim/src/biped_large/leapmelee.rs +++ b/voxygen/src/anim/src/biped_large/leapmelee.rs @@ -46,7 +46,7 @@ impl Animation for LeapAnimation { next.hand_r.position = Vec3::new(2.0, 0.0, 0.0); next.hand_r.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0); next.hand_r.scale = Vec3::one() * 1.04; - next.main.position = Vec3::new(0.0, 0.0, 12.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); @@ -110,7 +110,8 @@ impl Animation for LeapAnimation { next.torso.orientation = Quaternion::rotation_x( -0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI, - ); + ) * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); next.head.orientation = Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2); @@ -135,7 +136,6 @@ impl Animation for LeapAnimation { Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1); next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 - 8.0); - next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0); } next diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index 0ec30dc067..034eaa00e0 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -294,17 +294,17 @@ impl<'a> From<&'a Body> for SkeletonAttr { }, shl: match (body.species, body.body_type) { (Dullahan, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), - (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (Mightysaurok, _) => (-1.75, -9.0, 3.5, 1.47, -0.2, 0.0), (_, _) => (-4.75, -1.0, 2.5, 1.47, -0.2, 0.0), }, shr: match (body.species, body.body_type) { (Dullahan, _) => (5.75, -11.5, 4.5, 1.47, 0.3, 0.0), - (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (Mightysaurok, _) => (2.75, -9.5, -0.5, 1.47, 0.3, 0.0), (_, _) => (3.75, -1.5, -0.5, 1.47, 0.3, 0.0), }, sc: match (body.species, body.body_type) { (Dullahan, _) => (-7.0, 17.0, -16.0, -0.1, 0.0, 0.0), - (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (Mightysaurok, _) => (-7.0, 15.0, -11.0, -0.1, 0.0, 0.0), (_, _) => (-7.0, 7.0, -10.0, -0.1, 0.0, 0.0), }, hhl: match (body.species, body.body_type) { @@ -326,18 +326,18 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0), }, sthl: match (body.species, body.body_type) { - (Ogre, Female) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), - (Occultsaurok, _) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), + (Ogre, Female) => (-1.0, -5.0, 12.0, 1.27, 0.0, 0.0), + (Occultsaurok, _) => (-1.0, -7.0, 12.0, 1.27, 0.0, 0.0), (_, _) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), }, sthr: match (body.species, body.body_type) { - (Ogre, Female) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), - (Occultsaurok, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), + (Ogre, Female) => (5.0, -3.5, 18.0, 1.57, 0.8, 0.0), + (Occultsaurok, _) => (7.0, -3.5, 18.0, 1.57, 0.8, 0.0), (_, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), }, stc: match (body.species, body.body_type) { (Ogre, Female) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), - (Occultsaurok, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), + (Occultsaurok, _) => (-10.0, 7.0, -22.0, -0.3, 0.15, 0.0), (_, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), }, ahl: match (body.species, body.body_type) { @@ -350,15 +350,15 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 3.14), }, bhl: match (body.species, body.body_type) { - (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (Slysaurok, _) => (-1.0, -12.0, 1.0, 1.57, 0.0, 0.0), (_, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), }, bhr: match (body.species, body.body_type) { - (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (Slysaurok, _) => (0.0, -6.0, -2.0, 1.57, 0.0, 0.0), (_, _) => (5.9, 5.5, -5.0, 1.2, -0.6, -0.3), }, bc: match (body.species, body.body_type) { - (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (Slysaurok, _) => (1.0, 13.0, -8.0, 0.0, 1.2, -0.6), (_, _) => (-7.0, 3.0, -8.0, 0.0, 0.0, 0.0), }, beast: matches!((body.species, body.body_type), (Werewolf, _)), diff --git a/voxygen/src/anim/src/biped_large/run.rs b/voxygen/src/anim/src/biped_large/run.rs index 15997db26d..4b680785e4 100644 --- a/voxygen/src/anim/src/biped_large/run.rs +++ b/voxygen/src/anim/src/biped_large/run.rs @@ -2,12 +2,21 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; +use common::comp::item::ToolKind; use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3); + type Dependency = ( + Option, + Option, + f32, + Vec3, + Vec3, + f64, + Vec3, + ); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +25,15 @@ impl Animation for RunAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_run")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency, + ( + active_tool_kind, + _second_tool_kind, + velocity, + orientation, + last_ori, + global_time, + avg_vel, + ): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -279,10 +296,33 @@ impl Animation for RunAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); - next.main.position = Vec3::new(-5.0, -7.0, 7.0); - next.main.orientation = Quaternion::rotation_x(PI) - * Quaternion::rotation_y(0.6) - * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Bow(_)) => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { + next.main.position = Vec3::new(-6.0, -5.0, -12.0); + next.main.orientation = + Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Sword(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + Some(ToolKind::Hammer(_)) => { + next.main.position = Vec3::new(-10.0, -8.0, 12.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + _ => { + next.main.position = Vec3::new(-2.0, -5.0, -6.0); + next.main.orientation = + Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57); + }, + } next.shoulder_l.position = Vec3::new( -s_a.shoulder.0, diff --git a/voxygen/src/anim/src/biped_large/shockwave.rs b/voxygen/src/anim/src/biped_large/shockwave.rs index 4004109a54..2c0f57eda6 100644 --- a/voxygen/src/anim/src/biped_large/shockwave.rs +++ b/voxygen/src/anim/src/biped_large/shockwave.rs @@ -39,36 +39,33 @@ impl Animation for ShockwaveAnimation { _ => (0.0, 0.0, 0.0), }; - let movement = (anim_time as f32 * 1.0).min(1.0); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.hand_l.position = Vec3::new(0.0, 0.0, -4.0); - next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - next.hand_l.scale = Vec3::one() * 1.04; - next.hand_r.position = Vec3::new(0.0, 0.0, 2.0); - next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.hand_r.scale = Vec3::one() * 1.04; - next.main.position = Vec3::new(0.0, 8.0, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); - next.control.position = Vec3::new(-4.0, 7.0, 4.0); - next.control.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.15) - * Quaternion::rotation_z(0.0); - let twist = movement * 0.8; + next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4); + + let twist = movement1 * 0.8; next.control.position = Vec3::new( - -4.0 + movement1 * 5.0 + movement3 * -5.0, - 7.0 + movement1 * 3.0 + movement3 * -3.0, - 4.0 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0, + s_a.stc.0 + movement1 * 5.0 + movement3 * -5.0, + s_a.stc.1 + movement1 * 3.0 + movement3 * -3.0, + s_a.stc.2 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0, ); - next.control.orientation = - Quaternion::rotation_x(-0.3 + movement1 * 0.8 + movement2 * 0.3 + movement3 * -1.1) - * Quaternion::rotation_y( - 0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45, - ) - * Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8); + next.control.orientation = Quaternion::rotation_x( + s_a.stc.3 + movement1 * 0.8 + movement2 * 0.3 + movement3 * -1.1, + ) * Quaternion::rotation_y( + s_a.stc.4 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45, + ) * Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8); next.head.orientation = Quaternion::rotation_x(movement1 * 0.4 + movement3 * -0.4) * Quaternion::rotation_z(twist * 0.2 + movement2 * -0.8 + movement3 * 0.6); diff --git a/voxygen/src/anim/src/biped_large/shoot.rs b/voxygen/src/anim/src/biped_large/shoot.rs index f5f7907b49..ebc71e6f28 100644 --- a/voxygen/src/anim/src/biped_large/shoot.rs +++ b/voxygen/src/anim/src/biped_large/shoot.rs @@ -15,265 +15,378 @@ impl Animation for ShootAnimation { const UPDATE_FN: &'static [u8] = b"biped_large_shoot\0"; #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_shoot")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency, - anim_time: f64, - _rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); + /* fn update_skeleton_inner( + skeleton: &Self::Skeleton, + (active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency, + anim_time: f64, + _rate: &mut f32, + s_a: &SkeletonAttr, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); - let lab = 0.55; - let breathe = (anim_time as f32 + 1.5 * PI).sin(); - let test = (anim_time as f32 + 36.0 * PI).sin(); + let lab = 0.55; + let breathe = (anim_time as f32 + 1.5 * PI).sin(); + let test = (anim_time as f32 + 36.0 * PI).sin(); - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); + let slower = (anim_time as f32 * 1.0 + PI).sin(); + let slow = (anim_time as f32 * 3.5 + PI).sin(); - let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); + let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); - let tailmove = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, - ); - - let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, - ); - - 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))) - .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))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - - let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).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))) - .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))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - - let short = (anim_time as f32 * lab as f32 * 16.0).sin(); - let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); - - if velocity < 0.5 { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02; - next.head.orientation = - Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6); - - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5); - next.upper_torso.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * 0.15); - next.lower_torso.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.leg_l.position = - Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; - next.leg_l.orientation = Quaternion::rotation_z(0.0); - - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; - next.leg_r.orientation = Quaternion::rotation_z(0.0); - - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_z(0.0); - - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_z(0.0); - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(test * 0.0); - - 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); - } else { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = - Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05); - - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5); - next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18); - - next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); - next.lower_torso.orientation = - Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1 + foothoril * -1.0, - s_a.shoulder.2, + let tailmove = Vec2::new( + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(7331.0) + .sin() + * 0.25, + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(1337.0) + .sin() + * 0.125, ); - 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_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1 + foothorir * -1.0, - s_a.shoulder.2, + let look = Vec2::new( + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(7331.0) + .sin() + * 0.5, + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(1337.0) + .sin() + * 0.25, ); - next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) - * Quaternion::rotation_y(-0.1) - * Quaternion::rotation_z(footrotr * -0.1); - 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); + 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))) + .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))) + .sqrt()) + * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - next.leg_l.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3); + let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); + let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin(); - next.leg_r.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3); + 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))) + .sqrt()) + * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); - next.foot_l.position = Vec3::new( - -s_a.foot.0, - 4.0 + s_a.foot.1 + foothoril * 8.5, - s_a.foot.2 + ((footvertl * 6.5).max(0.0)), - ); - next.foot_l.orientation = Quaternion::rotation_x(-0.5 + footrotl * 0.85); + 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))) + .sqrt()) + * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()); - next.foot_r.position = Vec3::new( - s_a.foot.0, - 4.0 + s_a.foot.1 + foothorir * 8.5, - s_a.foot.2 + ((footvertr * 6.5).max(0.0)), - ); - next.foot_r.orientation = Quaternion::rotation_x(-0.5 + footrotr * 0.85); - } - match active_tool_kind { - Some(ToolKind::Bow(_)) => { - next.hand_l.position = - 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); + let short = (anim_time as f32 * lab as f32 * 16.0).sin(); + let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); - 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); + if velocity < 0.5 { + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02; + next.head.orientation = + Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6); + + next.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5); + next.upper_torso.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + + next.lower_torso.position = + Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * 0.15); + next.lower_torso.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + + next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); + next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); + + next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); + next.tail.orientation = + Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); + + next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + + next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + + next.leg_l.position = + Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; + next.leg_l.orientation = Quaternion::rotation_z(0.0); + + next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; + next.leg_r.orientation = Quaternion::rotation_z(0.0); + + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_z(0.0); + + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_z(0.0); + + next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; + next.torso.orientation = Quaternion::rotation_z(test * 0.0); + + 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); + } else { + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; + next.head.orientation = + Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05); + + next.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5); + next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18); + + next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); + next.lower_torso.orientation = + Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14); + + next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); + next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); + + next.tail.orientation = + Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); next.shoulder_l.position = Vec3::new( -s_a.shoulder.0, s_a.shoulder.1 + foothoril * -1.0, s_a.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.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16) + * Quaternion::rotation_y(0.1) + * Quaternion::rotation_z(footrotl * 0.1); next.shoulder_r.position = Vec3::new( s_a.shoulder.0, s_a.shoulder.1 + foothorir * -1.0, s_a.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.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) + * Quaternion::rotation_y(-0.1) + * Quaternion::rotation_z(footrotr * -0.1); - next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); - next.jaw.orientation = Quaternion::rotation_x(-0.2); + 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.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.leg_l.orientation = + Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3); - next.control.position = Vec3::new(6.0, 6.0, 8.0); - next.control.orientation = Quaternion::rotation_x(exp * 0.4); - }, - Some(ToolKind::Staff(_)) => { - 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.leg_r.orientation = + Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3); - next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); + next.foot_l.position = Vec3::new( + -s_a.foot.0, + 4.0 + s_a.foot.1 + foothoril * 8.5, + s_a.foot.2 + ((footvertl * 6.5).max(0.0)), + ); + next.foot_l.orientation = Quaternion::rotation_x(-0.5 + footrotl * 0.85); + + next.foot_r.position = Vec3::new( + s_a.foot.0, + 4.0 + s_a.foot.1 + foothorir * 8.5, + s_a.foot.2 + ((footvertr * 6.5).max(0.0)), + ); + next.foot_r.orientation = Quaternion::rotation_x(-0.5 + footrotr * 0.85); + } + match active_tool_kind { + Some(ToolKind::Bow(_)) => { + next.hand_l.position = + 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_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.shoulder_l.position = Vec3::new( + -s_a.shoulder.0, + s_a.shoulder.1 + foothoril * -1.0, + s_a.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_r.position = Vec3::new( + s_a.shoulder.0, + s_a.shoulder.1 + foothorir * -1.0, + s_a.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.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.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(6.0, 6.0, 8.0); + next.control.orientation = Quaternion::rotation_x(exp * 0.4); + }, + Some(ToolKind::Staff(_)) => { + 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_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.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); + + next.shoulder_l.position = + Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_l.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(2.0); + + next.shoulder_r.position = + Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_r.orientation = + Quaternion::rotation_z(0.4) * Quaternion::rotation_x(2.0); + + next.jaw.orientation = Quaternion::rotation_x(-0.2); + + next.main.position = Vec3::new(10.0, 12.5, 13.2); + next.main.orientation = Quaternion::rotation_y(PI); + + next.control.position = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0); + next.control.orientation = + Quaternion::rotation_x(exp * 1.3) * Quaternion::rotation_z(exp * 1.5); + }, + _ => {}, + } + + next + } + } + */ + fn update_skeleton_inner( + skeleton: &Self::Skeleton, + (active_tool_kind, _second_tool_kind, velocity, _global_time): Self::Dependency, + anim_time: f64, + rate: &mut f32, + s_a: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + + let mut next = (*skeleton).clone(); + + let lab = 1.0; + let foot = (((5.0) + / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 8.0).sin()); + let foote = (((5.0) + / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 8.0).sin()); + + 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.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0 - exp * 1.5, s_a.upper_torso.1); + next.upper_torso.orientation = Quaternion::rotation_z(0.4 + exp * 1.0) + * Quaternion::rotation_x(0.0 + exp * 0.2) + * Quaternion::rotation_y(exp * -0.08); + + next.lower_torso.position = + Vec3::new(0.0, s_a.lower_torso.0 + exp * 1.0, s_a.lower_torso.1); + next.lower_torso.orientation = next.upper_torso.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); + next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); + + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); next.hand_r.orientation = - Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); - next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); - next.shoulder_l.position = - Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(2.0); + next.control.position = Vec3::new( + s_a.stc.0, + s_a.stc.1 + exp * 5.0, + 10.0 + s_a.stc.2 - exp * 5.0, + ); + next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + exp * 0.4) + * 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); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.shoulder_r.position = - Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = - Quaternion::rotation_z(0.4) * Quaternion::rotation_x(2.0); - - next.jaw.orientation = Quaternion::rotation_x(-0.2); - - next.main.position = Vec3::new(10.0, 12.5, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); - - next.control.position = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0); - next.control.orientation = - Quaternion::rotation_x(exp * 1.3) * Quaternion::rotation_z(exp * 1.5); + 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); }, _ => {}, } + 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 } diff --git a/voxygen/src/anim/src/biped_large/spin.rs b/voxygen/src/anim/src/biped_large/spin.rs index b3b0b99dbf..aa191272c3 100644 --- a/voxygen/src/anim/src/biped_large/spin.rs +++ b/voxygen/src/anim/src/biped_large/spin.rs @@ -33,9 +33,9 @@ impl Animation for SpinAnimation { let lab = 1.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), + 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), + Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), _ => (0.0, 0.0, 0.0), }; @@ -49,44 +49,35 @@ impl Animation for SpinAnimation { let spin = (anim_time as f32 * 2.8 * lab as f32).sin(); let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin(); - fn slow(x: f32) -> f32 { (x * 8.0).sin() } - - let stab = (anim_time as f32 * 8.0).sin(); - let rotate = (anim_time as f32 * 1.0).sin(); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); if let Some(ToolKind::Sword(_)) = active_tool_kind { - next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5); - next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); - 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.main.position = Vec3::new(0.0, 5.0, -6.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); + + 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( - 5.0 + movement1 * 2.0 + movement2 * -8.0 + movement3 * -7.0, - 11.0 + slow(movement1) * 0.6 - + slow(movement2) * 3.0 - + slow(movement3) * -0.8 - + movement3 * -10.0, - 2.0 + slow(movement1) * 0.6 - + slow(movement2) * 3.5 - + movement2 * 3.0 - + slow(movement3) * -0.4 - + movement3 * -4.0, + 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( - movement1 * -1.57 + movement2 * -0.6 + slow(movement2) * -0.25, - ) * Quaternion::rotation_y( - -0.57 + movement1 * 2.0 + movement2 * -2.0, - ) * Quaternion::rotation_z(movement1 + movement2); + 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.head.orientation = Quaternion::rotation_z(slow(movement2) * -0.8); - - next.upper_torso.orientation = Quaternion::rotation_x(slow(movement2) * 0.15) + next.upper_torso.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, @@ -98,7 +89,7 @@ impl Animation for SpinAnimation { 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).sin() * 7.2); + next.torso.orientation = Quaternion::rotation_z(movement2 * 6.28); } if let Some(ToolKind::Axe(_) | ToolKind::Hammer(_) | ToolKind::Dagger(_)) = active_tool_kind @@ -108,21 +99,24 @@ impl Animation for SpinAnimation { 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); + 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, s_a.head.0 + spin * -0.8, s_a.head.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.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); next.upper_torso.orientation = Quaternion::rotation_z(spin * 0.1) - * Quaternion::rotation_x(spin * 0.1) + * Quaternion::rotation_x(0.0 + spin * 0.1) * Quaternion::rotation_y(decel * -0.2); + next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0); 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); @@ -130,11 +124,8 @@ impl Animation for SpinAnimation { 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.shoulder_l.orientation = Quaternion::rotation_x(0.0); - - next.shoulder_r.orientation = Quaternion::rotation_x(0.0); } + next } } diff --git a/voxygen/src/anim/src/biped_large/spinmelee.rs b/voxygen/src/anim/src/biped_large/spinmelee.rs index 2e6ef7e92e..f90659c589 100644 --- a/voxygen/src/anim/src/biped_large/spinmelee.rs +++ b/voxygen/src/anim/src/biped_large/spinmelee.rs @@ -63,20 +63,20 @@ impl Animation for SpinMeleeAnimation { 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_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.main.position = Vec3::new(3.0, 6.0, -5.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); - next.control.position = Vec3::new(-7.0, 7.0, 2.0); - next.control.orientation = Quaternion::rotation_x(-PI / 2.0 + movement3 * PI / 2.0) - * Quaternion::rotation_z(-PI / 2.0 + movement3 * PI / 2.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.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3 - PI / 2.0 + movement3 * PI / 2.0) + * Quaternion::rotation_z(s_a.sc.5 - PI / 2.0 + movement3 * PI / 2.0); next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0); next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); @@ -98,25 +98,30 @@ impl Animation for SpinMeleeAnimation { next.control.orientation = Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4); - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(0.08); next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0 - 3.0, s_a.upper_torso.1 - 2.0); - next.upper_torso.orientation = - Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.3); + next.upper_torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(-0.1) + * Quaternion::rotation_y(0.3); next.lower_torso.position = Vec3::new(0.0, 3.0, -2.5); - next.lower_torso.orientation = Quaternion::rotation_x(0.7); + next.lower_torso.orientation = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.7) + * Quaternion::rotation_y(0.0); 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); + ); + next.torso.orientation = Quaternion::rotation_z(spin * -16.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); if velocity.z.abs() > 0.1 { next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0); - next.foot_l.orientation = Quaternion::rotation_x(1.0); + next.foot_l.orientation = + Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0); next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0); next.foot_r.orientation = Quaternion::rotation_x(1.0); @@ -137,6 +142,7 @@ impl Animation for SpinMeleeAnimation { }, _ => {}, } + next } } diff --git a/voxygen/src/anim/src/biped_large/wield.rs b/voxygen/src/anim/src/biped_large/wield.rs index ee14062552..626fcf4037 100644 --- a/voxygen/src/anim/src/biped_large/wield.rs +++ b/voxygen/src/anim/src/biped_large/wield.rs @@ -130,6 +130,7 @@ impl Animation for WieldAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_y(0.0); + next.hold.scale = Vec3::one() * 0.0; if velocity > 0.5 { next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; @@ -233,15 +234,14 @@ impl Animation for WieldAnimation { next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_y(0.0); - 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.position = Vec3::new(0.0, -1.0, -15.2); + next.hold.orientation = Quaternion::rotation_x(-1.57); next.hold.scale = Vec3::one() * 1.0; next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2); - next.control.orientation = Quaternion::rotation_x(u_slow * 0.2) - * Quaternion::rotation_z(u_slowalt * 0.1); + next.control.orientation = Quaternion::rotation_x(u_slow * 0.06) + * Quaternion::rotation_y(s_a.bc.4) + * Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1); }, Some(ToolKind::Hammer(_)) => { next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 0442225b08..6d9ace7ea6 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2217,18 +2217,18 @@ impl FigureMgr { vel.0.magnitude_squared() > MOVING_THRESHOLD_SQR, // Moving physics.in_fluid.is_some(), // In water ) { - // Standing - (true, false, false) => anim::biped_large::IdleAnimation::update_skeleton( - &BipedLargeSkeleton::default(), - time, - state.state_time, - &mut state_animation_rate, - skeleton_attr, - ), // Running (true, true, false) => anim::biped_large::RunAnimation::update_skeleton( &BipedLargeSkeleton::default(), - (vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel), + ( + active_tool_kind.clone(), + second_tool_kind.clone(), + vel.0.magnitude(), + ori, + state.last_ori, + time, + state.avg_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -2236,14 +2236,14 @@ impl FigureMgr { // In air (false, _, false) => anim::biped_large::JumpAnimation::update_skeleton( &BipedLargeSkeleton::default(), - time, + (active_tool_kind.clone(), second_tool_kind.clone(), time), state.state_time, &mut state_animation_rate, skeleton_attr, ), _ => anim::biped_large::IdleAnimation::update_skeleton( &BipedLargeSkeleton::default(), - time, + (active_tool_kind.clone(), second_tool_kind.clone(), time), state.state_time, &mut state_animation_rate, skeleton_attr,