move collision loop avoidance to outside algorithm
This commit is contained in:
parent
6a7e05bb49
commit
680cddc9a2
@ -22,7 +22,7 @@ enum Transition<F,E:DirectedEdge,V>{
|
|||||||
let (n,d)=mesh.face_nd(face_id);
|
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)){
|
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);
|
let t=body.time+Time::from(t);
|
||||||
if time<t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
if time<=t&&t<best_time&&n.dot(body.extrapolated_velocity(t))<Planar64::ZERO{
|
||||||
best_time=t;
|
best_time=t;
|
||||||
best_transtition=Transition::Hit(face_id,t);
|
best_transtition=Transition::Hit(face_id,t);
|
||||||
break;
|
break;
|
||||||
|
@ -1281,7 +1281,10 @@ impl crate::instruction::InstructionEmitter<PhysicsInstruction> for PhysicsState
|
|||||||
//no checks are needed because of the time limits.
|
//no checks are needed because of the time limits.
|
||||||
let model_mesh=self.models.mesh(id);
|
let model_mesh=self.models.mesh(id);
|
||||||
let minkowski=crate::model_physics::MinkowskiMesh::minkowski_sum(&model_mesh,&style_mesh);
|
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){
|
TimedInstruction{time,instruction:PhysicsInstruction::CollisionStart(match self.models.attr(id){
|
||||||
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{model_id:id,face_id:face}),
|
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{model_id:id,face_id:face}),
|
||||||
PhysicsCollisionAttributes::Intersect{intersecting:_,general:_}=>Collision::Intersect(IntersectCollision{model_id:id}),
|
PhysicsCollisionAttributes::Intersect{intersecting:_,general:_}=>Collision::Intersect(IntersectCollision{model_id:id}),
|
||||||
|
Loading…
Reference in New Issue
Block a user