If my objects are all dynamic, they collide as expected. If I set some to static, everything passes through the static objects as if they weren’t there (PVD verifies that they are there). I’m using filter masks for the dynamic objects but was only able to get static collisions working by adding a brute-force check in the filter shader.
Here is my filter shader with the brute force check specified. Why do I need to do this for static objects?
// let triggers through
if(PxFilterObjectIsTrigger(attributes0) || PxFilterObjectIsTrigger(attributes1))
{
pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
return PxFilterFlag::eDEFAULT;
}
// generate contacts for all that were not filtered above
pairFlags = PxPairFlag::eCONTACT_DEFAULT;
// BRUTE FORCE CHECK for static object collision. Why is this required?
if( PxGetFilterObjectType(attributes0) == PxFilterObjectType::eRIGID_STATIC || PxGetFilterObjectType(attributes1) == PxFilterObjectType::eRIGID_STATIC )
{
return PxFilterFlags();
}
// trigger the contact callback for pairs (A,B) where
// the filtermask of A contains the ID of B and vice versa.
if((filterData0.word0 & filterData1.word1) && (filterData1.word0 & filterData0.word1))
{
pairFlags |= PxPairFlag::eNOTIFY_TOUCH_FOUND | PxPairFlag::eNOTIFY_CONTACT_POINTS ;
return PxFilterFlags();
}
// If the mask didn't match, then suppress the collision
return PxFilterFlag::eSUPPRESS;