PxContactPair
Defined in include/PxSimulationEventCallback.h
-
struct PxContactPair
Contact report pair information.
Instances of this class are passed to PxSimulationEventCallback.onContact(). If contact reports have been requested for a pair of shapes (see PxPairFlag), then the corresponding contact information will be provided through this structure.
See also
PxSimulationEventCallback.onContact()
Public Functions
-
inline PxContactPair()
-
inline PxU32 extractContacts(PxContactPairPoint *userBuffer, PxU32 bufferSize) const
Extracts the contact points from the stream and stores them in a convenient format.
See also
PxContactPairPoint
- Parameters
userBuffer – [out] Array of PxContactPairPoint structures to extract the contact points to. The number of contacts for a pair is defined by contactCount
bufferSize – [in] Number of PxContactPairPoint structures the provided buffer can store.
- Returns
Number of contact points written to the buffer.
-
inline PxU32 extractFrictionAnchors(PxContactPairFrictionAnchor *userBuffer, PxU32 bufferSize) const
Extracts the friction anchors from the stream and stores them in a convenient format.
See also
PxContactPairFrictionAnchor
- Parameters
userBuffer – [out] Array of PxContactPairFrictionAnchor structures to extract the friction anchors to.
bufferSize – [in] Number of PxContactPairFrictionAnchor structures the provided buffer can store.
- Returns
Number of friction anchors written to the buffer.
-
inline void bufferContacts(PxContactPair *newPair, PxU8 *bufferMemory) const
Helper method to clone the contact pair and copy the contact data stream into a user buffer.
The contact data stream is only accessible during the contact report callback. This helper function provides copy functionality to buffer the contact stream information such that it can get accessed at a later stage.
- Parameters
newPair – [out] The contact pair info will get copied to this instance. The contact data stream pointer of the copy will be redirected to the provided user buffer. Use NULL to skip the contact pair copy operation.
bufferMemory – [out] Memory block to store the contact data stream to. At most requiredBufferSize bytes will get written to the buffer.
Public Members
-
PxShape *shapes[2]
The two shapes that make up the pair.
See also
PxShape
Note
The shape pointers might reference deleted shapes. This will be the case if PxPairFlag::eNOTIFY_TOUCH_LOST or PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST events were requested for the pair and one of the involved shapes gets deleted. Check the flags member to see whether that is the case. Do not dereference a pointer to a deleted shape. The pointer to a deleted shape is only provided such that user data structures which might depend on the pointer value can be updated.
-
const PxU8 *contactPatches
Pointer to first patch header in contact stream containing contact patch data.
This pointer is only valid if contact point information has been requested for the contact report pair (see PxPairFlag::eNOTIFY_CONTACT_POINTS). Use extractContacts() as a reference for the data layout of the stream.
-
const PxU8 *contactPoints
Pointer to first contact point in contact stream containing contact data.
This pointer is only valid if contact point information has been requested for the contact report pair (see PxPairFlag::eNOTIFY_CONTACT_POINTS). Use extractContacts() as a reference for the data layout of the stream.
-
const PxReal *contactImpulses
Buffer containing applied impulse data.
This pointer is only valid if contact point information has been requested for the contact report pair (see PxPairFlag::eNOTIFY_CONTACT_POINTS). Use extractContacts() as a reference for the data layout of the stream.
-
PxContactPairFlags flags
Additional information on the contact report pair.
See also
PxContactPairFlag
-
PxPairFlags events
Flags raised due to the contact.
The events field is a combination of:
PxPairFlag::eNOTIFY_TOUCH_FOUND,
PxPairFlag::eNOTIFY_TOUCH_PERSISTS,
PxPairFlag::eNOTIFY_TOUCH_LOST,
PxPairFlag::eNOTIFY_TOUCH_CCD,
PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND,
PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS,
PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST
See the documentation of PxPairFlag for an explanation of each.
See also
PxPairFlag
Note
eNOTIFY_TOUCH_CCD can get raised even if the pair did not request this event. However, in such a case it will only get raised in combination with one of the other flags to point out that the other event occured during a CCD pass.
-
inline PxContactPair()