Defined in include/PxContactModifyCallback.h

class PxContactModifyCallback

An interface class that the user can implement in order to modify contact constraints.

Threading: It is necessary to make this class thread safe as it will be called in the context of the simulation thread. It might also be necessary to make it reentrant, since some calls can be made by multi-threaded parts of the physics engine.

You can enable the use of this contact modification callback by raising the flag PxPairFlag::eMODIFY_CONTACTS in the filter shader/callback (see PxSimulationFilterShader) for a pair of rigid body objects.

Please note:

  • Raising the contact modification flag will not wake the actors up automatically.

  • It is not possible to turn off the performance degradation by simply removing the callback from the scene, the filter shader/callback has to be used to clear the contact modification flag.

  • The contacts will only be reported as long as the actors are awake. There will be no callbacks while the actors are sleeping.

Public Functions

virtual void onContactModify(PxContactModifyPair *const pairs, PxU32 count) = 0

Passes modifiable arrays of contacts to the application.

The initial contacts are regenerated from scratch each frame by collision detection.

The number of contacts can not be changed, so you cannot add your own contacts. You may however disable contacts using PxContactSet::ignore().

  • pairs[inout] The contact pairs that may be modified

  • count[in] Number of contact pairs

Protected Functions

inline virtual ~PxContactModifyCallback()