catch invalid mass/inertia instead of division by zero/nan. also, avoid indexing <0

This commit is contained in:
Erwin Coumans
2017-11-07 19:25:14 -08:00
parent 9ce2a1f4b9
commit 344005a8f0
4 changed files with 53 additions and 14 deletions

View File

@@ -118,9 +118,13 @@ static btVector3 convexHullSupport (const btVector3& localDirOrg, const btVector
return supVec;
#else
btScalar maxDot;
long ptIndex = vec.maxDot( points, numPoints, maxDot);
btScalar maxDot;
long ptIndex = vec.maxDot( points, numPoints, maxDot);
btAssert(ptIndex >= 0);
if (ptIndex<0)
{
ptIndex = 0;
}
btVector3 supVec = points[ptIndex] * localScaling;
return supVec;
#endif //__SPU__