diff --git a/assets/voxygen/audio/sfx.ron b/assets/voxygen/audio/sfx.ron index 88600e438a..c312859c6c 100644 --- a/assets/voxygen/audio/sfx.ron +++ b/assets/voxygen/audio/sfx.ron @@ -150,7 +150,7 @@ "voxygen.audio.sfx.footsteps.stepdirt_4", "voxygen.audio.sfx.footsteps.stepdirt_5", ], - threshold: 1.8, + threshold: 0.5, subtitle: "subtitle-footsteps_earth", ), QuadRun(Earth): ( @@ -161,7 +161,7 @@ "voxygen.audio.sfx.footsteps.stepdirt_4", "voxygen.audio.sfx.footsteps.stepdirt_5", ], - threshold: 0.9, + threshold: 0.25, subtitle: "subtitle-footsteps_earth", ), Run(Grass): ( @@ -173,7 +173,7 @@ "voxygen.audio.sfx.footsteps.stepgrass_5", "voxygen.audio.sfx.footsteps.stepgrass_6", ], - threshold: 1.8, + threshold: 1.0, subtitle: "subtitle-footsteps_grass", ), QuadRun(Grass): ( @@ -185,7 +185,7 @@ "voxygen.audio.sfx.footsteps.stepgrass_5", "voxygen.audio.sfx.footsteps.stepgrass_6", ], - threshold: 0.9, + threshold: 0.5, subtitle: "subtitle-footsteps_grass", ), // For when sand 1) exists and 2) has unique sounds @@ -215,7 +215,7 @@ "voxygen.audio.sfx.footsteps.snow_step_2", "voxygen.audio.sfx.footsteps.snow_step_3", ], - threshold: 1.8, + threshold: 1.0, subtitle: "subtitle-footsteps_snow", ), QuadRun(Snow): ( @@ -224,7 +224,7 @@ "voxygen.audio.sfx.footsteps.snow_step_2", "voxygen.audio.sfx.footsteps.snow_step_3", ], - threshold: 0.9, + threshold: 0.5, subtitle: "subtitle-footsteps_snow", ), Run(Rock): ( @@ -242,7 +242,7 @@ "voxygen.audio.sfx.footsteps.stone_step_11", "voxygen.audio.sfx.footsteps.stone_step_12", ], - threshold: 1.8, + threshold: 1.0, subtitle: "subtitle-footsteps_rock", ), QuadRun(Rock): ( @@ -260,7 +260,7 @@ "voxygen.audio.sfx.footsteps.stone_step_11", "voxygen.audio.sfx.footsteps.stone_step_12", ], - threshold: 0.9, + threshold: 0.5, subtitle: "subtitle-footsteps_rock", ), Roll: ( diff --git a/common/src/comp/ability.rs b/common/src/comp/ability.rs index 19ffd92768..aea3d75b57 100644 --- a/common/src/comp/ability.rs +++ b/common/src/comp/ability.rs @@ -2404,6 +2404,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState { timer: Duration::default(), stage_section: StageSection::Buildup, was_wielded: false, // false by default. utils might set it to true + prev_aimed_dir: None, is_sneaking: false, was_combo: None, }), diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 544daa2609..52f2ca875c 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -275,6 +275,18 @@ impl Body { ) } + /// The length of the stride of the body, in metres (not accounting for + /// different legs) + pub fn stride_length(&self) -> f32 { + if let Body::Humanoid(body) = self { + body.scaler() * 3.75 + } else { + // Rough heuristic + let dims = self.dimensions(); + 0.65 + (dims.y + dims.z) * 0.6 + } + } + pub fn scale(&self) -> Scale { let s = match self { Body::BirdMedium(bird_medium) => match bird_medium.species { diff --git a/common/src/states/roll.rs b/common/src/states/roll.rs index 3e2d0ee5e5..24a7af4c5a 100644 --- a/common/src/states/roll.rs +++ b/common/src/states/roll.rs @@ -9,6 +9,7 @@ use crate::{ behavior::{CharacterBehavior, JoinData}, utils::*, }, + util::Dir, }; use serde::{Deserialize, Serialize}; use std::time::Duration; @@ -41,6 +42,8 @@ pub struct Data { pub stage_section: StageSection, /// Had weapon pub was_wielded: bool, + /// What direction were we previously aiming in? + pub prev_aimed_dir: Option, /// Is sneaking, true if previous state was also considered sneaking pub is_sneaking: bool, /// Was in state with combo diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index b5a29af7f4..603eda4a27 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -58,6 +58,7 @@ impl Body { quadruped_small::Species::Rabbit => 110.0, quadruped_small::Species::Cat => 150.0, quadruped_small::Species::Quokka => 100.0, + quadruped_small::Species::MossySnail => 20.0, _ => 125.0, }, Body::QuadrupedMedium(quadruped_medium) => match quadruped_medium.species { @@ -1246,6 +1247,9 @@ fn handle_ability( roll.is_sneaking = true; } } + if data.character.is_aimed() { + roll.prev_aimed_dir = Some(data.controller.inputs.look_dir); + } } return true; } @@ -1553,6 +1557,11 @@ pub fn end_ability(data: &JoinData<'_>, update: &mut StateUpdate) { time_entered: *data.time, }); } + if let CharacterState::Roll(roll) = data.character { + if let Some(dir) = roll.prev_aimed_dir { + update.ori = dir.into(); + } + } } pub fn end_melee_ability(data: &JoinData<'_>, update: &mut StateUpdate) { diff --git a/voxygen/anim/src/character/chargeswing.rs b/voxygen/anim/src/character/chargeswing.rs index 098d739460..49d48b1a95 100644 --- a/voxygen/anim/src/character/chargeswing.rs +++ b/voxygen/anim/src/character/chargeswing.rs @@ -69,6 +69,7 @@ impl Animation for ChargeswingAnimation { Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); next.hand_r.position = Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(PI * 0.5); next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0); next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9) * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0) diff --git a/voxygen/anim/src/character/finishermelee.rs b/voxygen/anim/src/character/finishermelee.rs index 05f60b3fc7..e23f948a25 100644 --- a/voxygen/anim/src/character/finishermelee.rs +++ b/voxygen/anim/src/character/finishermelee.rs @@ -230,7 +230,7 @@ impl Animation for FinisherMeleeAnimation { let move2_reset = ((move2 - 0.5).abs() - 0.5).abs() * 2.0; let move2 = move2 * pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + 10.0); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); diff --git a/voxygen/anim/src/character/gliding.rs b/voxygen/anim/src/character/gliding.rs index 3dca9d88d2..ed51914751 100644 --- a/voxygen/anim/src/character/gliding.rs +++ b/voxygen/anim/src/character/gliding.rs @@ -29,7 +29,7 @@ impl Animation for GlidingAnimation { next.glider_trails = true; let speednorm = velocity.magnitude().min(50.0) / 50.0; - let slow = (acc_vel * 0.5).sin(); + let slow = (acc_vel * 0.25).sin(); let head_look = Vec2::new( ((global_time + anim_time) / 4.0).floor().mul(7331.0).sin() * 0.5, @@ -56,6 +56,7 @@ impl Animation for GlidingAnimation { next.shorts.orientation = Quaternion::rotation_z(0.0); next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1); next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); + next.shorts.orientation = Quaternion::rotation_z(-speedlog + slow * 0.15); next.hand_l.position = glider_pos + glider_ori * Vec3::new(-s_a.hand.0 + -2.0, s_a.hand.1 + 8.0, s_a.hand.2); @@ -65,11 +66,19 @@ impl Animation for GlidingAnimation { glider_pos + glider_ori * Vec3::new(s_a.hand.0 + 2.0, s_a.hand.1 + 8.0, s_a.hand.2); next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2); - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + speedlog * -1.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_x(-speedlog + slow * -0.3 * speedlog); + next.foot_l.position = Vec3::new( + -s_a.foot.0, + s_a.foot.1 + speedlog * -1.0 - slow * 2.3, + s_a.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(-speedlog + slow * -1.3 * speedlog); - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + speedlog * -1.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(-speedlog + slow * 0.3 * speedlog); + next.foot_r.position = Vec3::new( + s_a.foot.0, + s_a.foot.1 + speedlog * -1.0 + slow * 2.3, + s_a.foot.2, + ); + next.foot_r.orientation = Quaternion::rotation_x(-speedlog + slow * 1.3 * speedlog); next } diff --git a/voxygen/anim/src/character/jump.rs b/voxygen/anim/src/character/jump.rs index d90c83008e..16d8ed963b 100644 --- a/voxygen/anim/src/character/jump.rs +++ b/voxygen/anim/src/character/jump.rs @@ -37,6 +37,7 @@ impl Animation for JumpAnimation { let check = subtract - subtract.trunc(); let switch = (check - 0.5).signum(); + let falling = (velocity.z * 0.1).clamped(-1.0, 1.0); let speed = Vec2::::from(velocity).magnitude(); let speednorm = (speed / 10.0).min(1.0); @@ -115,14 +116,14 @@ impl Animation for JumpAnimation { next.foot_l.position = Vec3::new( -s_a.foot.0, s_a.foot.1 - 5.0 * switch, - 2.0 + s_a.foot.2 + slow * 1.5, + 2.0 + s_a.foot.2 + slow * 1.5 + falling * -2.0, ); next.foot_l.orientation = Quaternion::rotation_x(-0.8 * switch + slow * -0.2 * switch); next.foot_r.position = Vec3::new( s_a.foot.0, s_a.foot.1 + 5.0 * switch, - 2.0 + s_a.foot.2 + slow * 1.5, + 2.0 + s_a.foot.2 + slow * 1.5 + falling * -2.0, ); next.foot_r.orientation = Quaternion::rotation_x(0.8 * switch + slow * 0.2 * switch); diff --git a/voxygen/anim/src/character/mount.rs b/voxygen/anim/src/character/mount.rs index 85b792aa7f..4769c02b4d 100644 --- a/voxygen/anim/src/character/mount.rs +++ b/voxygen/anim/src/character/mount.rs @@ -72,6 +72,8 @@ impl Animation for MountAnimation { 0.0 } * 1.3; + let bob = (anim_time * 12.0).sin(); + next.head.scale = Vec3::one() * s_a.head_scale; next.chest.scale = Vec3::one() * 1.01; next.hand_l.scale = Vec3::one() * 1.04; @@ -89,7 +91,8 @@ impl Animation for MountAnimation { next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); next.chest.orientation = - Quaternion::rotation_x(-0.4 + tilt.abs() * -1.5) * Quaternion::rotation_y(tilt * 2.0); + Quaternion::rotation_x(-0.4 + tilt.abs() * -1.5 - bob * speed * 0.0) + * Quaternion::rotation_y(tilt * 2.0); next.belt.position = Vec3::new(0.0, s_a.belt.0 + 0.5, s_a.belt.1 + 0.5); next.belt.orientation = Quaternion::rotation_x(0.2) * Quaternion::rotation_y(tilt * -0.5); @@ -99,13 +102,21 @@ impl Animation for MountAnimation { next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + 1.0, s_a.shorts.1 + 1.0); next.shorts.orientation = Quaternion::rotation_x(0.3) * Quaternion::rotation_y(tilt * -1.0); - next.hand_l.position = Vec3::new(-s_a.hand.0 + 3.0, s_a.hand.1 + 9.0, s_a.hand.2 + 4.0); + next.hand_l.position = Vec3::new( + -s_a.hand.0 + 3.0, + s_a.hand.1 + 6.0, + s_a.hand.2 + 2.0 + (bob + 1.0) * speed * 0.1, + ); next.hand_l.orientation = - Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(-PI / 2.0 + 0.5); + Quaternion::rotation_x(PI * 0.4) * Quaternion::rotation_z(-PI / 2.0 + 1.0); - next.hand_r.position = Vec3::new(s_a.hand.0 - 3.0, s_a.hand.1 + 9.0, s_a.hand.2 + 4.0); + next.hand_r.position = Vec3::new( + s_a.hand.0 - 3.0, + s_a.hand.1 + 6.0, + s_a.hand.2 + 2.0 + (bob + 1.0) * speed * 0.1, + ); next.hand_r.orientation = - Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_z(PI / 2.0 - 0.5); + Quaternion::rotation_x(PI * 0.4) * Quaternion::rotation_z(PI / 2.0 - 1.0); next.foot_l.position = Vec3::new(-s_a.foot.0 - 2.0, 4.0 + s_a.foot.1, s_a.foot.2); next.foot_l.orientation = Quaternion::rotation_x(0.5) * Quaternion::rotation_y(0.5); diff --git a/voxygen/anim/src/character/roll.rs b/voxygen/anim/src/character/roll.rs index aeae182ef7..7baf43bad6 100644 --- a/voxygen/anim/src/character/roll.rs +++ b/voxygen/anim/src/character/roll.rs @@ -5,6 +5,7 @@ use super::{ use common::{ comp::item::{Hands, ToolKind}, states::utils::StageSection, + util::Dir, }; use std::f32::consts::PI; @@ -19,6 +20,7 @@ type RollAnimationDependency = ( Vec3, f32, Option, + Option, ); impl Animation for RollAnimation { @@ -41,6 +43,7 @@ impl Animation for RollAnimation { last_ori, _global_time, stage_section, + prev_aimed_dir, ): Self::Dependency<'_>, anim_time: f32, rate: &mut f32, @@ -257,9 +260,26 @@ impl Animation for RollAnimation { next.foot_r.orientation = Quaternion::rotation_x(0.9 * movement1); next.torso.position = Vec3::new(0.0, 0.0, 7.0 * movement1); - next.torso.orientation = - Quaternion::rotation_x(-0.3 + movement1 * -0.4 + movement2 * -2.0 * PI) - * Quaternion::rotation_z(tilt * -10.0); + let roll_spin = Quaternion::rotation_x(-0.3 + movement1 * -0.4 + movement2 * -2.0 * PI); + next.torso.orientation = if let Some(prev_aimed_dir) = prev_aimed_dir { + // This is *slightly* hacky. Because rolling is not strafed movement, we + // actually correct for the entity orientation to make sure that our + // rolling motion is correct with respect to our original orientation + roll_spin + * Dir::from_unnormalized(orientation.into_array().into()) + .zip(prev_aimed_dir.to_horizontal()) + .map(|(ori, prev_aimed_dir)| { + Quaternion::::from_vec4( + ori.rotation_between(prev_aimed_dir) + .into_vec4() + .into_array() + .into(), + ) + }) + .unwrap_or_default() + } else { + roll_spin * Quaternion::rotation_z(tilt * -10.0) + }; next } diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index f8d8afdc41..098e96cb38 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -54,7 +54,7 @@ impl Animation for RunAnimation { let impact = (avg_vel.z).max(-8.0); let speednorm = (speed / 9.4).powf(0.6); - let lab: f32 = 0.8; + let lab: f32 = 0.5 / s_a.scaler; let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 1.4).sin()).powi(2))) .sqrt()) @@ -83,8 +83,8 @@ impl Animation for RunAnimation { let shortalt = (acc_vel * lab * 3.2 + PI / 1.0).sin(); let shortalt2 = (acc_vel * lab * 3.2).sin(); - let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt()) - * ((acc_vel * lab * 1.6).sin()); + let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6 + PI * 0.5).sin()).powi(2))).sqrt()) + * ((acc_vel * lab * 1.6 + PI * 0.5).sin()); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = @@ -111,91 +111,97 @@ impl Animation for RunAnimation { next.head.position = Vec3::new(0.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.06) + Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 + short * -0.3) * Quaternion::rotation_x(head_look.y + 0.45 * speednorm + shortalt2 * -0.05); next.head.scale = Vec3::one() * s_a.head_scale; next.chest.position = Vec3::new( 0.0, s_a.chest.0, - s_a.chest.1 + 1.0 * speednorm + shortalt * -0.2, + s_a.chest.1 + 1.0 * speednorm + shortalt * 1.1, ); - next.chest.orientation = Quaternion::rotation_z(short * 0.16 + tilt * -0.6) - * Quaternion::rotation_y(tilt * 1.6) - * Quaternion::rotation_x( - impact * 0.06 + shortalt2 * 0.03 + speednorm * -0.5 + (tilt.abs()), - ); + next.chest.orientation = Quaternion::rotation_x(impact * 0.07) + * Quaternion::rotation_z(short * 0.4 + tilt * -0.6) + * Quaternion::rotation_y(tilt * 2.0 + short * 0.2) + * Quaternion::rotation_x(shortalt2 * 0.03 + speednorm * -0.5 + tilt.abs()); next.belt.position = Vec3::new(0.0, 0.25 + s_a.belt.0, 0.25 + s_a.belt.1); next.belt.orientation = Quaternion::rotation_x(0.1 * speednorm) - * Quaternion::rotation_z(short * 0.1 + tilt * -1.1) + * Quaternion::rotation_z(short * -0.2 + tilt * -1.1) * Quaternion::rotation_y(tilt * 0.5); next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1); next.back.orientation = - Quaternion::rotation_x(-0.05 + short * 0.02 + noisea * 0.02 + noiseb * 0.02); + Quaternion::rotation_x(-0.05 + short * 0.02 + noisea * 0.02 + noiseb * 0.02) + * Quaternion::rotation_y(foothorir * 0.2); next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 * speednorm + s_a.shorts.1); next.shorts.orientation = Quaternion::rotation_x(0.2 * speednorm) - * Quaternion::rotation_z(short * 0.25 + tilt * -1.5) - * Quaternion::rotation_y(tilt * 0.7); + * Quaternion::rotation_z(short * -0.9 + tilt * -1.5) + * Quaternion::rotation_y(tilt * 0.7 + short * 0.08); next.hand_l.position = Vec3::new( - -s_a.hand.0 + foothorir * -1.3 * speednorm, - 3.0 * speednorm + s_a.hand.1 + foothorir * -7.0 * speednorm, - 1.5 * speednorm + s_a.hand.2 - foothorir * 5.5 * speednorm, + -s_a.hand.0 * 1.2 - foothorir * 1.3 * speednorm + + (foothoril.abs().powf(2.0) - 0.5) * speednorm * 4.0, + s_a.hand.1 * 1.3 + foothorir * -7.0 * speednorm, + s_a.hand.2 - foothorir * 2.75 * speednorm + foothoril.abs().powf(3.0) * speednorm * 8.0, ); next.hand_l.orientation = - Quaternion::rotation_x(0.6 * speednorm + (footrotr * -1.2) * speednorm) - * Quaternion::rotation_y(footrotr * 0.4 * speednorm); + Quaternion::rotation_x(0.6 * speednorm + (footrotr * -1.5 + 0.5) * speednorm) + * Quaternion::rotation_y(footrotr * 0.4 * speednorm + PI * 0.07); next.hand_r.position = Vec3::new( - s_a.hand.0 + foothoril * 1.3 * speednorm, - 3.0 * speednorm + s_a.hand.1 + foothoril * -7.0 * speednorm, - 1.5 * speednorm + s_a.hand.2 - foothoril * 5.5 * speednorm, + s_a.hand.0 * 1.2 + foothoril * 1.3 * speednorm + - (foothorir.abs().powf(2.0) - 0.5) * speednorm * 4.0, + s_a.hand.1 * 1.3 + foothoril * -7.0 * speednorm, + s_a.hand.2 - foothoril * 2.75 * speednorm + foothorir.abs().powf(3.0) * speednorm * 8.0, ); next.hand_r.orientation = - Quaternion::rotation_x(0.6 * speednorm + (footrotl * -1.2) * speednorm) - * Quaternion::rotation_y(footrotl * -0.4 * speednorm); + Quaternion::rotation_x(0.6 * speednorm + (footrotl * -1.5 + 0.5) * speednorm) + * Quaternion::rotation_y(footrotl * -0.4 * speednorm - PI * 0.07); // next.foot_l.position = Vec3::new( - -s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0, + -s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -10.0, s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm) + (direction * 5.0).max(0.0), s_a.foot.2 - + (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -2.5 * speednorm).max(-1.0))) - + side * ((footvertsl * 1.5).max(-1.0)), + + (1.0 - sideabs) * (1.25 * speednorm + ((footvertl * -5.0 * speednorm).max(-1.0))) + + side * ((footvertsl * 1.5).max(-1.0)) + + foothoril.abs().powf(6.0) * speednorm * 5.0, ); next.foot_l.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.2 + foothoril * -0.9 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (-0.3 + foothoril * -1.5 * speednorm) + sideabs * -0.5, ) * Quaternion::rotation_y( - tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3), + tilt * -0.5 + side * 0.3 + side * (foothoril * 0.3), ) * Quaternion::rotation_z(side * 0.2); next.foot_r.position = Vec3::new( - s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0, + s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -10.0, s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm) + (direction * 5.0).max(0.0), s_a.foot.2 - + (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -2.5 * speednorm).max(-1.0))) - + side * ((footvertsr * -1.5).max(-1.0)), + + (1.0 - sideabs) * (1.25 * speednorm + ((footvertr * -5.0 * speednorm).max(-1.0))) + + side * ((footvertsr * -1.5).max(-1.0)) + + foothorir.abs().powf(6.0) * speednorm * 5.0, ); next.foot_r.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.2 + foothorir * -0.9 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (-0.3 + foothorir * -1.5 * speednorm) + sideabs * -0.5, ) * Quaternion::rotation_y( - tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3), + tilt * -0.5 + 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); + next.shoulder_l.orientation = + Quaternion::rotation_x(short * 0.15 + (footrotl * 1.2 + 0.5) * speednorm); 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); + next.shoulder_r.orientation = + Quaternion::rotation_x(short * -0.15 + (footrotr * 1.2 + 0.5) * speednorm); next.shoulder_r.scale = Vec3::one() * 1.1; next.glider.position = Vec3::new(0.0, 0.0, 10.0); @@ -266,6 +272,7 @@ impl Animation for RunAnimation { s_a.hand.2 + 12.0 + impact * -0.1, ); next.hand_r.orientation = Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9); + next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 + 2.0); let fast = (anim_time * 8.0).sin(); let fast2 = (anim_time * 6.0 + 8.0).sin(); diff --git a/voxygen/anim/src/character/sit.rs b/voxygen/anim/src/character/sit.rs index a12efb377c..5abf90f60d 100644 --- a/voxygen/anim/src/character/sit.rs +++ b/voxygen/anim/src/character/sit.rs @@ -60,18 +60,20 @@ impl Animation for SitAnimation { next.shorts.orientation = Quaternion::rotation_x(stop * 0.6); next.hand_l.position = Vec3::new( - -s_a.hand.0, + -s_a.hand.0 - 1.0, s_a.hand.1 + slowa * 0.15, - s_a.hand.2 + slow * 0.7 + stop * -2.0, + s_a.hand.2 + slow * 0.7 + stop * -2.0 - 1.0, ); - next.hand_l.orientation = Quaternion::rotation_x(slowa * -0.1 + slow * 0.1); + next.hand_l.orientation = + Quaternion::rotation_x(slowa * -0.1 + slow * 0.1) * Quaternion::rotation_y(PI * 0.15); next.hand_r.position = Vec3::new( - s_a.hand.0, + s_a.hand.0 + 1.0, s_a.hand.1 + slowa * 0.15, - s_a.hand.2 + slow * 0.7 + stop * -2.0, + s_a.hand.2 + slow * 0.7 + stop * -2.0 - 1.0, ); - next.hand_r.orientation = Quaternion::rotation_x(slow * -0.1 + slowa * 0.1); + next.hand_r.orientation = + Quaternion::rotation_x(slow * -0.1 + slowa * 0.1) * Quaternion::rotation_y(PI * -0.15); next.foot_l.position = Vec3::new(-s_a.foot.0, 4.0 + s_a.foot.1, 3.0 + s_a.foot.2); next.foot_l.orientation = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1); diff --git a/voxygen/anim/src/character/stand.rs b/voxygen/anim/src/character/stand.rs index 313caaa5bb..347f06623e 100644 --- a/voxygen/anim/src/character/stand.rs +++ b/voxygen/anim/src/character/stand.rs @@ -185,6 +185,7 @@ impl Animation for StandAnimation { * Quaternion::rotation_z(0.9) * Quaternion::rotation_y(head_look.x * 1.5) * Quaternion::rotation_x(head_look.y * 1.5); + next.shoulder_r.orientation = Quaternion::rotation_x(slow * 0.15 + 2.0); let fast = (anim_time * 5.0).sin(); let fast2 = (anim_time * 4.5 + 8.0).sin(); diff --git a/voxygen/anim/src/character/wield.rs b/voxygen/anim/src/character/wield.rs index 1b6f7d3214..243db1abfc 100644 --- a/voxygen/anim/src/character/wield.rs +++ b/voxygen/anim/src/character/wield.rs @@ -54,27 +54,16 @@ impl Animation for WieldAnimation { (global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1, ); - let foothoril = (anim_time * 16.0 * lab + PI * 1.45).sin(); - let beltstatic = (anim_time * 10.0 * lab + PI / 2.0).sin(); let footvertlstatic = (anim_time * 10.0 * lab).sin(); let footvertrstatic = (anim_time * 10.0 * lab + PI).sin(); - let footrotl = - ((1.0 / (0.5 + (0.5) * ((anim_time * 16.0 * lab + PI * 1.4).sin()).powi(2))).sqrt()) - * ((anim_time * 16.0 * lab + PI * 1.4).sin()); - - let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin(); let slowalt = (anim_time * 9.0 + PI).cos(); let u_slow = (anim_time * 4.5 + PI).sin(); let slow = (anim_time * 7.0 + PI).sin(); let u_slowalt = (anim_time * 5.0 + PI).cos(); - let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt()) - * ((anim_time * lab * 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 strafe = -((1.0 / (direction).abs() - 1.0).min(1.0)).copysign(side); let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); @@ -100,24 +89,16 @@ impl Animation for WieldAnimation { next.main.orientation = Quaternion::rotation_z(0.0); next.second.position = Vec3::new(0.0, 0.0, 0.0); next.second.orientation = Quaternion::rotation_z(0.0); - if speed > 0.2 && velocity.z == 0.0 { - next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7 * speednorm) - * Quaternion::rotation_y(strafe * 0.2) - * Quaternion::rotation_x(((direction * 0.4).min(0.3)) * (1.0 - tilt.abs())); - next.head.orientation = - Quaternion::rotation_z(tilt * -0.5 + strafe * 0.4 * direction + strafe * -0.7) - * Quaternion::rotation_x( - (0.3 - direction * 0.1) * (1.0 - tilt.abs()) + look_dir.z * 0.7, - ); - next.chest.position = - Vec3::new(short * strafe, s_a.chest.0, s_a.chest.1 + shortalt * -1.5); - } else { + let is_moving = speed > 0.2 && velocity.z == 0.0; + + if !is_moving { next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + u_slow * 0.1); next.head.orientation = Quaternion::rotation_z(head_look.x + tilt * -0.75) * Quaternion::rotation_x(head_look.y.abs() + look_dir.z * 0.7); - next.chest.position = Vec3::new(slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5); + next.chest.position = + Vec3::new(slowalt * 0.2, s_a.chest.0, s_a.chest.1 + u_slow * 0.35); next.belt.orientation = Quaternion::rotation_z(0.15 + beltstatic * tilt * 0.1); next.shorts.orientation = Quaternion::rotation_z(0.3 + beltstatic * tilt * 0.2); @@ -147,47 +128,30 @@ impl Animation for WieldAnimation { next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1); - next.back.orientation = Quaternion::rotation_x(-0.2); + // next.back.orientation = Quaternion::rotation_x(-0.2); next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); } match (hands, active_tool_kind, second_tool_kind) { ((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool { Some(ToolKind::Sword) => { - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.control_l.position = next.hand_l.position * 0.2 + + Vec3::new( + s_a.sc.0, + s_a.sc.1 - slow * 2.0 * speednorm, + s_a.sc.2 + direction * -5.0 - slow * 2.0 * speednorm, + ); + next.control_r.position = next.control_l.position; + + next.hand_l.position = Vec3::new(s_a.shl.0 - 0.5, 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( - foothoril * 1.3 * speednorm - s_a.sc.0 + 6.0, - speednorm + foothoril * -3.0 * speednorm - 4.0, - -1.0 * speednorm - foothoril * 5.5 * speednorm - 2.0, - ); - next.hand_r.orientation = - Quaternion::rotation_x( - 0.6 * speednorm + (footrotl * -1.2) * speednorm + 0.9, - ) * Quaternion::rotation_y(footrotl * -0.4 * speednorm); - next.control.position = - Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15) + next.control_l.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.05) + * Quaternion::rotation_z(u_slowalt * 0.04); + next.control_r.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15) * Quaternion::rotation_z(u_slowalt * 0.08); - //carried position - /* - 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.sc.0+6.0, - -4.0, - -2.0, - ); + next.hand_r.position = Vec3::zero(); next.hand_r.orientation = - Quaternion::rotation_x(0.9); - 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 ) - ; - */ + next.hand_l.orientation * Quaternion::rotation_y(PI * 0.3); }, Some(ToolKind::Axe) => { next.main.position = Vec3::new(0.0, 0.0, 0.0); @@ -212,56 +176,52 @@ impl Animation for WieldAnimation { next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1 + 2.0, s_a.ahr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3) + * Quaternion::rotation_z(s_a.ahr.5) + * Quaternion::rotation_y(PI * -0.25); next.control.position = - Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2 + direction * -5.0); + Vec3::new(s_a.ac.0, s_a.ac.1 - 4.0, s_a.ac.2 + direction * -5.0); next.control.orientation = Quaternion::rotation_x(s_a.ac.3) * Quaternion::rotation_y(s_a.ac.4) * Quaternion::rotation_z(s_a.ac.5); }, Some(ToolKind::Hammer | ToolKind::Pick) => { - next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2); + next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1 + 3.0, s_a.hhl.2 - 1.0); next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4) * Quaternion::rotation_z(s_a.hhl.5); - next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); + next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1 + 3.0, s_a.hhr.2 + 1.0); next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4) * Quaternion::rotation_z(s_a.hhr.5); next.control.position = - Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2 + direction * -5.0); + Vec3::new(s_a.hc.0 - 1.0, s_a.hc.1, s_a.hc.2 + direction * -5.0 - 3.0); next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + u_slow * 0.15) * Quaternion::rotation_y(s_a.hc.4) * Quaternion::rotation_z(s_a.hc.5 + u_slowalt * 0.07); }, Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - if speed > 0.5 && velocity.z == 0.0 { - next.hand_r.position = Vec3::new( - 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.control_l.position = next.hand_l.position * 0.2 + + Vec3::new( + s_a.sc.0 + 1.0, + s_a.sc.1 - slow * 2.0 * speednorm - 3.0, + s_a.sc.2 + direction * -5.0 - slow * 2.0 * speednorm - 3.0, ); - next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2) - * Quaternion::rotation_y(footrotl * -0.4); - } else { - 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.control_r.position = next.control_l.position; - next.control.position = - Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2 + direction * -5.0); - - 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.control.orientation = Quaternion::rotation_x(s_a.stc.3 + u_slow * 0.1) - * Quaternion::rotation_y(s_a.stc.4) - * Quaternion::rotation_z(s_a.stc.5 + u_slowalt * 0.1); + next.hand_l.position = Vec3::new(s_a.shl.0 - 0.5, s_a.shl.1, s_a.shl.2 + 0.0); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.control_l.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.05) + * Quaternion::rotation_z(u_slowalt * 0.04); + next.control_r.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15) + * Quaternion::rotation_z(u_slowalt * 0.08); + next.hand_r.position = Vec3::new(0.0, 0.0, 8.0); + next.hand_r.orientation = + next.hand_l.orientation * Quaternion::rotation_y(PI * 0.3); }, Some(ToolKind::Bow) => { next.main.position = Vec3::new(0.0, 0.0, 0.0); @@ -542,21 +502,29 @@ impl Animation for WieldAnimation { }; match hands { (Some(Hands::One), _) => { - next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); - next.control_l.orientation = - Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.2); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) + next.control_l.position = + next.hand_l.position * Vec3::new(0.5, 0.5, 0.3) + Vec3::new(-4.0, 0.0, 0.0); + next.control_l.orientation = Quaternion::lerp( + next.hand_l.orientation, + Quaternion::rotation_x(PI * -0.5), + 0.65, + ); + next.hand_l.position = Vec3::new(0.0, -2.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI * 0.5); }, (_, _) => {}, }; match hands { (None | Some(Hands::One), Some(Hands::One)) => { - next.control_r.position = Vec3::new(7.0, 8.0, 2.0); - next.control_r.orientation = - Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-0.2); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + next.control_r.position = + next.hand_r.position * Vec3::new(0.5, 0.5, 0.3) + Vec3::new(4.0, 0.0, 0.0); + next.control_r.orientation = Quaternion::lerp( + next.hand_r.orientation, + Quaternion::rotation_x(PI * -0.5), + 0.65, + ); + next.hand_r.position = Vec3::new(0.0, -2.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI * 0.5); }, (_, _) => {}, }; @@ -570,9 +538,10 @@ impl Animation for WieldAnimation { }; match hands { (None, None) | (Some(Hands::One), None) => { - next.hand_r.position = Vec3::new(8.0, 2.0, 1.0); - next.hand_r.orientation = - Quaternion::rotation_x(0.5) * Quaternion::rotation_y(-0.25); + // next.hand_r.position = Vec3::new(8.0, 2.0, 1.0); + // next.hand_r.orientation = + // Quaternion::rotation_x(0.5) * + // Quaternion::rotation_y(-0.25); }, (_, _) => {}, }; diff --git a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs index 070b994059..7d1875d503 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/mod.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/mod.rs @@ -9,7 +9,7 @@ use crate::{ }; use client::Client; use common::{ - comp::{Body, CharacterState, PhysicsState, Pos, Vel}, + comp::{Body, CharacterState, PhysicsState, Pos, Scale, Vel}, resources::DeltaTime, terrain::{BlockKind, TerrainChunk}, vol::ReadVol, @@ -26,7 +26,7 @@ struct PreviousEntityState { time: Instant, on_ground: bool, in_water: bool, - distance_travelled: f32, + steps_taken: f32, } impl Default for PreviousEntityState { @@ -36,7 +36,7 @@ impl Default for PreviousEntityState { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, } } } @@ -61,11 +61,12 @@ impl EventMapper for MovementEventMapper { let focus_off = camera.get_focus_pos().map(f32::trunc); let cam_pos = camera.dependents().cam_pos + focus_off; - for (entity, pos, vel, body, physics, character) in ( + for (entity, pos, vel, body, scale, physics, character) in ( &ecs.entities(), &ecs.read_storage::(), &ecs.read_storage::(), &ecs.read_storage::(), + ecs.read_storage::().maybe(), &ecs.read_storage::(), ecs.read_storage::().maybe(), ) @@ -115,7 +116,7 @@ impl EventMapper for MovementEventMapper { underwater, ); internal_state.time = Instant::now(); - internal_state.distance_travelled = 0.0; + internal_state.steps_taken = 0.0; } // update state to determine the next event. We only record the time (above) if @@ -124,7 +125,8 @@ impl EventMapper for MovementEventMapper { internal_state.on_ground = physics.on_ground.is_some(); internal_state.in_water = physics.in_liquid().is_some(); let dt = ecs.fetch::().0; - internal_state.distance_travelled += vel.0.magnitude() * dt; + internal_state.steps_taken += + vel.0.magnitude() * dt / (body.stride_length() * scale.map_or(1.0, |s| s.0)); } } @@ -167,9 +169,9 @@ impl MovementEventMapper { if let Some((event, item)) = sfx_trigger_item { if &previous_state.event == event { match event { - SfxEvent::Run(_) => previous_state.distance_travelled >= item.threshold, - SfxEvent::Climb => previous_state.distance_travelled >= item.threshold, - SfxEvent::QuadRun(_) => previous_state.distance_travelled >= item.threshold, + SfxEvent::Run(_) => previous_state.steps_taken >= item.threshold, + SfxEvent::Climb => previous_state.steps_taken >= item.threshold, + SfxEvent::QuadRun(_) => previous_state.steps_taken >= item.threshold, _ => previous_state.time.elapsed().as_secs_f32() >= item.threshold, } } else { diff --git a/voxygen/src/audio/sfx/event_mapper/movement/tests.rs b/voxygen/src/audio/sfx/event_mapper/movement/tests.rs index 2487b2c760..2e60775dc3 100644 --- a/voxygen/src/audio/sfx/event_mapper/movement/tests.rs +++ b/voxygen/src/audio/sfx/event_mapper/movement/tests.rs @@ -32,7 +32,7 @@ fn config_but_played_since_threshold_no_emit() { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }; let result = MovementEventMapper::should_emit( @@ -56,7 +56,7 @@ fn config_and_not_played_since_threshold_emits() { time: Instant::now().checked_add(Duration::from_secs(1)).unwrap(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }; let result = MovementEventMapper::should_emit( @@ -82,7 +82,7 @@ fn same_previous_event_elapsed_emits() { .unwrap(), on_ground: true, in_water: false, - distance_travelled: 2.0, + steps_taken: 2.0, }; let result = MovementEventMapper::should_emit( @@ -106,7 +106,7 @@ fn maps_idle() { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::zero(), BlockKind::Grass, @@ -128,7 +128,7 @@ fn maps_run_with_sufficient_velocity() { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::new(0.5, 0.8, 0.0), BlockKind::Grass, @@ -150,7 +150,7 @@ fn does_not_map_run_with_insufficient_velocity() { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::new(0.02, 0.0001, 0.0), BlockKind::Grass, @@ -169,7 +169,7 @@ fn does_not_map_run_with_sufficient_velocity_but_not_on_ground() { time: Instant::now(), on_ground: false, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::new(0.5, 0.8, 0.0), BlockKind::Grass, @@ -200,6 +200,7 @@ fn maps_roll() { timer: Duration::default(), stage_section: states::utils::StageSection::Buildup, was_wielded: true, + prev_aimed_dir: None, is_sneaking: false, was_combo: None, }), @@ -212,7 +213,7 @@ fn maps_roll() { time: Instant::now(), on_ground: true, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::new(0.5, 0.5, 0.0), BlockKind::Grass, @@ -234,7 +235,7 @@ fn maps_land_on_ground_to_run() { time: Instant::now(), on_ground: false, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::zero(), BlockKind::Grass, @@ -253,7 +254,7 @@ fn maps_glide() { time: Instant::now(), on_ground: false, in_water: false, - distance_travelled: 0.0, + steps_taken: 0.0, }, Vec3::zero(), BlockKind::Grass, diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 93e19e1d62..edb5b3dbef 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1101,9 +1101,9 @@ impl FigureMgr { let holding_lantern = inventory .map_or(false, |i| i.equipped(EquipSlot::Lantern).is_some()) && light_emitter.is_some() - && !(second_tool_hand.is_some() - || matches!(active_tool_hand, Some(Hands::Two)) - && character.map_or(false, |c| c.is_wield())) + && ((second_tool_hand.is_none() + && matches!(active_tool_hand, Some(Hands::One))) + || !character.map_or(false, |c| c.is_wield())) && !character.map_or(false, |c| c.is_using_hands()) && physics.in_liquid().is_none(); @@ -1263,6 +1263,7 @@ impl FigureMgr { state.last_ori * anim::vek::Vec3::::unit_y(), time, Some(s.stage_section), + s.prev_aimed_dir, ), stage_progress, &mut state_animation_rate,