From 053514fa4af3d2658bd9a6044ec86b55e1467871 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 8 Nov 2023 20:23:39 -0800 Subject: [PATCH] exit strafe tick early if zero control dir --- src/physics.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 9239b2b..90be5dd 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -1445,16 +1445,19 @@ impl crate::instruction::InstructionConsumer for PhysicsStat } }, PhysicsInstruction::StrafeTick => { - let camera_mat=self.camera.simulate_move_rotation_y(self.camera.mouse.lerp(&self.next_mouse,self.time).x); - let control_dir=camera_mat*self.style.get_control_dir(self.controls); - //normalize but careful for zero - let d=self.body.velocity.dot(control_dir); - if d