I wrote my own ContactAddedCallback for custom contact solve system.
Already known about partId the parameters those are mean child index of CompoundShape.
Code: Select all
bool ContactAdded(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0, int index0, const btCollisionObject* colObj1, int partId1, int index1)
{
const btCollisionObject* Object0 = ((btCollisionObjectWrapper*)colObj0)->m_collisionObject;
const btCollisionObject* Object1 = ((btCollisionObjectWrapper*)colObj1)->m_collisionObject;
const btCollisionShape* Shape0 = Object0->getCollisionShape();
const btCollisionShape* Shape1 = Object1->getCollisionShape();
if (Shape0->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
{
Shape0 = ((btCompoundShape*)Shape0)->getChildShape(partId0);
}
if (Shape1->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
{
Shape1 = ((btCompoundShape*)Shape1)->getChildShape(partId1);
}
// Some works
return true;
}
Why happened this situation?
And how can I fix it?
Thanks.