exit strafe tick early if zero control dir
This commit is contained in:
parent
27a46093ae
commit
053514fa4a
@ -1445,16 +1445,19 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
PhysicsInstruction::StrafeTick => {
|
PhysicsInstruction::StrafeTick => {
|
||||||
let camera_mat=self.camera.simulate_move_rotation_y(self.camera.mouse.lerp(&self.next_mouse,self.time).x);
|
let control_dir=self.style.get_control_dir(self.controls);
|
||||||
let control_dir=camera_mat*self.style.get_control_dir(self.controls);
|
if control_dir!=Planar64Vec3::ZERO{
|
||||||
//normalize but careful for zero
|
let camera_mat=self.camera.simulate_move_rotation_y(self.camera.mouse.lerp(&self.next_mouse,self.time).x);
|
||||||
let d=self.body.velocity.dot(control_dir);
|
let control_dir=camera_mat*control_dir;
|
||||||
if d<self.style.mv {
|
//normalize but careful for zero
|
||||||
let v=self.body.velocity+control_dir*(self.style.mv-d);
|
let d=self.body.velocity.dot(control_dir);
|
||||||
//this is wrong but will work ig
|
if d<self.style.mv {
|
||||||
//need to note which push planes activate in push solve and keep those
|
let v=self.body.velocity+control_dir*(self.style.mv-d);
|
||||||
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,v){
|
//this is wrong but will work ig
|
||||||
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
//need to note which push planes activate in push solve and keep those
|
||||||
|
if set_velocity_cull(&mut self.body,&mut self.touching,&self.models,v){
|
||||||
|
(self.move_state,self.body.acceleration)=self.touching.get_move_state(&self.body,&self.models,&self.style,&self.camera,self.controls,&self.next_mouse,self.time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user