From 95ade79af5d6e8ceb9427ff5d15fe49678cda7a3 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Mon, 4 Sep 2017 21:23:07 +0200 Subject: [PATCH] Fix issue with obsolete contact points that were not removed --- src/collision/CollisionDetection.cpp | 14 +++----------- src/collision/CollisionDetection.h | 3 --- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/collision/CollisionDetection.cpp b/src/collision/CollisionDetection.cpp index 3c4b771b..3f9a45f6 100644 --- a/src/collision/CollisionDetection.cpp +++ b/src/collision/CollisionDetection.cpp @@ -97,9 +97,6 @@ void CollisionDetection::computeMiddlePhase() { PROFILE("CollisionDetection::computeMiddlePhase()"); - // Clear the set of overlapping pairs in narrow-phase contact - mContactOverlappingPairs.clear(); - // For each possible collision pair of bodies map::iterator it; for (it = mOverlappingPairs.begin(); it != mOverlappingPairs.end(); ) { @@ -258,11 +255,6 @@ void CollisionDetection::computeNarrowPhase() { // Add the contact points as a potential contact manifold into the pair currentNarrowPhaseInfo->addContactPointsAsPotentialContactManifold(); - // Add the overlapping pair into the set of pairs in contact during narrow-phase - overlappingpairid pairId = OverlappingPair::computeID(currentNarrowPhaseInfo->overlappingPair->getShape1(), - currentNarrowPhaseInfo->overlappingPair->getShape2()); - mContactOverlappingPairs[pairId] = currentNarrowPhaseInfo->overlappingPair; - currentNarrowPhaseInfo->overlappingPair->getLastFrameCollisionInfo().wasColliding = true; } else { @@ -349,7 +341,7 @@ void CollisionDetection::addAllContactManifoldsToBodies() { // For each overlapping pairs in contact during the narrow-phase std::map::iterator it; - for (it = mContactOverlappingPairs.begin(); it != mContactOverlappingPairs.end(); ++it) { + for (it = mOverlappingPairs.begin(); it != mOverlappingPairs.end(); ++it) { // Add all the contact manifolds of the pair into the list of contact manifolds // of the two bodies involved in the contact @@ -396,7 +388,7 @@ void CollisionDetection::processAllPotentialContacts() { // For each overlapping pairs in contact during the narrow-phase std::map::iterator it; - for (it = mContactOverlappingPairs.begin(); it != mContactOverlappingPairs.end(); ++it) { + for (it = mOverlappingPairs.begin(); it != mOverlappingPairs.end(); ++it) { // Process the potential contacts of the overlapping pair processPotentialContacts(it->second); @@ -430,7 +422,7 @@ void CollisionDetection::reportAllContacts() { // For each overlapping pairs in contact during the narrow-phase std::map::iterator it; - for (it = mContactOverlappingPairs.begin(); it != mContactOverlappingPairs.end(); ++it) { + for (it = mOverlappingPairs.begin(); it != mOverlappingPairs.end(); ++it) { // If there is a user callback if (mWorld->mEventListener != nullptr && it->second->hasContacts()) { diff --git a/src/collision/CollisionDetection.h b/src/collision/CollisionDetection.h index 49f0d56b..848e7d09 100644 --- a/src/collision/CollisionDetection.h +++ b/src/collision/CollisionDetection.h @@ -86,9 +86,6 @@ class CollisionDetection { /// Broad-phase overlapping pairs std::map mOverlappingPairs; - /// Overlapping pairs in contact (during the current Narrow-phase collision detection) - std::map mContactOverlappingPairs; - /// Broad-phase algorithm BroadPhaseAlgorithm mBroadPhaseAlgorithm;