mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made orientation change with move_dir, added a small amount of knockback
This commit is contained in:
parent
5e3e87f9c5
commit
e52250a193
@ -54,7 +54,8 @@ impl<'a> System<'a> for Sys {
|
||||
stat_b
|
||||
.health
|
||||
.change_by(-10, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon
|
||||
vel_b.0.z = 4.0;
|
||||
vel_b.0 += (pos_b.0 - pos.0).normalized() * 5.0;
|
||||
vel_b.0.z = 10.0;
|
||||
let _ = force_updates.insert(b, ForceUpdate);
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,11 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
// Set direction based on move direction when on the ground
|
||||
if Vec2::<f32>::from(move_dir.0).magnitude_squared() > 0.0001 {
|
||||
ori.0 = Lerp::lerp(ori.0, Vec3::from(move_dir.0.normalized()), 4.0 * dt.0);
|
||||
}
|
||||
}
|
||||
|
||||
// Jump
|
||||
@ -132,15 +137,6 @@ impl<'a> System<'a> for Sys {
|
||||
rollings.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set direction based on velocity when on the ground
|
||||
if Vec2::<f32>::from(vel.0).magnitude_squared() > 0.0001 {
|
||||
ori.0 = Lerp::lerp(
|
||||
ori.0,
|
||||
vel.0.normalized() * Vec3::new(1.0, 1.0, 0.0),
|
||||
10.0 * dt.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user