Gracefully handle 0 acceleration for walking targets

This commit is contained in:
2025-11-18 19:01:24 +00:00
parent 128e137829
commit c6dd67ca37

View File

@@ -100,7 +100,6 @@ enum TransientAcceleration{
time:Time,
},
//walk target will never be reached
#[expect(dead_code)]
Unreachable{
acceleration:Planar64Vec3,
}
@@ -116,6 +115,10 @@ impl TransientAcceleration{
fn with_target_diff(target_diff:Planar64Vec3,accel:Planar64,time:Time)->Self{
if target_diff==vec3::ZERO{
TransientAcceleration::Reached
}else if accel==0{
TransientAcceleration::Unreachable{
acceleration:vec3::ZERO
}
}else{
//normal friction acceleration is clippedAcceleration.dot(normal)*friction
TransientAcceleration::Reachable{