fixes in GJK/btGjkEpa2, thanks to Dev0 for reporting and Nathanael for fixing

This commit is contained in:
erwin.coumans
2008-05-25 17:45:13 +00:00
parent 3726af466e
commit 596e94dfd1
2 changed files with 8 additions and 1 deletions

View File

@@ -287,7 +287,7 @@ bool EncloseOrigin()
{ {
btVector3 axis=btVector3(0,0,0); btVector3 axis=btVector3(0,0,0);
axis[i]=1; axis[i]=1;
if(btFabs(dot(axis,d))>0) if(btFabs(dot(axis,d))<1)
{ {
const btVector3 p=cross(d,axis); const btVector3 p=cross(d,axis);
appendvertice(*m_simplex, p); appendvertice(*m_simplex, p);

View File

@@ -144,6 +144,13 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
break; break;
} }
if(m_cachedSeparatingAxis.length2()<REL_ERROR2)
{
m_degenerateSimplex = 6;
checkSimplex = true;
break;
}
btScalar previousSquaredDistance = squaredDistance; btScalar previousSquaredDistance = squaredDistance;
squaredDistance = m_cachedSeparatingAxis.length2(); squaredDistance = m_cachedSeparatingAxis.length2();