clip walk target velocity in RefreshWalkTarget

This commit is contained in:
Quaternions 2023-09-19 17:54:43 -07:00
parent d58f915082
commit 6f4fda8cc0

View File

@ -816,7 +816,9 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
PhysicsInstruction::RefreshWalkTarget => { PhysicsInstruction::RefreshWalkTarget => {
//calculate acceleration yada yada //calculate acceleration yada yada
if self.grounded{ if self.grounded{
let mut target_diff=self.walk.target_velocity-self.body.velocity; let mut v=self.walk.target_velocity;
self.contact_constrain_velocity(&mut v);
let mut target_diff=v-self.body.velocity;
target_diff.y=0f32; target_diff.y=0f32;
if target_diff==glam::Vec3::ZERO{ if target_diff==glam::Vec3::ZERO{
let mut a=glam::Vec3::ZERO; let mut a=glam::Vec3::ZERO;