From 804d99e3922a1bb3ec7b8a32140b71186cb50e3d Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Sun, 24 Sep 2006 04:21:11 +0000 Subject: [PATCH] fixed bug in PolyhedralConvexShape supportmapping, and better description for GJK max iteration exit --- Bullet/CollisionShapes/PolyhedralConvexShape.cpp | 15 ++++++++++----- Bullet/NarrowPhaseCollision/GjkPairDetector.cpp | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Bullet/CollisionShapes/PolyhedralConvexShape.cpp b/Bullet/CollisionShapes/PolyhedralConvexShape.cpp index bfdf75014..3aaf7c059 100644 --- a/Bullet/CollisionShapes/PolyhedralConvexShape.cpp +++ b/Bullet/CollisionShapes/PolyhedralConvexShape.cpp @@ -66,20 +66,25 @@ void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(co SimdVector3 vtx; SimdScalar newDot; + for (int i=0;i maxDot) + if (newDot > supportVerticesOut[j][3]) { - maxDot = newDot; - supportVerticesOut[i] = vtx; + //WARNING: don't swap next lines, the w component would get overwritten! + supportVerticesOut[j] = vtx; + supportVerticesOut[j][3] = newDot; } } } diff --git a/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp b/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp index 0887ba719..b6353ff12 100644 --- a/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp +++ b/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp @@ -77,7 +77,7 @@ int curIter = 0; while (true) { - //rare failure case, perhaps deferate shapes? + //degeneracy, this is typically due to invalid/uninitialized worldtransforms for a CollisionObject if (curIter++ > gGjkMaxIter) { #if defined(DEBUG) || defined (_DEBUG)