fix ladder crashes

This commit is contained in:
Quaternions 2023-11-10 18:29:53 -08:00
parent 2acf740898
commit d3cf75e0d5

View File

@ -613,7 +613,16 @@ impl StyleModifiers{
//two fixes:
//- ladder movement is not allowed on walkable surfaces
//- fix the underlying issue
normal.cross(control_dir).cross(*normal)*(self.ladder_speed/(n*(n*n-d*d).sqrt()))
if d.get().unsigned_abs()<n.get().unsigned_abs(){
let cr=normal.cross(control_dir);
if cr==Planar64Vec3::ZERO{
Planar64Vec3::ZERO
}else{
cr.cross(*normal)*(self.ladder_speed/(n*(n*n-d*d).sqrt()))
}
}else{
Planar64Vec3::ZERO
}
}
fn get_propulsion_control_dir(&self,camera:&PhysicsCamera,controls:u32,next_mouse:&MouseState,time:Time)->Planar64Vec3{
let camera_mat=camera.simulate_move_rotation(camera.mouse.lerp(&next_mouse,time));