PxSimulationFilterShader

Defined in include/PxFiltering.h

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

Filter method to specify how a pair of potentially colliding objects should be processed.

Collision filtering is a mechanism to specify how a pair of potentially colliding objects should be processed by the simulation. A pair of objects is potentially colliding if the bounding volumes of the two objects overlap. In short, a collision filter decides whether a collision pair should get processed, temporarily ignored or discarded. If a collision pair should get processed, the filter can additionally specify how it should get processed, for instance, whether contacts should get resolved, which callbacks should get invoked or which reports should be sent etc. The function returns the PxFilterFlag flags and sets the PxPairFlag flags to define what the simulation should do with the given collision pair.

This methods gets called when:

  • The bounding volumes of two objects start to overlap.

  • The bounding volumes of two objects overlap and the filter data or filter attributes of one of the objects changed

  • A re-filtering was forced through resetFiltering() (see PxScene::resetFiltering())

  • Filtering is requested in scene queries

  • Pair of static rigid actors

  • A static rigid actor and a kinematic actor (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)

  • Two kinematic actors (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)

  • Two jointed rigid bodies and the joint was defined to disable collision

  • Two articulation links if connected through an articulation joint

Note

A default implementation of a filter shader is provided in the PhysX extensions library, see PxDefaultSimulationFilterShader.

Note

Certain pairs of objects are always ignored and this method does not get called. This is the case for the following pairs:

Note

This is a performance critical method and should be stateless. You should neither access external objects from within this method nor should you call external methods that are not inlined. If you need a more complex logic to filter a collision pair then use the filter callback mechanism for this pair (see PxSimulationFilterCallback, PxFilterFlag::eCALLBACK, PxFilterFlag::eNOTIFY).

Param attributes0

[in] The filter attribute of the first object

Param filterData0

[in] The custom filter data of the first object

Param attributes1

[in] The filter attribute of the second object

Param filterData1

[in] The custom filter data of the second object

Param pairFlags

[out] Flags giving additional information on how an accepted pair should get processed

Param constantBlock

[in] The constant global filter data (see PxSceneDesc.filterShaderData)

Param constantBlockSize

[in] Size of the global filter data (see PxSceneDesc.filterShaderDataSize)

Return

Filter flags defining whether the pair should be discarded, temporarily ignored, processed and whether the filter callback should get invoked for this pair.