0

我需要在 PhysX 3.2 中制作一个类似 NULL 的刚体。非碰撞的 - 仅作为锚点。有什么办法吗?我只需要它来解决一些关节组合。提前致谢

4

1 回答 1

2

首先为对创建一个过滤器:

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;
     }

然后,在创建 PxScene 时添加以下行:

PxSceneDesc sceneDesc(gPhysicsSDK->getTolerancesScale());
...
sceneDesc.filterShader = Simplefilter;
gScene = gPhysicsSDK->createScene(sceneDesc);

最后,通过以下方式使您的演员(在我的示例中为 gSphere)的形状不可碰撞:

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);
    }
}  
于 2014-06-27T13:00:24.760 回答