d'abord créer un filtre pour les paires:
PxFilterFlags Simplefilter(PxFilterObjectAttributes attributes0,
PxFilterData filterData0,
PxFilterObjectAttributes attributes1,
PxFilterData filterData1,
PxPairFlags& pairFlags,
const void* constantBlock,
PxU32 constantBlockSize)
{
if(filterData0.word0 = -99) //-99 is random
{
return PxFilterFlag::eKILL;
}
pairFlags = PxPairFlag::eRESOLVE_CONTACTS;
pairFlags |= PxPairFlag::eCONTACT_DEFAULT;
pairFlags |= PxPairFlag::eNOTIFY_TOUCH_FOUND;
pairFlags |= PxPairFlag::eNOTIFY_CONTACT_POINTS;
return PxFilterFlag::eDEFAULT;
}
Puis, tout en créant la PxScene ajouter cette ligne:
PxSceneDesc sceneDesc(gPhysicsSDK->getTolerancesScale());
...
sceneDesc.filterShader = Simplefilter;
gScene = gPhysicsSDK->createScene(sceneDesc);
Enfin, faire les formes de votre acteur (gSphere dans mon exemple) non collutable par:
unsigned int nbShapes = gSphere->getNbShapes();
PxShape** shapes = new PxShape*[nbShapes];
if(nbShapes > 0)
{
gSphere->getShapes(shapes,nbShapes,0);
for(unsigned int j = 0; j< nbShapes; j++)
{
PxFilterData data;
data.word0 = -99; // the same number above
shapes[j]->setSimulationFilterData(data);
}
}