Fix roll from cliff bug

This commit is contained in:
timokoesters 2019-08-25 18:47:45 +02:00
parent a715a84ea7
commit b96557d012
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -74,12 +74,13 @@ impl<'a> System<'a> for Sys {
}
if character.movement.is_roll() {
vel.0 = controller
vel.0 = Vec3::new(0.0, 0.0, vel.0.z)
+ controller
.move_dir
.try_normalized()
.map(Vec3::from)
.unwrap_or(vel.0.normalized())
* ROLL_SPEED;
.map(|m| m)
.unwrap_or(Vec2::from(vel.0).normalized())
* ROLL_SPEED
} else {
// Move player according to move_dir
vel.0 += Vec2::broadcast(dt.0)