From 971e83e392d24022cdbfce2953e60febeeb8116d Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 2 Aug 2024 10:28:19 -0700 Subject: [PATCH] pre-transform timestamps --- src/physics_worker.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/physics_worker.rs b/src/physics_worker.rs index 2c2be72..67d956c 100644 --- a/src/physics_worker.rs +++ b/src/physics_worker.rs @@ -38,16 +38,16 @@ impl MouseInterpolator{ if self.mouse_blocking{ //tell the game state which is living in the past about its future self.timeline.push_front(TimedInstruction{ - time:self.last_mouse_time, + time:self.timer.time(self.last_mouse_time), instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:self.timer.time(ins.time),pos:m}), }); }else{ //mouse has just started moving again after being still for longer than 10ms. //replace the entire mouse interpolation state to avoid an intermediate state with identical m0.t m1.t timestamps which will divide by zero self.timeline.push_front(TimedInstruction{ - time:self.last_mouse_time, + time:self.timer.time(self.last_mouse_time), instruction:PhysicsInputInstruction::ReplaceMouse( - MouseState{time:self.last_mouse_time,pos:physics.get_next_mouse().pos}, + MouseState{time:self.timer.time(self.last_mouse_time),pos:physics.get_next_mouse().pos}, MouseState{time:self.timer.time(ins.time),pos:m} ), }); @@ -102,7 +102,7 @@ impl MouseInterpolator{ if Time::from_millis(10)){