fixed bug in PolyhedralConvexShape supportmapping, and better description for GJK max iteration exit
This commit is contained in:
@@ -66,9 +66,13 @@ void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(co
|
|||||||
SimdVector3 vtx;
|
SimdVector3 vtx;
|
||||||
SimdScalar newDot;
|
SimdScalar newDot;
|
||||||
|
|
||||||
|
for (int i=0;i<numVectors;i++)
|
||||||
|
{
|
||||||
|
supportVerticesOut[i][3] = -1e30f;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j=0;j<numVectors;j++)
|
for (int j=0;j<numVectors;j++)
|
||||||
{
|
{
|
||||||
SimdScalar maxDot(-1e30f);
|
|
||||||
|
|
||||||
const SimdVector3& vec = vectors[j];
|
const SimdVector3& vec = vectors[j];
|
||||||
|
|
||||||
@@ -76,10 +80,11 @@ void PolyhedralConvexShape::BatchedUnitVectorGetSupportingVertexWithoutMargin(co
|
|||||||
{
|
{
|
||||||
GetVertex(i,vtx);
|
GetVertex(i,vtx);
|
||||||
newDot = vec.dot(vtx);
|
newDot = vec.dot(vtx);
|
||||||
if (newDot > maxDot)
|
if (newDot > supportVerticesOut[j][3])
|
||||||
{
|
{
|
||||||
maxDot = newDot;
|
//WARNING: don't swap next lines, the w component would get overwritten!
|
||||||
supportVerticesOut[i] = vtx;
|
supportVerticesOut[j] = vtx;
|
||||||
|
supportVerticesOut[j][3] = newDot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ int curIter = 0;
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
//rare failure case, perhaps deferate shapes?
|
//degeneracy, this is typically due to invalid/uninitialized worldtransforms for a CollisionObject
|
||||||
if (curIter++ > gGjkMaxIter)
|
if (curIter++ > gGjkMaxIter)
|
||||||
{
|
{
|
||||||
#if defined(DEBUG) || defined (_DEBUG)
|
#if defined(DEBUG) || defined (_DEBUG)
|
||||||
|
|||||||
Reference in New Issue
Block a user