When I perform a ConvexCast, the bodies of m_contacts of the cast calback does not contain the data for the body that is hit.
I then noticed that if I set the bodies in
- Code: Select all
ConvexToConvexContactsContinue()
- Code: Select all
if ((num <= ndFloat32(1.0e-5f)) && (tacc <= timestep))
{
// bodies collide at time tacc, but we do not set it yet
ndVector step(relVeloc.Scale(tacc));
m_timestep = tacc;
closestPoint1 = m_closestPoint1 + step;
m_separatingVector = m_separatingVector * ndVector::m_negOne;
ndFloat32 penetration = ndMax(num * ndFloat32(-1.0f) + D_PENETRATION_TOL, ndFloat32(0.0f));
if (m_contactBuffer && !m_intersectionTestOnly)
{
if (ndInt8(m_instance0.GetCollisionMode()) & ndInt8(m_instance1.GetCollisionMode()))
{
count = CalculateContacts(m_closestPoint0, m_closestPoint1, m_separatingVector);
if (count)
{
count = ndMin(m_maxCount, count);
ndContactPoint* const contactOut = m_contactBuffer;
for (int i = 0; i < count; ++i)
{
contactOut[i].m_point = m_hullDiff[i] + step;
contactOut[i].m_normal = m_separatingVector;
contactOut[i].m_penetration = penetration;
contactOut[i].m_body0 = body0;
contactOut[i].m_body1 = body1;
}
}
}
}
break;
}
I tried verifying this in the demo sandbox, but it seems that you only use the convex cast when placing objects on the floor. When I tried loading the basic stack demo, I get an assert in
- Code: Select all
ndPolygonMeshDesc::ndPolygonMeshDesc()
:ndFastAabb()
,m_boxDistanceTravelInMeshSpace(ndVector::m_zero)
,m_maxT(ndFloat32(1.0f))
,m_threadId(0)
,m_ownTempBuffers(false)
,m_doContinueCollisionTest(false)
{
ndAssert(0);
}
My test is basically a sphere shape cast from the terrain, I then let a cube fall to the terrain and when the ConvexCast returns true I create a ndKinematicController to "catch" the falling cube.