End roll when going too slow

This commit is contained in:
timokoesters 2019-06-29 14:10:52 +02:00
parent 22af8cb9d5
commit 5a41a58c0a
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
3 changed files with 3 additions and 3 deletions

View File

@ -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(),

View File

@ -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());
}

View File

@ -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);
}
}