Gracefully handle 0 acceleration for walking targets
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user