Avoid unchecked clamp in skate character state

This commit is contained in:
crabman 2024-04-15 19:36:03 +00:00
parent 7c7f737118
commit 76f48a5bf4
No known key found for this signature in database

View File

@ -58,7 +58,9 @@ impl CharacterBehavior for Data {
data.sidewalk = 0.0;
}
// forward, max at 8u/s
(data.dt.0 * 3.0).clamp(0.0, 8.0 - current_planar_velocity)
(data.dt.0 * 3.0)
.min(8.0 - current_planar_velocity)
.max(0.0)
} else {
if let CharacterState::Skate(data) = &mut update.character {
data.accelerate = -1.0;