surf test was wrong
This commit is contained in:
parent
2d14e8ac8e
commit
4456ee29ec
@ -653,10 +653,10 @@ impl Planar64Vec3{
|
||||
))
|
||||
}
|
||||
#[inline]
|
||||
pub fn slope_cmp(&self,slope:Planar64,up:Self)->bool{
|
||||
pub fn walkable(&self,slope:Planar64,up:Self)->bool{
|
||||
let y=self.dot(up);
|
||||
let x=self.cross(up).length();
|
||||
y<x*slope
|
||||
x*slope<y
|
||||
}
|
||||
#[inline]
|
||||
pub fn length(&self)->Planar64{
|
||||
|
@ -823,7 +823,7 @@ impl TouchingState{
|
||||
self.constrain_acceleration(models,&mut acceleration);
|
||||
a=acceleration;
|
||||
},
|
||||
None=>if style.surf_slope.map_or(true,|s|normal.slope_cmp(s,Planar64Vec3::Y)){
|
||||
None=>if style.surf_slope.map_or(true,|s|normal.walkable(s,Planar64Vec3::Y)){
|
||||
//check ground
|
||||
let mut target_velocity=style.get_walk_target_velocity(camera,controls,next_mouse,time);
|
||||
self.constrain_velocity(models,&mut target_velocity);
|
||||
@ -1343,7 +1343,7 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
||||
self.move_state=MoveState::Ladder(walk_state);
|
||||
set_acceleration(&mut self.body,&mut self.touching,&self.models,a);
|
||||
}
|
||||
None=>if self.style.surf_slope.map_or(true,|s|self.models.mesh(model_id).face_nd(contact.face_id).0.slope_cmp(s,Planar64Vec3::Y)){
|
||||
None=>if self.style.surf_slope.map_or(true,|s|self.models.mesh(model_id).face_nd(contact.face_id).0.walkable(s,Planar64Vec3::Y)){
|
||||
//ground
|
||||
let gravity=self.touching.base_acceleration(&self.models,&self.style,&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);
|
||||
|
Loading…
Reference in New Issue
Block a user