PxContactSet

Defined in include/PxContactModifyCallback.h

class PxContactSet

An array of contact points, as passed to contact modification.

The word ‘set’ in the name does not imply that duplicates are filtered in any way. This initial set of contacts does potentially get reduced to a smaller set before being passed to the solver.

You can use the accessors to read and write contact properties. The number of contacts is immutable, other than being able to disable contacts using ignore().

Public Functions

inline const PxVec3 &getPoint(PxU32 i) const

Get the position of a specific contact point in the set.

See also

PxModifiableContact.point

Parameters

i[in] Index of the point in the set

Returns

Position to the requested point in world space

inline void setPoint(PxU32 i, const PxVec3 &p)

Alter the position of a specific contact point in the set.

See also

PxModifiableContact.point

Parameters
  • i[in] Index of the point in the set

  • p[in] The new position in world space

inline const PxVec3 &getNormal(PxU32 i) const

Get the contact normal of a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The requested normal in world space

inline void setNormal(PxU32 i, const PxVec3 &n)

Alter the contact normal of a specific contact point in the set.

Note

Changing the normal can cause contact points to be ignored.

Parameters
  • i[in] Index of the point in the set

  • n[in] The new normal in world space

inline PxReal getSeparation(PxU32 i) const

Get the separation distance of a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The separation. Negative implies penetration.

inline void setSeparation(PxU32 i, PxReal s)

Alter the separation of a specific contact point in the set.

Parameters
  • i[in] Index of the point in the set

  • s[in] The new separation

inline const PxVec3 &getTargetVelocity(PxU32 i) const

Get the target velocity of a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The target velocity in world frame

inline void setTargetVelocity(PxU32 i, const PxVec3 &v)

Alter the target velocity of a specific contact point in the set.

Parameters
  • i[in] Index of the point in the set

  • v[in] The new velocity in world frame

inline PxU32 getInternalFaceIndex0(PxU32 i) const

Get the face index with respect to the first shape of the pair for a specific contact point in the set.

See also

PxModifiableContact.internalFaceIndex0

Note

At the moment, the first shape is never a tri-mesh, therefore this function always returns PXC_CONTACT_NO_FACE_INDEX

Parameters

i[in] Index of the point in the set

Returns

The face index of the first shape

inline PxU32 getInternalFaceIndex1(PxU32 i) const

Get the face index with respect to the second shape of the pair for a specific contact point in the set.

See also

PxModifiableContact.internalFaceIndex1

Parameters

i[in] Index of the point in the set

Returns

The face index of the second shape

inline PxReal getMaxImpulse(PxU32 i) const

Get the maximum impulse for a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The maximum impulse

inline void setMaxImpulse(PxU32 i, PxReal s)

Alter the maximum impulse for a specific contact point in the set.

Note

Must be nonnegative. If set to zero, the contact point will be ignored

Parameters
  • i[in] Index of the point in the set

  • s[in] The new maximum impulse

inline PxReal getRestitution(PxU32 i) const

Get the restitution coefficient for a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The restitution coefficient

inline void setRestitution(PxU32 i, PxReal r)

Alter the restitution coefficient for a specific contact point in the set.

Note

Valid ranges [0,1]

Parameters
  • i[in] Index of the point in the set

  • r[in] The new restitution coefficient

inline PxReal getStaticFriction(PxU32 i) const

Get the static friction coefficient for a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The friction coefficient (dimensionless)

inline void setStaticFriction(PxU32 i, PxReal f)

Alter the static friction coefficient for a specific contact point in the set.

Parameters
  • i[in] Index of the point in the set

  • f[in] The new friction coefficient (dimensionless), range [0, inf]

inline PxReal getDynamicFriction(PxU32 i) const

Get the static friction coefficient for a specific contact point in the set.

Parameters

i[in] Index of the point in the set

Returns

The friction coefficient

inline void setDynamicFriction(PxU32 i, PxReal f)

Alter the static dynamic coefficient for a specific contact point in the set.

Parameters
  • i[in] Index of the point in the set

  • f[in] The new friction coefficient

inline void ignore(PxU32 i)

Ignore the contact point.

If a contact point is ignored then no force will get applied at this point. This can be used to disable collision in certain areas of a shape, for example.

Parameters

i[in] Index of the point in the set

inline PxU32 size() const

The number of contact points in the set.

inline PxReal getInvMassScale0() const

Returns the invMassScale of body 0.

A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass.

inline PxReal getInvMassScale1() const

Returns the invMassScale of body 1.

A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass.

inline PxReal getInvInertiaScale0() const

Returns the invInertiaScale of body 0.

A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia.

inline PxReal getInvInertiaScale1() const

Returns the invInertiaScale of body 1.

A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia.

inline void setInvMassScale0(const PxReal scale)

Sets the invMassScale of body 0.

This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass.

Parameters

scale[in] The new scale

inline void setInvMassScale1(const PxReal scale)

Sets the invMassScale of body 1.

This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass.

Parameters

scale[in] The new scale

inline void setInvInertiaScale0(const PxReal scale)

Sets the invInertiaScale of body 0.

This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia.

Parameters

scale[in] The new scale

inline void setInvInertiaScale1(const PxReal scale)

Sets the invInertiaScale of body 1.

This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia.

Parameters

scale[in] The new scale

Protected Functions

inline PxContactPatch *getPatch() const

Protected Attributes

PxU32 mCount

Number of contact points in the set.

PxModifiableContact *mContacts

The contact points of the set.