delete get_move_state function
This commit is contained in:
parent
fb47b09925
commit
b955407b06
@ -733,53 +733,6 @@ impl TouchingState{
|
||||
}
|
||||
}
|
||||
}
|
||||
//TODO: delete this or make it a constructor of MoveState
|
||||
fn get_move_state(&self,body:&Body,models:&PhysicsModels,style:&StyleModifiers,hitbox_mesh:&HitboxMesh,camera:&PhysicsCamera,input_state:&InputState,time:Time)->(MoveState,Planar64Vec3){
|
||||
//check current move conditions and use heuristics to determine
|
||||
//which ladder to climb on, which ground to walk on, etc
|
||||
//collect move state affecting objects from contacts (accelerator,water,ladder,ground)
|
||||
let gravity=self.base_acceleration(models,style,camera,input_state);
|
||||
let mut move_state=MoveState::Air;
|
||||
let mut a=gravity;
|
||||
for contact in &self.contacts{
|
||||
match models.attr(contact.convex_mesh_id.model_id){
|
||||
PhysicsCollisionAttributes::Contact{contacting,general}=>{
|
||||
let normal=contact_normal(models,hitbox_mesh,contact);
|
||||
match &contacting.contact_behaviour{
|
||||
Some(gameplay_attributes::ContactingBehaviour::Ladder(_))=>if let Some(ladder_settings)=style.ladder{
|
||||
//ladder walkstate
|
||||
let control_dir=style.get_propulsion_control_dir(camera,input_state.controls);
|
||||
let mut target_velocity=ladder_settings.get_ladder_target_velocity(control_dir,normal);
|
||||
self.constrain_velocity(models,hitbox_mesh,&mut target_velocity);
|
||||
let (walk_state,mut acceleration)=ContactMoveState::ladder(body,style,gravity,target_velocity,contact.clone(),&normal);
|
||||
move_state=MoveState::Ladder(walk_state);
|
||||
self.constrain_acceleration(models,hitbox_mesh,&mut acceleration);
|
||||
a=acceleration;
|
||||
},
|
||||
None=>if let Some(walk_settings)=style.walk{
|
||||
//check ground
|
||||
if walk_settings.is_slope_walkable(normal,Planar64Vec3::Y){
|
||||
let control_dir=style.get_y_control_dir(camera,input_state.controls);
|
||||
let mut target_velocity=walk_settings.get_walk_target_velocity(control_dir,normal);
|
||||
self.constrain_velocity(models,hitbox_mesh,&mut target_velocity);
|
||||
let (walk_state,mut acceleration)=ContactMoveState::ground(style,gravity,body,target_velocity,contact.clone(),&normal);
|
||||
move_state=MoveState::Walk(walk_state);
|
||||
self.constrain_acceleration(models,hitbox_mesh,&mut acceleration);
|
||||
a=acceleration;
|
||||
}
|
||||
},
|
||||
_=>(),
|
||||
}
|
||||
},
|
||||
_=>panic!("impossible touching state"),
|
||||
}
|
||||
}
|
||||
for intersect in &self.intersects{
|
||||
//water
|
||||
}
|
||||
self.constrain_acceleration(models,hitbox_mesh,&mut a);
|
||||
(move_state,a)
|
||||
}
|
||||
fn predict_collision_end(&self,collector:&mut instruction::InstructionCollector<PhysicsInstruction>,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,body:&Body,time:Time){
|
||||
let relative_body=VirtualBody::relative(&Body::default(),body).body(time);
|
||||
for contact in &self.contacts{
|
||||
|
Loading…
Reference in New Issue
Block a user