PxDefaultSimulationFilterShader#

Defined in include/extensions/PxDefaultSimulationFilterShader.h

PxFilterFlags PxDefaultSimulationFilterShader(
PxFilterObjectAttributes attributes0,
PxFilterData filterData0,
PxFilterObjectAttributes attributes1,
PxFilterData filterData1,
PxPairFlags &pairFlags,
const void *constantBlock,
PxU32 constantBlockSize,
)#

Implementation of a simple filter shader that emulates PhysX 2.8.x filtering.

This shader provides the following logic:

Filter mask logic: Given the two PxFilterData structures fd0 and fd1 of two collision objects, the pair passes the filter if the following conditions are met:
1) Collision groups of the pair are enabled
2) Collision filtering equation is satisfied
Each actor can belong to a single collision group. Use PxSetGroup to set the group of an actor and PxGetGroup to retrieve the group of an actor. A collision group is an integer value between 0 and 31 defining which group the actor belongs to. Because that value is written to an actor’s shapes internally (it is stored in the shapes’ PxFilterData), this feature does not work with shared shapes, unless they all belong to actors whose groups are similar. For example it would not work to share a shape between actors A and B, and then assign A to group 0 and B to group 1, as they would both internally try to write different group values to the same shape.

Once actors are assigned to groups, it is possible to define how groups collide with each-other using the PxSetGroupCollisionFlag function. Use this function to set a simple boolean value per group pairs, defining if the corresponding groups should collide. If not, collisions between actors of these non-colliding groups will be automatically disabled by the PxDefaultSimulationFilterShader.

See also

PxSimulationFilterShader PxGetGroupCollisionFlag PxSetGroupCollisionFlag PxGetGroup PxSetGroup