* Given an actor, set its filter layer group * @param actor the rigid actor to add * @param filterGroup which layer to assign the object (use the enum) * @param filterMask a bitmask of which layers the object should collide with */
| 58 | * @param filterMask a bitmask of which layers the object should collide with |
| 59 | */ |
| 60 | void PhysicsSolver::setupFiltering(PxRigidActor* actor, PxU32 filterGroup, PxU32 filterMask) |
| 61 | { |
| 62 | PxFilterData filterData; |
| 63 | filterData.word0 = filterGroup; // word0 = own ID |
| 64 | filterData.word1 = filterMask; // word1 = ID mask to filter pairs that trigger a |
| 65 | // contact callback; |
| 66 | const PxU32 numShapes = actor->getNbShapes(); |
| 67 | //PxShape** shapes = (PxShape**)SAMPLE_ALLOC(sizeof(PxShape*) * numShapes); |
| 68 | PxShape** shapes = new PxShape*[sizeof(PxShape*) * numShapes]; |
| 69 | actor->getShapes(shapes, numShapes); |
| 70 | for (PxU32 i = 0; i < numShapes; i++) |
| 71 | { |
| 72 | PxShape* shape = shapes[i]; |
| 73 | shape->setSimulationFilterData(filterData); |
| 74 | } |
| 75 | delete[] shapes; |
| 76 | //SAMPLE_FREE(shapes); |
| 77 | } |
| 78 | |
| 79 | // Invoked by PhysX after simulation each tick |
| 80 | void PhysicsSolver::onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, physx::PxU32 nbPairs) |
nothing calls this directly
no test coverage detected