An interface class that the user can implement in order to receive simulation events.
More...
#include <PxSimulationEventCallback.h>
An interface class that the user can implement in order to receive simulation events.
The events get sent during the call to either PxScene::fetchResults() or PxScene::flushSimulation() with sendPendingReports=true.
- 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.
Threading: It is not necessary to make this class thread safe as it will only be called in the context of the user thread.
- See Also
- PxScene.setSimulationEventCallback() PxScene.getSimulationEventCallback()
virtual PxSimulationEventCallback::~PxSimulationEventCallback |
( |
| ) |
|
|
inlinevirtual |
virtual void PxSimulationEventCallback::onConstraintBreak |
( |
PxConstraintInfo * |
constraints, |
|
|
PxU32 |
count |
|
) |
| |
|
pure virtual |
This is called when a breakable constraint breaks.
- Note
- The user should not release the constraint shader inside this call!
-
No event will get reported if the constraint breaks but gets deleted while the time step is still being simulated.
- Parameters
-
[in] | constraints | - The constraints which have been broken. |
[in] | count | - The number of constraints |
- See Also
- PxConstraint PxConstraintDesc.linearBreakForce PxConstraintDesc.angularBreakForce
virtual void PxSimulationEventCallback::onSleep |
( |
PxActor ** |
actors, |
|
|
PxU32 |
count |
|
) |
| |
|
pure virtual |
This is called with the actors which have just been put to sleep.
- Note
- Only supported by rigid bodies yet.
-
Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set.
-
Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame will get reported. For example, let us assume actor A is asleep, then A->wakeUp() gets called, then later A->putToSleep() gets called. At the next simulate/fetchResults() step only an onSleep() event will get triggered because that was the last transition (assuming the simulation does not wake the actor up).
-
If an actor gets newly added to a scene with properties such that it is asleep and the sleep state does not get changed by the user or simulation, then an onSleep() event will get sent at the next simulate/fetchResults() step.
- Parameters
-
[in] | actors | - The actors which have just been put to sleep. |
[in] | count | - The number of actors |
- See Also
- PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag()
virtual void PxSimulationEventCallback::onWake |
( |
PxActor ** |
actors, |
|
|
PxU32 |
count |
|
) |
| |
|
pure virtual |
This is called with the actors which have just been woken up.
- Note
- Only supported by rigid bodies yet.
-
Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set.
-
Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame will get reported. For example, let us assume actor A is awake, then A->putToSleep() gets called, then later A->wakeUp() gets called. At the next simulate/fetchResults() step only an onWake() event will get triggered because that was the last transition.
-
If an actor gets newly added to a scene with properties such that it is awake and the sleep state does not get changed by the user or simulation, then an onWake() event will get sent at the next simulate/fetchResults() step.
- Parameters
-
[in] | actors | - The actors which just woke up. |
[in] | count | - The number of actors |
- See Also
- PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag()
The documentation for this class was generated from the following file: