I'm including this little trick for anybody to use. Hopefully it helps someone.
Code: Select all
void contactPairTestForced (btCollisionObject* colObjA , btCollisionObject* colObjB , btCollisionWorld::ContactResultCallback& callback)
{
// We set the bodies to ACTIVE so the collision algorithim doesn't care that they are static/kinematic.
auto colObjA_activation_state = colObjA->getActivationState ();
auto colObjB_activation_state = colObjB->getActivationState ();
colObjA->setActivationState (ACTIVE_TAG);
colObjB->setActivationState (ACTIVE_TAG);
dynamicsWorld->contactPairTest (colObjA , colObjB , callback); // If anybody uses this function, just rename dynamicsWorld to whatever yours is.
colObjB->setActivationState (colObjB_activation_state);
colObjA->setActivationState (colObjA_activation_state);
// After testing the pair, we revert the bodies to their previous activation state.
}