forked from StrafesNET/strafe-project
physics: recalculate acceleration in collision_{start|end}_intersect
This commit is contained in:
@@ -1193,7 +1193,7 @@ fn recalculate_touching(
|
||||
collision_end_contact(move_state,body,touching,models,hitbox_mesh,style,camera,input_state,models.contact_attr(contact.model_id),contact)
|
||||
}
|
||||
while let Some(&intersect)=touching.intersects.iter().next(){
|
||||
collision_end_intersect(touching,mode,run,models.intersect_attr(intersect.model_id),intersect,time);
|
||||
collision_end_intersect(move_state,body,touching,models,hitbox_mesh,style,camera,input_state,mode,run,models.intersect_attr(intersect.model_id),intersect,time);
|
||||
}
|
||||
//find all models in the teleport region
|
||||
let mut aabb=aabb::Aabb::default();
|
||||
@@ -1605,6 +1605,7 @@ fn collision_start_intersect(
|
||||
None=>(),
|
||||
}
|
||||
}
|
||||
move_state.apply_enum_and_body(body,touching,models,hitbox_mesh,style,camera,input_state);
|
||||
run_teleport_behaviour(intersect.model_id.into(),attr.general.wormhole.as_ref(),mode,move_state,body,touching,run,mode_state,models,hitbox_mesh,bvh,style,camera,input_state,time);
|
||||
}
|
||||
|
||||
@@ -1637,7 +1638,14 @@ fn collision_end_contact(
|
||||
}
|
||||
}
|
||||
fn collision_end_intersect(
|
||||
move_state:&mut MoveState,
|
||||
body:&mut Body,
|
||||
touching:&mut TouchingState,
|
||||
models:&PhysicsModels,
|
||||
hitbox_mesh:&HitboxMesh,
|
||||
style:&StyleModifiers,
|
||||
camera:&PhysicsCamera,
|
||||
input_state:&InputState,
|
||||
mode:Option<&gameplay_modes::Mode>,
|
||||
run:&mut run::Run,
|
||||
_attr:&gameplay_attributes::IntersectAttributes,
|
||||
@@ -1645,6 +1653,7 @@ fn collision_end_intersect(
|
||||
time:Time,
|
||||
){
|
||||
touching.remove(&Collision::Intersect(intersect));
|
||||
move_state.apply_enum_and_body(body,touching,models,hitbox_mesh,style,camera,input_state);
|
||||
if let Some(mode)=mode{
|
||||
let zone=mode.get_zone(intersect.model_id.into());
|
||||
match zone{
|
||||
@@ -1701,7 +1710,7 @@ fn atomic_internal_instruction(state:&mut PhysicsState,data:&PhysicsData,ins:Tim
|
||||
contact
|
||||
),
|
||||
Collision::Intersect(intersect)=>collision_end_intersect(
|
||||
&mut state.touching,
|
||||
&mut state.move_state,&mut state.body,&mut state.touching,&data.models,&data.hitbox_mesh,&state.style,&state.camera,&state.input_state,
|
||||
data.modes.get_mode(state.mode_state.get_mode_id()),
|
||||
&mut state.run,
|
||||
data.models.intersect_attr(intersect.model_id),
|
||||
|
||||
Reference in New Issue
Block a user