The situation is when there is a manifold in btParallelConstraintSolver.cpp between two bodies, but one of the bodies companionId is still -2 (from btSimulationIslandManager::storeIslandActivationState()).
This results in CustomSetupContactConstraints accessing offsetRigBodies with an index of 0xfffe.
I've narrowed the situation down to a collision between a Dynamic object hitting a Kinematic object, but the Kinematic object is discarded from the island at these two points:
Code: Select all
void btSimulationIslandManager::storeIslandActivationState(btCollisionWorld* colWorld)
{
// put the islandId ('find' value) into m_tag
{
int index = 0;
int i;
for (i=0;i<colWorld->getCollisionObjectArray().size();i++)
{
btCollisionObject* collisionObject= colWorld->getCollisionObjectArray()[i];
if (!collisionObject->isStaticOrKinematicObject())
{
collisionObject->setIslandTag( m_unionFind.find(index) );
//Set the correct object offset in Collision Object Array
m_unionFind.getElement(index).m_sz = i;
collisionObject->setCompanionId(-1);
index++;
} else
{
collisionObject->setIslandTag(-1);
collisionObject->setCompanionId(-2);
}
}
}
}
Code: Select all
void btSimulationIslandManager::updateActivationState(btCollisionWorld* colWorld,btDispatcher* dispatcher)
{
// put the index into m_controllers into m_tag
int index = 0;
{
int i;
for (i=0;i<colWorld->getCollisionObjectArray().size(); i++)
{
btCollisionObject* collisionObject= colWorld->getCollisionObjectArray()[i];
//Adding filtering here
if (!collisionObject->isStaticOrKinematicObject())
{
collisionObject->setIslandTag(index++);
}
collisionObject->setCompanionId(-1);
collisionObject->setHitFraction(btScalar(1.));
}
}
// do the union find
initUnionFind( index );
findUnions(dispatcher,colWorld);
}
These only seem to be used with STATIC_SIMULATION_ISLAND_OPTIMIZATION turned on and as such, turning it off fixes the issue.
Additionally btSequentialImpulseConstraintSolver seems to deal with the situation fine. But from looking through the code, it doesn't appear to rely upon the islands in any way.