Fix issue with zero penetration depth in Sphere vs Capsule collision

This commit is contained in:
Daniel Chappuis 2018-01-15 18:34:20 +01:00
parent 584b28a91c
commit b93e358f5b

View File

@ -121,6 +121,10 @@ bool SphereVsCapsuleAlgorithm::testCollision(NarrowPhaseInfo* narrowPhaseInfo, b
contactPointCapsuleLocal = sphereCenter - normalCapsuleSpace * capsuleShape->getRadius();
}
if (penetrationDepth <= decimal(0.0)) {
return false;
}
// Create the contact info object
narrowPhaseInfo->addContactPoint(normalWorld, penetrationDepth,
isSphereShape1 ? contactPointSphereLocal : contactPointCapsuleLocal,