Fix issue with collision detection between convex and concave shape

This commit is contained in:
Daniel Chappuis 2020-06-17 13:18:04 +02:00
parent 0e80d2ff32
commit 3d46add1d2

View File

@ -379,11 +379,13 @@ void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(uint64 pairInde
convexToConcaveTransform = shape2LocalToWorldTransform.getInverse() * shape1LocalToWorldTransform;
}
else { // Collision shape 2 is convex, collision shape 1 is concave
convexShape = static_cast<ConvexShape*>(mCollidersComponents.mCollisionShapes[collider1Index]);
concaveShape = static_cast<ConcaveShape*>(mCollidersComponents.mCollisionShapes[collider2Index]);
convexShape = static_cast<ConvexShape*>(mCollidersComponents.mCollisionShapes[collider2Index]);
concaveShape = static_cast<ConcaveShape*>(mCollidersComponents.mCollisionShapes[collider1Index]);
convexToConcaveTransform = shape1LocalToWorldTransform.getInverse() * shape2LocalToWorldTransform;
}
assert(convexShape->isConvex());
assert(!concaveShape->isConvex());
assert(mOverlappingPairs.mNarrowPhaseAlgorithmType[pairIndex] != NarrowPhaseAlgorithmType::None);
// Compute the convex shape AABB in the local-space of the convex shape