From 7996df532e3491aa9e9ced9b0b908479c7bcd948 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 6 Aug 2024 14:15:57 -0700 Subject: [PATCH] remove a source of non-determinism --- src/physics.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 07de30db..17c0d8b1 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -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}),