forked from StrafesNET/strafe-project
tweak ReachWalkTargetVelocity
This commit is contained in:
parent
4bbccd68ed
commit
5bce4a84cf
@ -1774,19 +1774,19 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
|
||||
|MoveState::Fly
|
||||
=>println!("ReachWalkTargetVelocity fired for non-walking MoveState"),
|
||||
MoveState::Walk(walk_state)|MoveState::Ladder(walk_state)=>{
|
||||
match &walk_state.target{
|
||||
//velocity is already handled by advance_time
|
||||
//we know that the acceleration is precisely zero because the walk target is known to be reachable
|
||||
//which means that gravity can be fully cancelled
|
||||
//ignore moving platforms for now
|
||||
let target=core::mem::replace(&mut walk_state.target,TransientAcceleration::Reached);
|
||||
set_acceleration(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,vec3::ZERO);
|
||||
// check what the target was to see if it was invalid
|
||||
match target{
|
||||
//you are not supposed to reach a walk target which is already reached!
|
||||
TransientAcceleration::Reached=>unreachable!(),
|
||||
TransientAcceleration::Reachable{acceleration:_,time:_}=>{
|
||||
//velocity is already handled by advance_time
|
||||
//we know that the acceleration is precisely zero because the walk target is known to be reachable
|
||||
//which means that gravity can be fully cancelled
|
||||
//ignore moving platforms for now
|
||||
set_acceleration(&mut state.body,&state.touching,&data.models,&data.hitbox_mesh,vec3::ZERO);
|
||||
walk_state.target=TransientAcceleration::Reached;
|
||||
},
|
||||
TransientAcceleration::Reached=>println!("Invalid walk target: Reached"),
|
||||
TransientAcceleration::Reachable{..}=>(),
|
||||
//you are not supposed to reach an unreachable walk target!
|
||||
TransientAcceleration::Unreachable{acceleration:_}=>unreachable!(),
|
||||
TransientAcceleration::Unreachable{..}=>println!("Invalid walk target: Unreachable"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user