From 6f4fda8cc05e234f70fbcfad0c17a93387aad065 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 19 Sep 2023 17:54:43 -0700 Subject: [PATCH] clip walk target velocity in RefreshWalkTarget --- src/body.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/body.rs b/src/body.rs index 23e50d89..99d236e0 100644 --- a/src/body.rs +++ b/src/body.rs @@ -816,7 +816,9 @@ impl crate::instruction::InstructionConsumer for PhysicsStat PhysicsInstruction::RefreshWalkTarget => { //calculate acceleration yada yada 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; if target_diff==glam::Vec3::ZERO{ let mut a=glam::Vec3::ZERO;