forked from StrafesNET/strafe-client
tape up last stragglers
This commit is contained in:
parent
d9be4b8105
commit
a53d90f74b
@ -653,6 +653,10 @@ impl Planar64Vec3{
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
|
pub fn slope(&self,up:Self)->Planar64{
|
||||||
|
self.dot(up)/self.cross(up).length()
|
||||||
|
}
|
||||||
|
#[inline]
|
||||||
pub fn length(&self)->Planar64{
|
pub fn length(&self)->Planar64{
|
||||||
let radicand=(self.0.x as i128)*(self.0.x as i128)+(self.0.y as i128)*(self.0.y as i128)+(self.0.z as i128)*(self.0.z as i128);
|
let radicand=(self.0.x as i128)*(self.0.x as i128)+(self.0.y as i128)*(self.0.y as i128)+(self.0.z as i128)*(self.0.z as i128);
|
||||||
Planar64(unsafe{(radicand as f64).sqrt().to_int_unchecked()})
|
Planar64(unsafe{(radicand as f64).sqrt().to_int_unchecked()})
|
||||||
|
@ -715,6 +715,12 @@ impl Collision{
|
|||||||
|&Collision::Intersect(IntersectCollision{model_id})=>model_id,
|
|&Collision::Intersect(IntersectCollision{model_id})=>model_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn face_id(&self)->Option<crate::model_physics::FaceId>{
|
||||||
|
match self{
|
||||||
|
&Collision::Contact(ContactCollision{model_id:_,face_id})=>Some(face_id),
|
||||||
|
&Collision::Intersect(IntersectCollision{model_id:_})=>None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct TouchingState{
|
struct TouchingState{
|
||||||
@ -1225,12 +1231,12 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
|||||||
//ladder walkstate
|
//ladder walkstate
|
||||||
let mut target_velocity=self.style.get_ladder_target_velocity(&self.camera,self.controls,&self.next_mouse,self.time);
|
let mut target_velocity=self.style.get_ladder_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);
|
||||||
let (walk_state,mut a)=WalkState::ladder(&self.touching,&self.body,&self.style,&self.models,target_velocity,&self.models.mesh(c.model_id).face_nd(c.face_id).0);
|
let (walk_state,mut a)=WalkState::ladder(&self.touching,&self.body,&self.style,&self.models,target_velocity,&self.models.mesh(model_id).face_nd(c.face_id().unwrap()).0);
|
||||||
self.move_state=MoveState::Ladder(walk_state);
|
self.move_state=MoveState::Ladder(walk_state);
|
||||||
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).0.slope(up)){
|
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)){
|
||||||
//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