Prevent problems with no vel while rolling in the future

This commit is contained in:
timokoesters 2019-08-25 21:22:56 +02:00
parent c278ac9927
commit 08fa6a3414
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -79,7 +79,7 @@ impl<'a> System<'a> for Sys {
.move_dir
.try_normalized()
.map(|m| m)
.unwrap_or(Vec2::from(vel.0).normalized())
.unwrap_or(Vec2::from(vel.0).try_normalized().unwrap_or_default())
* ROLL_SPEED
} else {
// Move player according to move_dir