Do not generate contact in GJK algorithm if not needed

This commit is contained in:
Daniel Chappuis 2017-08-01 15:57:46 +02:00
parent b6ad69b278
commit 2f60190942
2 changed files with 5 additions and 3 deletions

View File

@ -122,7 +122,6 @@ bool CapsuleVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfo* narrowPh
break; break;
} }
} }
} }
narrowPhaseInfo->overlappingPair->getLastFrameCollisionInfo().wasUsingSAT = false; narrowPhaseInfo->overlappingPair->getLastFrameCollisionInfo().wasUsingSAT = false;

View File

@ -207,8 +207,11 @@ GJKAlgorithm::GJKResult GJKAlgorithm::testCollision(NarrowPhaseInfo* narrowPhase
return GJKResult::INTERPENETRATE; return GJKResult::INTERPENETRATE;
} }
// Add a new contact point if (reportContacts) {
narrowPhaseInfo->addContactPoint(normal, penetrationDepth, pA, pB);
// Add a new contact point
narrowPhaseInfo->addContactPoint(normal, penetrationDepth, pA, pB);
}
return GJKResult::COLLIDE_IN_MARGIN; return GJKResult::COLLIDE_IN_MARGIN;
} }