Public Member Functions | Protected Member Functions | List of all members
PxSimulationFilterCallback Class Referenceabstract

Filter callback to specify handling of collision pairs. More...

#include <PxFiltering.h>

Public Member Functions

virtual PxFilterFlags pairFound (PxU32 pairID, PxFilterObjectAttributes attributes0, PxFilterData filterData0, const PxActor *a0, const PxShape *s0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, const PxActor *a1, const PxShape *s1, PxPairFlags &pairFlags)=0
 Filter method to specify how a pair of potentially colliding objects should be processed. More...
 
virtual void pairLost (PxU32 pairID, PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, bool objectRemoved)=0
 Callback to inform that a tracked collision pair is gone. More...
 
virtual bool statusChange (PxU32 &pairID, PxPairFlags &pairFlags, PxFilterFlags &filterFlags)=0
 Callback to give the opportunity to change the filter state of a tracked collision pair. More...
 

Protected Member Functions

virtual ~PxSimulationFilterCallback ()
 

Detailed Description

Filter callback to specify handling of collision pairs.

This class is provided to implement more complex and flexible collision pair filtering logic, for instance, taking the state of the user application into account. Filter callbacks also give the user the opportunity to track collision pairs and update their filter state.

You might want to check the documentation on PxSimulationFilterShader as well since it includes more general information on filtering.

Note
SDK state should not be modified from within the callbacks. In particular objects should not be created or destroyed. If state modification is needed then the changes should be stored to a buffer and performed after the simulation step.
The callbacks may execute in user threads or simulation threads, possibly simultaneously. The corresponding objects may have been deleted by the application earlier in the frame. It is the application's responsibility to prevent race conditions arising from using the SDK API in the callback while an application thread is making write calls to the scene, and to ensure that the callbacks are thread-safe. Return values which depend on when the callback is called during the frame will introduce nondeterminism into the simulation. On PS3 use of this callback may compromise simulation performance.
See Also
PxSceneDesc.filterCallback PxSimulationFilterShader

Constructor & Destructor Documentation

virtual PxSimulationFilterCallback::~PxSimulationFilterCallback ( )
inlineprotectedvirtual

Member Function Documentation

virtual PxFilterFlags PxSimulationFilterCallback::pairFound ( PxU32  pairID,
PxFilterObjectAttributes  attributes0,
PxFilterData  filterData0,
const PxActor a0,
const PxShape s0,
PxFilterObjectAttributes  attributes1,
PxFilterData  filterData1,
const PxActor a1,
const PxShape s1,
PxPairFlags pairFlags 
)
pure virtual

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

This method gets called when the filter flags returned by the filter shader (see PxSimulationFilterShader) indicate that the filter callback should be invoked (PxFilterFlag::eCALLBACK or PxFilterFlag::eNOTIFY set). Return the PxFilterFlag flags and set the PxPairFlag flags to define what the simulation should do with the given collision pair.

Parameters
[in]pairIDUnique ID of the collision pair used to issue filter status changes for the pair (see statusChange())
[in]attributes0The filter attribute of the first object
[in]filterData0The custom filter data of the first object
[in]a0Actor pointer of the first object
[in]s0Shape pointer of the first object (NULL if the object has no shapes, for example in the case of a particle system)
[in]attributes1The filter attribute of the second object
[in]filterData1The custom filter data of the second object
[in]a1Actor pointer of the second object
[in]s1Shape pointer of the second object (NULL if the object has no shapes, for example in the case of a particle system)
[in,out]pairFlagsIn: Pair flags returned by the filter shader. Out: Additional information on how an accepted pair should get processed
Returns
Filter flags defining whether the pair should be discarded, temporarily ignored or processed and whether the pair should be tracked and send a report on pair deletion through the filter callback
See Also
PxSimulationFilterShader PxFilterData PxFilterObjectAttributes PxFilterFlag PxPairFlag
virtual void PxSimulationFilterCallback::pairLost ( PxU32  pairID,
PxFilterObjectAttributes  attributes0,
PxFilterData  filterData0,
PxFilterObjectAttributes  attributes1,
PxFilterData  filterData1,
bool  objectRemoved 
)
pure virtual

Callback to inform that a tracked collision pair is gone.

This method gets called when a collision pair disappears or gets re-filtered. Only applies to collision pairs which have been marked as filter callback pairs (PxFilterFlag::eNOTIFY set in pairFound()).

Parameters
[in]pairIDUnique ID of the collision pair that disappeared
[in]attributes0The filter attribute of the first object
[in]filterData0The custom filter data of the first object
[in]attributes1The filter attribute of the second object
[in]filterData1The custom filter data of the second object
[in]objectRemovedTrue if the pair was lost because one of the objects got removed from the scene
See Also
pairFound() PxSimulationFilterShader PxFilterData PxFilterObjectAttributes
virtual bool PxSimulationFilterCallback::statusChange ( PxU32 pairID,
PxPairFlags pairFlags,
PxFilterFlags filterFlags 
)
pure virtual

Callback to give the opportunity to change the filter state of a tracked collision pair.

This method gets called once per simulation step to let the application change the filter and pair flags of a collision pair that has been reported in pairFound() and requested callbacks by setting PxFilterFlag::eNOTIFY. To request a change of filter status, the target pair has to be specified by its ID, the new filter and pair flags have to be provided and the method should return true.

Note
If this method changes the filter status of a collision pair and the pair should keep being tracked by the filter callbacks then PxFilterFlag::eNOTIFY has to be set.
The application is responsible to ensure that this method does not get called for pairs that have been reported as lost, see pairLost().
Parameters
[out]pairIDID of the collision pair for which the filter status should be changed
[out]pairFlagsThe new pairFlags to apply to the collision pair
[out]filterFlagsThe new filterFlags to apply to the collision pair
Returns
True if the changes should be applied. In this case the method will get called again. False if no more status changes should be done in the current simulation step. In that case the provided flags will be discarded.
See Also
pairFound() pairLost() PxFilterFlag PxPairFlag

The documentation for this class was generated from the following file:


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com