From 0a5a0f4c66432b357ef85ae4a5ff3b1994fe486c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 4 Oct 2023 23:13:45 -0700 Subject: [PATCH] please fix this man --- src/physics.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 5908336..d4647f2 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -565,40 +565,41 @@ impl PhysicsState { crate::worker::Worker::new(self.output(),move |ins:TimedInstruction|{ let run_queue=match &ins.instruction{ InputInstruction::MoveMouse(_)=>{ + //I FORGOT TO EDIT THE MOVE MOUSE TIMESTAMPS if !mouse_blocking{ //mouse has not been moving for a while. //make sure not to interpolate between two distant MouseStates. //generate a mouse instruction with no movement timestamped at last InputInstruction //Idle instructions are CRITICAL to keeping this value up to date //interpolate normally (now that prev mouse pos is up to date) - timeline.push_back(TimedInstruction{ - time:last_time, - instruction:InputInstruction::MoveMouse(self.next_mouse.pos), - }); + // timeline.push_back(TimedInstruction{ + // time:last_time, + // instruction:InputInstruction::MoveMouse(self.next_mouse.pos), + // }); } mouse_blocking=true;//block physics until the next mouse event or mouse event timeout. true//empty queue }, _=>{ if mouse_blocking{ + //maybe I can turn this inside out by making this anotehr state machine where 50_000_000 is an instruction timestamp //check if last mouse move is within 50ms if ins.time-self.next_mouse.time<50_000_000{ - last_time=ins.time; false//do not empty queue }else{ mouse_blocking=false; - timeline.push_back(TimedInstruction{ - time:ins.time, - instruction:InputInstruction::MoveMouse(self.next_mouse.pos), - }); + // timeline.push_back(TimedInstruction{ + // time:ins.time, + // instruction:InputInstruction::MoveMouse(self.next_mouse.pos), + // }); true } }else{ - last_time=ins.time; true } }, }; + last_time=ins.time; timeline.push_back(ins); if run_queue{ //empty queue