From 5a41a58c0a075af16017ac8c22b648fcd689b1d5 Mon Sep 17 00:00:00 2001 From: timokoesters Date: Sat, 29 Jun 2019 14:10:52 +0200 Subject: [PATCH] End roll when going too slow --- common/src/sys/animation.rs | 2 +- common/src/sys/controller.rs | 2 +- common/src/sys/phys.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 95bb562f90..3412b49943 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -57,7 +57,7 @@ impl<'a> System<'a> for Sys { let animation = match ( on_ground.is_some(), - vel.0.magnitude() > 3.0, // Moving + vel.0.magnitude_squared() > 10.0, // Moving attacking.is_some(), gliding.is_some(), rolling.is_some(), diff --git a/common/src/sys/controller.rs b/common/src/sys/controller.rs index 5bd45ac7c7..9dc84325c4 100644 --- a/common/src/sys/controller.rs +++ b/common/src/sys/controller.rs @@ -108,7 +108,7 @@ impl<'a> System<'a> for Sys { && attackings.get(entity).is_none() && glidings.get(entity).is_none() && on_ground.is_some() - && vel.0.magnitude() > 5.0 + && vel.0.magnitude_squared() > 25.0 { rollings.insert(entity, Rolling::start()); } diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index f95d6b839a..4da571fb1b 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -124,7 +124,7 @@ impl<'a> System<'a> for Sys { // Roll if let Some(time) = rollings.get_mut(entity).map(|r| &mut r.time) { *time += dt.0; - if *time > 0.55 { + if *time > 0.55 || vel.0.magnitude_squared() < 10.0 { rollings.remove(entity); } }