remove a source of non-determinism

This commit is contained in:
Quaternions 2024-08-06 14:15:57 -07:00
parent b4b85b7da4
commit 7996df532e

View File

@ -1124,15 +1124,16 @@ impl PhysicsContext{
let mut aabb=aabb::Aabb::default();
state.body.grow_aabb(&mut aabb,state.time,collector.time());
aabb.inflate(data.hitbox_mesh.halfsize);
//common body
let relative_body=VirtualBody::relative(&Body::default(),&state.body).body(state.time);
//relative to moving platforms
//let relative_body=&VirtualBody::relative(&Body::default(),&state.body).body(state.time);
let relative_body=&state.body;
data.bvh.the_tester(&aabb,&mut |&convex_mesh_id|{
//no checks are needed because of the time limits.
let model_mesh=data.models.mesh(convex_mesh_id);
let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,data.hitbox_mesh.transformed_mesh());
collector.collect(minkowski.predict_collision_in(&relative_body,collector.time())
collector.collect(minkowski.predict_collision_in(relative_body,collector.time())
//temp (?) code to avoid collision loops
.map_or(None,|(face,time)|if time==state.time{None}else{Some((face,time))})
.map_or(None,|(face,time)|if time<=state.time{None}else{Some((face,time))})
.map(|(face,time)|{
TimedInstruction{time,instruction:PhysicsInternalInstruction::CollisionStart(match data.models.attr(convex_mesh_id.model_id){
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{convex_mesh_id,face_id:face}),