From 3c37ae3ab1bc836c1c9ddbdb45fd68fc2656073d Mon Sep 17 00:00:00 2001 From: Imbris Date: Fri, 24 Apr 2020 21:23:49 -0400 Subject: [PATCH] fix leaning --- common/src/states/roll.rs | 2 +- common/src/states/utils.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/src/states/roll.rs b/common/src/states/roll.rs index 420f06cf0b..3c28ea1005 100644 --- a/common/src/states/roll.rs +++ b/common/src/states/roll.rs @@ -28,7 +28,7 @@ impl CharacterBehavior for Data { * ROLL_SPEED; // Smooth orientation - update.ori.0 = Dir::slerp_to_vec3(update.ori.0, update.vel.0, 9.0 * data.dt.0); + update.ori.0 = Dir::slerp_to_vec3(update.ori.0, update.vel.0.xy().into(), 9.0 * data.dt.0); if self.remaining_duration == Duration::default() { // Roll duration has expired diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 1c77a54033..95620d6745 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -63,9 +63,11 @@ fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) { pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, strength: f32) { // Set direction based on move direction let ori_dir = if update.character.is_attack() || update.character.is_block() { - Vec2::from(*data.inputs.look_dir) + data.inputs.look_dir.xy() + } else if !data.inputs.move_dir.is_approx_zero() { + data.inputs.move_dir } else { - Vec2::from(data.inputs.move_dir) + update.ori.0.xy() }; // Smooth orientation