From b5314040b5a92d01da591d6ef289d30c06b651d0 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Fri, 16 Oct 2015 06:54:25 +0200 Subject: [PATCH] Do not use contact normal choice when there is a single manifold --- src/collision/ContactManifoldSet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/collision/ContactManifoldSet.cpp b/src/collision/ContactManifoldSet.cpp index cfb65e86..def7bf45 100644 --- a/src/collision/ContactManifoldSet.cpp +++ b/src/collision/ContactManifoldSet.cpp @@ -33,7 +33,7 @@ ContactManifoldSet::ContactManifoldSet(ProxyShape* shape1, ProxyShape* shape2, MemoryAllocator& memoryAllocator, int nbMaxManifolds) : mNbMaxManifolds(nbMaxManifolds), mNbManifolds(0), mShape1(shape1), mShape2(shape2), mMemoryAllocator(memoryAllocator) { - + assert(nbMaxManifolds >= 1); } // Destructor @@ -59,7 +59,10 @@ void ContactManifoldSet::addContactPoint(ContactPoint* contact) { } // Select the manifold with the most similar normal (if exists) - int similarManifoldIndex = selectManifoldWithSimilarNormal(normalDirectionId); + int similarManifoldIndex = 0; + if (mNbMaxManifolds > 1) { + similarManifoldIndex = selectManifoldWithSimilarNormal(normalDirectionId); + } // If a similar manifold has been found if (similarManifoldIndex != -1) {