forked from StrafesNET/strafe-client
fix slope divide by zero
This commit is contained in:
parent
9aa7656278
commit
432a38718c
@ -653,8 +653,10 @@ impl Planar64Vec3{
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn slope(&self,up:Self)->Planar64{
|
pub fn slope_cmp(&self,slope:Planar64,up:Self)->bool{
|
||||||
self.dot(up)/self.cross(up).length()
|
let y=self.dot(up);
|
||||||
|
let x=self.cross(up).length();
|
||||||
|
y<x*slope
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn length(&self)->Planar64{
|
pub fn length(&self)->Planar64{
|
||||||
|
@ -1235,7 +1235,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
|||||||
self.touching.constrain_acceleration(&self.models,&mut a);
|
self.touching.constrain_acceleration(&self.models,&mut a);
|
||||||
self.body.acceleration=a;
|
self.body.acceleration=a;
|
||||||
}
|
}
|
||||||
None=>if self.style.surf_slope.map_or(true,|s|s<self.models.mesh(model_id).face_nd(c.face_id().unwrap()).0.slope(Planar64Vec3::Y)){
|
None=>if self.style.surf_slope.map_or(true,|s|self.models.mesh(model_id).face_nd(c.face_id().unwrap()).0.slope_cmp(s,Planar64Vec3::Y)){
|
||||||
//ground
|
//ground
|
||||||
let mut target_velocity=self.style.get_walk_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time);
|
let mut target_velocity=self.style.get_walk_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time);
|
||||||
self.touching.constrain_velocity(&self.models,&mut target_velocity);
|
self.touching.constrain_velocity(&self.models,&mut target_velocity);
|
||||||
|
Loading…
Reference in New Issue
Block a user