fixing character movement to no longer fail normalization then get a zero vec and then normalize again

may this can be further simplyfied
This commit is contained in:
Marcel Märtens 2019-10-26 17:36:43 +02:00
parent e804282169
commit 242a0d35bd

View File

@ -102,12 +102,9 @@ impl<'a> System<'a> for Sys {
if character.movement.is_roll() {
vel.0 = Vec3::new(0.0, 0.0, vel.0.z)
+ (vel.0 * Vec3::new(1.0, 1.0, 0.0)
+ 1.5
* inputs
.move_dir
.try_normalized()
.unwrap_or(Vec2::from(vel.0).try_normalized().unwrap_or_default()))
.normalized()
+ 1.5 * inputs.move_dir.try_normalized().unwrap_or_default())
.try_normalized()
.unwrap_or_default()
* ROLL_SPEED;
}
if character.action.is_block() || character.action.is_attack() {