diff --git a/lib/common/src/physics.rs b/lib/common/src/physics.rs index aa041ab..dc6be13 100644 --- a/lib/common/src/physics.rs +++ b/lib/common/src/physics.rs @@ -4,6 +4,7 @@ pub type Time=crate::integer::Time; #[derive(Clone,Debug)] pub enum Instruction{ + ReplaceMouse(crate::mouse::MouseState,crate::mouse::MouseState), SetNextMouse(crate::mouse::MouseState), SetMoveRight(bool), SetMoveUp(bool), diff --git a/strafe-client/src/physics.rs b/strafe-client/src/physics.rs index f94fbe7..16bbe48 100644 --- a/strafe-client/src/physics.rs +++ b/strafe-client/src/physics.rs @@ -1759,6 +1759,7 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI |PhysicsInputInstruction::Idle=>false, //these controls only update the body if you are on the ground PhysicsInputInstruction::SetNextMouse(..) + |PhysicsInputInstruction::ReplaceMouse(..) |PhysicsInputInstruction::SetMoveForward(..) |PhysicsInputInstruction::SetMoveLeft(..) |PhysicsInputInstruction::SetMoveBack(..) @@ -1788,6 +1789,10 @@ fn atomic_input_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:TimedI state.camera.move_mouse(state.input_state.mouse_delta()); state.input_state.set_next_mouse(m); }, + PhysicsInputInstruction::ReplaceMouse(m0,m1)=>{ + state.camera.move_mouse(m0.pos-state.input_state.mouse.pos); + state.input_state.replace_mouse(m0,m1); + }, PhysicsInputInstruction::SetMoveForward(s)=>state.input_state.set_control(Controls::MoveForward,s), PhysicsInputInstruction::SetMoveLeft(s)=>state.input_state.set_control(Controls::MoveLeft,s), PhysicsInputInstruction::SetMoveBack(s)=>state.input_state.set_control(Controls::MoveBackward,s),