fix leaning

This commit is contained in:
Imbris 2020-04-24 21:23:49 -04:00
parent 3450bfabfd
commit 81227b917f
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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