From 680cddc9a20e97910f7fdfa1e96a634e04d382c3 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 28 Nov 2023 22:58:26 -0800 Subject: [PATCH] move collision loop avoidance to outside algorithm --- src/face_crawler.rs | 2 +- src/physics.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/face_crawler.rs b/src/face_crawler.rs index 74440e6..86dee9c 100644 --- a/src/face_crawler.rs +++ b/src/face_crawler.rs @@ -22,7 +22,7 @@ enum Transition{ let (n,d)=mesh.face_nd(face_id); for t in zeroes2((n.dot(body.position)-d)*2,n.dot(body.velocity)*2,n.dot(body.acceleration)){ let t=body.time+Time::from(t); - if time for PhysicsState //no checks are needed because of the time limits. let model_mesh=self.models.mesh(id); let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,&style_mesh); - collector.collect(minkowski.predict_collision_in(&relative_body,collector.time()).map(|(face,time)|{ + collector.collect(minkowski.predict_collision_in(&relative_body,collector.time()) + //temp (?) code to avoid collision loops + .map_or(None,|(face,time)|if time==self.time{None}else{Some((face,time))}) + .map(|(face,time)|{ TimedInstruction{time,instruction:PhysicsInstruction::CollisionStart(match self.models.attr(id){ PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{model_id:id,face_id:face}), PhysicsCollisionAttributes::Intersect{intersecting:_,general:_}=>Collision::Intersect(IntersectCollision{model_id:id}),