please fix this man
This commit is contained in:
parent
c61b6cfb90
commit
0a5a0f4c66
@ -565,40 +565,41 @@ impl PhysicsState {
|
|||||||
crate::worker::Worker::new(self.output(),move |ins:TimedInstruction<InputInstruction>|{
|
crate::worker::Worker::new(self.output(),move |ins:TimedInstruction<InputInstruction>|{
|
||||||
let run_queue=match &ins.instruction{
|
let run_queue=match &ins.instruction{
|
||||||
InputInstruction::MoveMouse(_)=>{
|
InputInstruction::MoveMouse(_)=>{
|
||||||
|
//I FORGOT TO EDIT THE MOVE MOUSE TIMESTAMPS
|
||||||
if !mouse_blocking{
|
if !mouse_blocking{
|
||||||
//mouse has not been moving for a while.
|
//mouse has not been moving for a while.
|
||||||
//make sure not to interpolate between two distant MouseStates.
|
//make sure not to interpolate between two distant MouseStates.
|
||||||
//generate a mouse instruction with no movement timestamped at last InputInstruction
|
//generate a mouse instruction with no movement timestamped at last InputInstruction
|
||||||
//Idle instructions are CRITICAL to keeping this value up to date
|
//Idle instructions are CRITICAL to keeping this value up to date
|
||||||
//interpolate normally (now that prev mouse pos is up to date)
|
//interpolate normally (now that prev mouse pos is up to date)
|
||||||
timeline.push_back(TimedInstruction{
|
// timeline.push_back(TimedInstruction{
|
||||||
time:last_time,
|
// time:last_time,
|
||||||
instruction:InputInstruction::MoveMouse(self.next_mouse.pos),
|
// instruction:InputInstruction::MoveMouse(self.next_mouse.pos),
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
mouse_blocking=true;//block physics until the next mouse event or mouse event timeout.
|
mouse_blocking=true;//block physics until the next mouse event or mouse event timeout.
|
||||||
true//empty queue
|
true//empty queue
|
||||||
},
|
},
|
||||||
_=>{
|
_=>{
|
||||||
if mouse_blocking{
|
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
|
//check if last mouse move is within 50ms
|
||||||
if ins.time-self.next_mouse.time<50_000_000{
|
if ins.time-self.next_mouse.time<50_000_000{
|
||||||
last_time=ins.time;
|
|
||||||
false//do not empty queue
|
false//do not empty queue
|
||||||
}else{
|
}else{
|
||||||
mouse_blocking=false;
|
mouse_blocking=false;
|
||||||
timeline.push_back(TimedInstruction{
|
// timeline.push_back(TimedInstruction{
|
||||||
time:ins.time,
|
// time:ins.time,
|
||||||
instruction:InputInstruction::MoveMouse(self.next_mouse.pos),
|
// instruction:InputInstruction::MoveMouse(self.next_mouse.pos),
|
||||||
});
|
// });
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
last_time=ins.time;
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
last_time=ins.time;
|
||||||
timeline.push_back(ins);
|
timeline.push_back(ins);
|
||||||
if run_queue{
|
if run_queue{
|
||||||
//empty queue
|
//empty queue
|
||||||
|
Loading…
Reference in New Issue
Block a user