From 0250d8c4bdaca0c7eaf581e5f85839058d72055c Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Wed, 18 Oct 2017 19:35:20 +0200 Subject: [PATCH] Fix issue in SAT algorithm --- src/collision/narrowphase/SAT/SATAlgorithm.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/collision/narrowphase/SAT/SATAlgorithm.cpp b/src/collision/narrowphase/SAT/SATAlgorithm.cpp index a663791c..4411187b 100644 --- a/src/collision/narrowphase/SAT/SATAlgorithm.cpp +++ b/src/collision/narrowphase/SAT/SATAlgorithm.cpp @@ -731,7 +731,18 @@ bool SATAlgorithm::testCollisionConvexPolyhedronVsConvexPolyhedron(NarrowPhaseIn bool contactsFound = computePolyhedronVsPolyhedronFaceContactPoints(isMinPenetrationFaceNormalPolyhedron1, polyhedron1, polyhedron2, polyhedron1ToPolyhedron2, polyhedron2ToPolyhedron1, minFaceIndex, narrowPhaseInfo, minPenetrationDepth); - assert(contactsFound); + + // There should be clipping points here. If it is not the case, it might be + // because of a numerical issue + if (!contactsFound) { + + lastFrameInfo.satIsAxisFacePolyhedron1 = isMinPenetrationFaceNormalPolyhedron1; + lastFrameInfo.satIsAxisFacePolyhedron2 = !isMinPenetrationFaceNormalPolyhedron1; + lastFrameInfo.satMinAxisFaceIndex = minFaceIndex; + + // Return no collision + return false; + } } lastFrameInfo.satIsAxisFacePolyhedron1 = isMinPenetrationFaceNormalPolyhedron1;