- Code: Select all
dMatrix offsetMatrix (dGetIdentityMatrix());
offsetMatrix.m_front = dVector(0.0f, 1.0f, 0.0f, 0.0f);
offsetMatrix.m_up = dVector(-1.0f, 0.0f, 0.0f, 0.0f);
offsetMatrix.m_right = dVector(0.0f, 0.0f, 1.0f, 0.0f);
offsetMatrix.m_posit = dVector(0.0f, 0.1f, 0.0f, 1.0f);
dVector cylSize(0.8f, 0.2f, 0.0f, 0.0f);
NewtonCollision* const chamferCylinderCollision = CreateConvexCollision(world, offsetMatrix, cylSize, _CHAMFER_CYLINDER_PRIMITIVE, 0);
NewtonCollision* const chamferCylinderCollision2 = CreateConvexCollision(world, offsetMatrix, cylSize, _CHAMFER_CYLINDER_PRIMITIVE, 0);
dMatrix mtxC(0.0f, 3.141592f * -0.5f, 0.0f, dVector(9.40291786f, 2.99999571f, -4.01828432f));
dMatrix mtxD(0.0f, 3.141592f * -0.5f, 0.0f, dVector(9.25f, 3.00000072, -4.375f));
int result = NewtonCollisionIntersectionTest(world, chamferCylinderCollision, &mtxC[0][0], chamferCylinderCollision2, &mtxD[0][0], 0);
Running the above code results in an assert in dgContactSolver::CalculateIntersectingPlane(). I don't quite understand the code, but I'm guessing that it can't find some separating planes. That makes sense because the shapes are overlapping, but I'm not sure about the reason for the assert.
Once that call fails, dgContactSolver::CalculateClosestPoints() won't calculate m_closestPoint0 and m_closestPoint1 since there are no simplexPoints. Again, I think that makes sense. But then, dgContactSolver::CalculateConvexToConvexContacts() tries to calculate a penetration amount from m_closestPoint0 and m_closestPoint0. But these haven't been set to anything. They're just at their initial values. In an older version of code I'm using, it appears that these values aren't initialized, so I'm getting random results. In the current code, they appear to be initialized, but I don't see where that is happening.
Does any of that make sense? Are there some bug fixes I should integrate? Is there a better alternative way for me to check for overlap of bodies besides NewtonCollisionIntersectionTest? Thanks.