I traced the problem down to the gjk algorithm, specifically the "btGjkPairDetector::getClosestPointsNonVirtual()" function. For some reason, every once in awhile it would say that there was no collision even though the frame before would report that there was a collision and the frame after it would also report that there was a collision and there would be virtually no change in the 3 frames. It looks like the problem has been noticed before though because I have noticed a lot of printf's and debugging lines based around 2d convexes, but I'm not sure.
The problem is further traced down to the simplex solver, when it adds a vertex in line 222 of btGjkPairDetector.cpp, occasionally it would add a w that would be extremely close (but not exactly the same, maybe 0.00001 off) to another vertex that already exists within the simplex solver, which causes the simplex solver to fail when it tries to solve minimum Minkowski difference.
I was able to fix (hack) the problem by modifying btVoronoiSimplexSolver::inSimplex() in btVoronoiSimplexSolver.cpp from
Code: Select all
290>for (i=0;i<numverts;i++)
291>{
292> if (m_simplexVectorW[i]==w)
293> found = true;
294>}
Code: Select all
290>for (i=0;i<numverts;i++)
291>{
292> if ( m_simplexVectorW[i].distance2(w) < 0.0001f )
293> found = true;
294>}