From a103de32d79ef3185ff1f34aaa881031500d09c0 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Tue, 27 Jul 2021 20:44:18 +0200 Subject: [PATCH] Fix issue 192 in CollisionDetectionSystem --- include/reactphysics3d/systems/CollisionDetectionSystem.h | 2 +- src/systems/CollisionDetectionSystem.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/reactphysics3d/systems/CollisionDetectionSystem.h b/include/reactphysics3d/systems/CollisionDetectionSystem.h index 4909aca5..b5b9b825 100644 --- a/include/reactphysics3d/systems/CollisionDetectionSystem.h +++ b/include/reactphysics3d/systems/CollisionDetectionSystem.h @@ -215,7 +215,7 @@ class CollisionDetectionSystem { /// Compute the concave vs convex middle-phase algorithm for a given pair of bodies void computeConvexVsConcaveMiddlePhase(uint64 pairIndex, MemoryAllocator& allocator, - NarrowPhaseInput& narrowPhaseInput); + NarrowPhaseInput& narrowPhaseInput, bool reportContacts); /// Swap the previous and current contacts lists void swapPreviousAndCurrentContacts(); diff --git a/src/systems/CollisionDetectionSystem.cpp b/src/systems/CollisionDetectionSystem.cpp index 924d1457..aebdab93 100644 --- a/src/systems/CollisionDetectionSystem.cpp +++ b/src/systems/CollisionDetectionSystem.cpp @@ -288,7 +288,7 @@ void CollisionDetectionSystem::computeMiddlePhase(NarrowPhaseInput& narrowPhaseI // Check that at least one body is enabled (active and awake) and not static if (mOverlappingPairs.mIsActive[i]) { - computeConvexVsConcaveMiddlePhase(i, mMemoryManager.getSingleFrameAllocator(), narrowPhaseInput); + computeConvexVsConcaveMiddlePhase(i, mMemoryManager.getSingleFrameAllocator(), narrowPhaseInput, needToReportContacts); mOverlappingPairs.mCollidingInCurrentFrame[i] = false; } @@ -349,12 +349,12 @@ void CollisionDetectionSystem::computeMiddlePhaseCollisionSnapshot(List& assert(mCollidersComponents.getBroadPhaseId(mOverlappingPairs.mColliders2[pairIndex]) != -1); assert(mCollidersComponents.getBroadPhaseId(mOverlappingPairs.mColliders1[pairIndex]) != mCollidersComponents.getBroadPhaseId(mOverlappingPairs.mColliders2[pairIndex])); - computeConvexVsConcaveMiddlePhase(pairIndex, mMemoryManager.getSingleFrameAllocator(), narrowPhaseInput); + computeConvexVsConcaveMiddlePhase(pairIndex, mMemoryManager.getSingleFrameAllocator(), narrowPhaseInput, reportContacts); } } // Compute the concave vs convex middle-phase algorithm for a given pair of bodies -void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(uint64 pairIndex, MemoryAllocator& allocator, NarrowPhaseInput& narrowPhaseInput) { +void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(uint64 pairIndex, MemoryAllocator& allocator, NarrowPhaseInput& narrowPhaseInput, bool reportContacts) { RP3D_PROFILE("CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase()", mProfiler); @@ -405,7 +405,7 @@ void CollisionDetectionSystem::computeConvexVsConcaveMiddlePhase(uint64 pairInde const bool isCollider1Trigger = mCollidersComponents.mIsTrigger[collider1Index]; const bool isCollider2Trigger = mCollidersComponents.mIsTrigger[collider2Index]; - const bool reportContacts = !isCollider1Trigger && !isCollider2Trigger; + reportContacts = reportContacts && !isCollider1Trigger && !isCollider2Trigger; // For each overlapping triangle for (uint i=0; i < shapeIds.size(); i++)