diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 4dcd584d2e..44b30970b6 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -161,7 +161,7 @@ impl Body { Body::QuadrupedSmall(_) => 0.4, Body::QuadrupedMedium(body) => match body.species { quadruped_medium::Species::Grolgar => 1.9, - quadruped_medium::Species::Tarasque => 2.2, + quadruped_medium::Species::Tarasque => 1.8, quadruped_medium::Species::Lion => 1.9, quadruped_medium::Species::Saber => 1.8, quadruped_medium::Species::Catoblepas => 1.7, @@ -179,7 +179,7 @@ impl Body { theropod::Species::Snowraptor => 0.5, theropod::Species::Sandraptor => 0.5, theropod::Species::Woodraptor => 0.5, - _ => 0.9, + _ => 1.8, }, Body::BirdMedium(_) => 0.35, Body::FishMedium(_) => 0.35, @@ -228,7 +228,12 @@ impl Body { quadruped_low::Species::Maneater => 4.0, _ => 1.3, }, - Body::Theropod(_) => 3.0, + Body::Theropod(body) => match body.species { + theropod::Species::Snowraptor => 2.5, + theropod::Species::Sandraptor => 2.5, + theropod::Species::Woodraptor => 2.5, + _ => 8.0, + }, Body::BirdMedium(body) => match body.species { bird_medium::Species::Cockatrice => 1.8, _ => 1.1, diff --git a/rust-toolchain b/rust-toolchain index ea448088e5..533416084a 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2020-12-09 +nightly-2020-12-09 \ No newline at end of file diff --git a/voxygen/anim/src/character/idle.rs b/voxygen/anim/src/character/idle.rs index 1c9546dc98..e4394dac97 100644 --- a/voxygen/anim/src/character/idle.rs +++ b/voxygen/anim/src/character/idle.rs @@ -3,7 +3,7 @@ use super::{ CharacterSkeleton, SkeletonAttr, }; use common::comp::item::{Hands, ToolKind}; -use std::f32::consts::PI; +use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; @@ -17,67 +17,78 @@ impl Animation for IdleAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_idle")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, second_tool_kind, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_ultra_slow = (anim_time as f32 * 1.0).sin(); - let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI / 2.0).sin(); - let head_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0; - - next.head.position = Vec3::new( - 0.0, - s_a.head.0, - s_a.head.1 + wave_ultra_slow * 0.1 + head_abs * -0.5, + let slow = (anim_time as f32 * 1.0).sin(); + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 12.0) + .floor() + .mul(7331.0) + .sin() + * 0.1, + ((global_time + anim_time) as f32 / 12.0) + .floor() + .mul(1337.0) + .sin() + * 0.05, ); + next.head.scale = Vec3::one() * s_a.head_scale; + next.chest.scale = Vec3::one() * 1.01; + next.hand_l.scale = Vec3::one() * 1.04; + next.hand_r.scale = Vec3::one() * 1.04; + next.back.scale = Vec3::one() * 1.02; + next.hold.scale = Vec3::one() * 0.0; + next.lantern.scale = Vec3::one() * 0.65; + next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; + next.shoulder_l.scale = Vec3::one() * 1.1; + next.shoulder_r.scale = Vec3::one() * 1.1; - next.head.scale = Vec3::one() * s_a.head_scale - head_abs * 0.05; + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.3); + next.head.orientation = + Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_ultra_slow * 0.1); - next.chest.scale = Vec3::one() + head_abs * 0.05; + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3); + next.chest.orientation = Quaternion::rotation_z(head_look.x * 0.6); - next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1 + wave_ultra_slow * 0.1); - next.belt.orientation = Quaternion::rotation_x(0.0); - next.belt.scale = Vec3::one() - head_abs * 0.05; - - next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1 + wave_ultra_slow * 0.1); - next.shorts.orientation = Quaternion::rotation_x(0.0); + next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1); + next.belt.orientation = Quaternion::rotation_z(head_look.x * -0.1); next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1); - next.back.scale = Vec3::one() * 1.02; + + next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); + next.shorts.orientation = Quaternion::rotation_z(head_look.x * -0.2); next.hand_l.position = Vec3::new( -s_a.hand.0, - s_a.hand.1 + wave_ultra_slow_cos * 0.15, - s_a.hand.2 + wave_ultra_slow * 0.5, + s_a.hand.1 + slow * 0.15, + s_a.hand.2 + slow * 0.5, ); - next.hand_l.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); + next.hand_l.orientation = Quaternion::rotation_x(slow * -0.06); next.hand_r.position = Vec3::new( s_a.hand.0, - s_a.hand.1 + wave_ultra_slow_cos * 0.15, - s_a.hand.2 + wave_ultra_slow * 0.5 + head_abs * -0.05, + s_a.hand.1 + slow * 0.15, + s_a.hand.2 + slow * 0.5, ); - next.hand_r.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); + next.hand_r.orientation = Quaternion::rotation_x(slow * -0.06); next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); 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(0.0); - next.shoulder_l.scale = (Vec3::one() + head_abs * -0.05) * 1.15; next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = Quaternion::rotation_x(0.0); - next.shoulder_r.scale = (Vec3::one() + head_abs * -0.05) * 1.15; + next.glider.position = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - + next.hold.position = Vec3::new(0.4, -0.3, -5.8); match active_tool_kind { Some(ToolKind::Dagger) => { next.main.position = Vec3::new(-4.0, -5.0, 7.0); @@ -123,11 +134,9 @@ impl Animation for IdleAnimation { next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2); next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); - next.lantern.scale = Vec3::one() * 0.65; - next.hold.scale = Vec3::one() * 0.0; - next.torso.position = Vec3::new(0.0, -0.2, 0.1) * s_a.scaler; - next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; + next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; + next.second.scale = match ( active_tool_kind.map(|tk| tk.hands()), second_tool_kind.map(|tk| tk.hands()), diff --git a/voxygen/anim/src/character/mod.rs b/voxygen/anim/src/character/mod.rs index 861566aab2..437a65b489 100644 --- a/voxygen/anim/src/character/mod.rs +++ b/voxygen/anim/src/character/mod.rs @@ -283,13 +283,13 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (6.0, 7.0, 1.0, -0.3, -1.57, 3.64), }, sthl: match (body.species, body.body_type) { - (_, _) => (0.0, 0.0, 1.0, 1.27, 0.0, 0.0), + (_, _) => (0.0, 0.0, 6.0, 1.97, 0.0, 0.0), }, sthr: match (body.species, body.body_type) { - (_, _) => (0.0, 0.0, 7.0, 1.57, 0.2, 0.0), + (_, _) => (0.0, 0.0, 0.0, 1.27, 0.2, 0.0), }, stc: match (body.species, body.body_type) { - (_, _) => (-5.0, 5.0, -1.0, -0.3, 0.15, 0.0), + (_, _) => (-5.0, 7.0, -2.0, -0.3, 0.15, 0.0), }, ahl: match (body.species, body.body_type) { (_, _) => (-0.5, -1.0, 7.0, 1.17, PI, 0.0), diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 6e02667f69..7920070ff3 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -15,6 +15,7 @@ type RunAnimationDependency = ( Vec3, f64, Vec3, + f32, ); impl Animation for RunAnimation { @@ -28,7 +29,16 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency, + ( + active_tool_kind, + second_tool_kind, + velocity, + orientation, + last_ori, + global_time, + avg_vel, + acc_vel, + ): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -38,48 +48,61 @@ impl Animation for RunAnimation { let speed = Vec2::::from(velocity).magnitude(); *rate = 1.0; let impact = (avg_vel.z).max(-8.0); + let speednorm = speed / 9.4; - let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 }; - let walk = if speed > 5.0 { 1.0 } else { 0.5 }; - let lower = if speed > 5.0 { 0.0 } else { 1.0 }; - let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 }; let lab = 1.0; - let foothoril = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.45).sin(); - let foothorir = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * (0.45)).sin(); - - let footvertl = (anim_time as f32 * 16.0 * walk * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * walk * lab as f32 + PI).sin(); let footrotl = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin()).powi(2))) + / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin()); + * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()); let footrotr = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin()).powi(2))) + / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()).powi(2))) .sqrt()) - * ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin()); + * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()); - let short = (((5.0) - / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()); - let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin(); - let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin(); + let noisea = (acc_vel * 11.0 + PI / 6.0).sin(); + let noiseb = (acc_vel * 19.0 + PI / 4.0).sin(); - let shorte = (((5.0) - / (4.0 + 1.0 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()); + let shorte = (((1.0) / (0.8 + 0.2 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt()) + * ((acc_vel * lab as f32 * 1.6).sin()); - let shortalt = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin(); - let shortalter = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / -2.0).sin(); + let shortalter = (acc_vel * lab as f32 * 1.6 + PI / -2.0).sin(); - let wave_stop = (anim_time as f32 * 26.0).min(PI / 2.0 / 2.0).sin(); + let foothoril = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); + let foothorir = (acc_vel * 1.6 * lab as f32 + PI * (0.45)).sin(); + let footstrafel = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); + let footstrafer = (acc_vel * 1.6 * lab as f32 + PI * (0.95)).sin(); + + let footvertl = (acc_vel * 1.6 * lab as f32).sin(); + let footvertr = (acc_vel * 1.6 * lab as f32 + PI).sin(); + let footvertsl = (acc_vel * 1.6 * lab as f32).sin(); + let footvertsr = (acc_vel * 1.6 * lab as f32 + PI * 0.5).sin(); + + let shortalt = (acc_vel * lab as f32 * 1.6 + PI / 2.0).sin(); + + let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt()) + * ((acc_vel * lab as f32 * 1.6).sin()); + let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; + + let side = + (velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0; + let sideabs = side.abs(); + let ori: Vec2 = Vec2::from(orientation); + let last_ori = Vec2::from(last_ori); + let tilt = if ::vek::Vec2::new(ori, last_ori) + .map(|o| o.magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.2) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + //println!("speednorm {} ",side); let head_look = Vec2::new( ((global_time + anim_time) as f32 / 18.0) @@ -94,35 +117,17 @@ impl Animation for RunAnimation { * 0.1, ); - let ori: Vec2 = Vec2::from(orientation); - let last_ori = Vec2::from(last_ori); - let tilt = if ::vek::Vec2::new(ori, last_ori) - .map(|o| o.magnitude_squared()) - .map(|m| m > 0.001 && m.is_finite()) - .reduce_and() - && ori.angle_between(last_ori).is_finite() - { - ori.angle_between(last_ori).min(0.2) - * last_ori.determine_side(Vec2::zero(), ori).signum() - } else { - 0.0 - } * 1.3; - next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + short * 0.1); next.head.orientation = - Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.1) - * Quaternion::rotation_x(head_look.y + 0.45 - lower * 0.35); + Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.02) + * Quaternion::rotation_x(head_look.y + 0.45 * speednorm); next.head.scale = Vec3::one() * s_a.head_scale; - next.chest.position = Vec3::new( - 0.0, - s_a.chest.0, - s_a.chest.1 + 2.0 + shortalt * -1.5 - lower, - ); - next.chest.orientation = Quaternion::rotation_z(short * 0.18 * walkintensity + tilt * -0.6) + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + 1.0 + shortalt * -0.8); + next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6) * Quaternion::rotation_y(tilt * 1.6) * Quaternion::rotation_x( - impact * 0.06 + shortalter * 0.035 + wave_stop * speed * -0.09 + (tilt.abs()), + impact * 0.06 + shortalter * 0.035 + speed * -0.07 + (tilt.abs()), ); next.belt.position = Vec3::new(0.0, 0.25 + s_a.belt.0, 0.25 + s_a.belt.1); @@ -141,42 +146,58 @@ impl Animation for RunAnimation { next.hand_l.position = Vec3::new( -s_a.hand.0 + foothorir * -1.3, - 3.0 + s_a.hand.1 + foothorir * -7.0 * walkintensity, - 1.5 + s_a.hand.2 - foothorir * 5.5 * walkintensity, + 3.0 + s_a.hand.1 + foothorir * -7.0 * speednorm, + 1.5 + s_a.hand.2 - foothorir * 5.5 * speednorm, ); - next.hand_l.orientation = Quaternion::rotation_x(0.6 + footrotr * -1.2 * walkintensity) - * Quaternion::rotation_y(footrotr * 0.4 * walkintensity); + next.hand_l.orientation = Quaternion::rotation_x(0.6 + (footrotr * -1.2) * speednorm) + * Quaternion::rotation_y(footrotr * 0.4); next.hand_r.position = Vec3::new( s_a.hand.0 + foothoril * 1.3, - 3.0 + s_a.hand.1 + foothoril * -6.5 * walkintensity, - 1.5 + s_a.hand.2 - foothoril * 7.0 * walkintensity, + 3.0 + s_a.hand.1 + foothoril * -7.0 * speednorm, + 1.5 + s_a.hand.2 - foothoril * 5.5 * speednorm, ); - next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2 * walkintensity) - * Quaternion::rotation_y(footrotl * -0.4 * walkintensity); + next.hand_r.orientation = Quaternion::rotation_x(0.6 + (footrotl * -1.2) * speednorm) + * Quaternion::rotation_y(footrotl * -0.4); + // next.foot_l.position = Vec3::new( - -s_a.foot.0, - -1.5 + s_a.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0, - 2.0 + s_a.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity, + -s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0, + s_a.foot.1 + + (1.0 - sideabs) * (-1.5 + foothoril * -10.5 * speednorm) + + (direction * 5.0).max(0.0), + s_a.foot.2 + + (1.0 - sideabs) * (2.0 + ((footvertl * -2.1 * speednorm).max(-1.0))) + + side * ((footvertsl * 1.5).max(-1.0)), ); - next.foot_l.orientation = Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity) - * Quaternion::rotation_y(tilt * 1.8); + next.foot_l.orientation = Quaternion::rotation_x( + (1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5, + ) * Quaternion::rotation_y( + tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3), + ) * Quaternion::rotation_z(side * 0.2); next.foot_r.position = Vec3::new( - s_a.foot.0, - -1.5 + s_a.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0, - 2.0 + s_a.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity, + s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0, + s_a.foot.1 + + (1.0 - sideabs) * (-1.5 + foothorir * -10.5 * speednorm) + + (direction * 5.0).max(0.0), + s_a.foot.2 + + (1.0 - sideabs) * (2.0 + ((footvertr * -2.1 * speednorm).max(-1.0))) + + side * ((footvertsr * -1.5).max(-1.0)), ); - next.foot_r.orientation = Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity) - * Quaternion::rotation_y(tilt * 1.8); + next.foot_r.orientation = Quaternion::rotation_x( + (1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5, + ) * Quaternion::rotation_y( + tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3), + ) * Quaternion::rotation_z(side * 0.2); + // 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(short * 0.15 * walkintensity); + next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15); next.shoulder_l.scale = Vec3::one() * 1.1; next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * walkintensity); + next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15); next.shoulder_r.scale = Vec3::one() * 1.1; next.glider.position = Vec3::new(0.0, 0.0, 10.0); diff --git a/voxygen/anim/src/character/wield.rs b/voxygen/anim/src/character/wield.rs index a60109796c..510d5e8f19 100644 --- a/voxygen/anim/src/character/wield.rs +++ b/voxygen/anim/src/character/wield.rs @@ -50,14 +50,7 @@ impl Animation for WieldAnimation { ); let foothoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin(); - let foothorir = (anim_time as f32 * 16.0 * lab as f32 + PI * (0.45)).sin(); - let footstrafel = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin(); - let footstrafer = (anim_time as f32 * 16.0 * lab as f32 + PI * (0.95)).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 footvertsl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertsr = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin(); let beltstatic = (anim_time as f32 * 10.0 * lab as f32 + PI / 2.0).sin(); let footvertlstatic = (anim_time as f32 * 10.0 * lab as f32).sin(); let footvertrstatic = (anim_time as f32 * 10.0 * lab as f32 + PI).sin(); @@ -78,7 +71,6 @@ impl Animation for WieldAnimation { * ((anim_time as f32 * lab as f32 * 16.0).sin()); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x; - let strafeabs = (1.0 / (direction).abs() - 1.0).min(1.0); let strafe = -((1.0 / (direction).abs() - 1.0).min(1.0)).copysign(side); let ori: Vec2 = Vec2::from(orientation); @@ -109,35 +101,6 @@ impl Animation for WieldAnimation { s_a.chest.0, s_a.chest.1 + shortalt * -1.5, ); - next.foot_l.position = Vec3::new( - -s_a.foot.0 + footstrafel * strafeabs * 3.0, - s_a.foot.1 - + (1.0 - strafeabs) * (-1.5 + foothoril * -7.5) - + (direction * 5.0).max(0.0), - s_a.foot.2 - + (1.0 - strafeabs) * (2.0 + ((footvertl * -2.1).max(-1.0))) - + strafe * ((footvertsl * 1.5).max(-1.0)), - ); - next.foot_l.orientation = Quaternion::rotation_x( - (1.0 - strafeabs) * (-0.2 + foothoril * -2.0) + strafeabs * -0.5, - ) * Quaternion::rotation_y( - strafe * 0.3 + strafe * (foothoril * 0.3), - ) * Quaternion::rotation_z(strafe * 0.2); - - next.foot_r.position = Vec3::new( - s_a.foot.0 + footstrafer * strafeabs * 3.0, - s_a.foot.1 - + (1.0 - strafeabs) * (-1.5 + foothorir * -7.5) - + (direction * 5.0).max(0.0), - s_a.foot.2 - + (1.0 - strafeabs) * (2.0 + ((footvertr * -2.1).max(-1.0))) - + strafe * ((footvertsr * -1.5).max(-1.0)), - ); - next.foot_r.orientation = Quaternion::rotation_x( - (1.0 - strafeabs) * (-0.2 + foothorir * -2.0) + strafeabs * -0.5, - ) * Quaternion::rotation_y( - strafe * 0.3 + strafe * (foothorir * 0.3), - ) * Quaternion::rotation_z(strafe * 0.2); } else { next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1); next.head.orientation = @@ -277,9 +240,9 @@ impl Animation for WieldAnimation { Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { if speed > 0.5 && velocity.z == 0.0 { next.hand_r.position = Vec3::new( - 4.0 + s_a.hand.0 + foothoril * 1.3, - s_a.hand.1 + foothoril * -6.5, - 5.0 + s_a.hand.2 - foothoril * 7.0, + 7.0 + s_a.hand.0 + foothoril * 1.3, + -4.0 + s_a.hand.1 + foothoril * -7.0, + 1.0 + s_a.hand.2 - foothoril * 5.5, ); next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2) * Quaternion::rotation_y(footrotl * -0.4); diff --git a/voxygen/anim/src/quadruped_medium/mod.rs b/voxygen/anim/src/quadruped_medium/mod.rs index eb3d6d6413..5a4b025dc4 100644 --- a/voxygen/anim/src/quadruped_medium/mod.rs +++ b/voxygen/anim/src/quadruped_medium/mod.rs @@ -438,13 +438,13 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Wolf, _) => (1.1), (Frostfang, _) => (1.0), (Mouflon, _) => (0.85), - (Catoblepas, _) => (0.8), + (Catoblepas, _) => (1.1), (Bonerattler, _) => (1.0), (Deer, _) => (0.85), (Hirdrasil, _) => (0.85), (Roshwalr, _) => (0.75), (Donkey, _) => (0.85), - (Camel, _) => (0.85), + (Camel, _) => (1.0), (Zebra, _) => (0.85), (Antelope, _) => (1.0), (Kelpie, _) => (0.85), diff --git a/voxygen/anim/src/quadruped_medium/run.rs b/voxygen/anim/src/quadruped_medium/run.rs index b1f88f4755..cfe718d469 100644 --- a/voxygen/anim/src/quadruped_medium/run.rs +++ b/voxygen/anim/src/quadruped_medium/run.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3); + type Dependency = (f32, Vec3, Vec3, f64, Vec3, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for RunAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_run")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency, + (velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -26,23 +26,21 @@ impl Animation for RunAnimation { *rate = 1.0; //let increasefreqtest = (((1.0/speed)*3.0).round()).min(5.0); let lab = 0.72; //0.72 - let amplitude = (speed / 24.0).max(0.25); - let amplitude2 = (speed * 1.4 / 24.0).sqrt().max(0.6); - let amplitude3 = (speed / 24.0).sqrt().max(0.35); + let amplitude = (speed / 24.0).max(0.125); + let amplitude2 = (speed * 1.4 / 24.0).sqrt().max(0.3); + let amplitude3 = (speed / 24.0).sqrt().max(0.175); let speedmult = s_a.tempo; let canceler = (speed / 24.0).sqrt(); let short = (((1.0) / (0.72 + 0.28 - * ((anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * -0.15 - 0.5) - .sin()) - .powi(2))) + * ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()) + .powi(2))) .sqrt()) - * ((anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()); + * ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()); // - let shortalt = - (anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin(); + let shortalt = (acc_vel * (1.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin(); let look = Vec2::new( ((global_time + anim_time) as f32 / 2.0) .floor() @@ -64,24 +62,20 @@ impl Animation for RunAnimation { //FL let foot1a = - (anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1) - .sin(); //1.5 + (acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5 let foot1b = - (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1) - .sin(); //1.9 + (acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //1.9 //FR - let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult + shift2).sin(); //1.2 - let foot2b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.1 + shift2).sin(); //1.6 + let foot2a = (acc_vel * (1.0) * lab as f32 * speedmult + shift2).sin(); //1.0 + let foot2b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + shift2).sin(); //1.0 //BL - let foot3a = (anim_time as f32 * (16.0) * lab as f32 * speedmult + shift3).sin(); //0.0 - let foot3b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + shift3).sin(); //0.4 + let foot3a = (acc_vel * (1.0) * lab as f32 * speedmult + shift3).sin(); //0.0 + let foot3b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + shift3).sin(); //0.4 //BR let foot4a = - (anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4) - .sin(); //0.3 + (acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3 let foot4b = - (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4) - .sin(); //0.7 + (acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7 // let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index ec5ed16189..c51fe1c05f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -757,6 +757,7 @@ impl FigureMgr { state.last_ori, time, state.avg_vel, + state.acc_vel, ), state.state_time, &mut state_animation_rate, @@ -1530,7 +1531,14 @@ impl FigureMgr { (true, true, false) => { anim::quadruped_medium::RunAnimation::update_skeleton( &QuadrupedMediumSkeleton::default(), - (vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel), + ( + vel.0.magnitude(), + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -1539,7 +1547,14 @@ impl FigureMgr { //Swimming (false, _, true) => anim::quadruped_medium::RunAnimation::update_skeleton( &QuadrupedMediumSkeleton::default(), - (vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel), + ( + vel.0.magnitude(), + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr,