Defined in include/PxConstraint.h

Inheritance Relationships

Base Type

class PxConstraint : public PxBase

A plugin class for implementing constraints.

Public Functions

virtual void release() = 0

Releases a PxConstraint instance.


This call does not wake up the connected rigid bodies.

virtual PxScene *getScene() const = 0

Retrieves the scene which this constraint belongs to.

See also



Owner Scene. NULL if not part of a scene.

virtual void getActors(PxRigidActor *&actor0, PxRigidActor *&actor1) const = 0

Retrieves the actors for this constraint.

See also


  • actor0[out] a reference to the pointer for the first actor

  • actor1[out] a reference to the pointer for the second actor

virtual void setActors(PxRigidActor *actor0, PxRigidActor *actor1) = 0

Sets the actors for this constraint.

See also


  • actor0[in] a reference to the pointer for the first actor

  • actor1[in] a reference to the pointer for the second actor

virtual void markDirty() = 0

Notify the scene that the constraint shader data has been updated by the application.

virtual PxConstraintFlags getFlags() const = 0

Retrieve the flags for this constraint.


the constraint flags

virtual void setFlags(PxConstraintFlags flags) = 0

Set the flags for this constraint.

default: PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES


flags[in] the new constraint flags

virtual void setFlag(PxConstraintFlag::Enum flag, bool value) = 0

Set a flag for this constraint.

  • flag[in] the constraint flag

  • value[in] the new value of the flag

virtual void getForce(PxVec3 &linear, PxVec3 &angular) const = 0

Retrieve the constraint force most recently applied to maintain this constraint.


It is not allowed to use this method while the simulation is running (except during PxScene::collide(), in PxContactModifyCallback or in contact report callbacks).

  • linear[out] the constraint force

  • angular[out] the constraint torque

virtual bool isValid() const = 0

whether the constraint is valid.

A constraint is valid if it has at least one dynamic rigid body or articulation link. A constraint that is not valid may not be inserted into a scene, and therefore a static actor to which an invalid constraint is attached may not be inserted into a scene.

Invalid constraints arise only when an actor to which the constraint is attached has been deleted.

virtual void setBreakForce(PxReal linear, PxReal angular) = 0

Set the break force and torque thresholds for this constraint.

If either the force or torque measured at the constraint exceed these thresholds the constraint will break.

  • linear[in] the linear break threshold

  • angular[in] the angular break threshold

virtual void getBreakForce(PxReal &linear, PxReal &angular) const = 0

Retrieve the constraint break force and torque thresholds.

  • linear[out] the linear break threshold

  • angular[out] the angular break threshold

virtual void setMinResponseThreshold(PxReal threshold) = 0

Set the minimum response threshold for a constraint row.

When using mass modification for a joint or infinite inertia for a jointed body, very stiff solver constraints can be generated which can destabilize simulation. Setting this value to a small positive value (e.g. 1e-8) will cause constraint rows to be ignored if very large changes in impulses will generate only small changes in velocity. When setting this value, also set PxConstraintFlag::eDISABLE_PREPROCESSING. The solver accuracy for this joint may be reduced.


threshold[in] the minimum response threshold

virtual PxReal getMinResponseThreshold() const = 0

Retrieve the constraint break force and torque thresholds.


the minimum response threshold for a constraint row

virtual void *getExternalReference(PxU32 &typeID) = 0

Fetch external owner of the constraint.

Provides a reference to the external owner of a constraint and a unique owner type ID.


typeID[out] Unique type identifier of the external object.


Reference to the external object which owns the constraint.

virtual void setConstraintFunctions(PxConstraintConnector &connector, const PxConstraintShaderTable &shaders) = 0

Set the constraint functions for this constraint.

  • connector[in] the constraint connector object by which the SDK communicates with the constraint.

  • shaders[in] the shader table for the constraint

inline virtual const char *getConcreteTypeName() const override

Returns string name of dynamic type.


Class name of most derived type of this object.

template<class T>
inline T *is()
template<class T>
inline const T *is() const
inline PxType getConcreteType() const

Returns concrete type of object.

See also



PxConcreteType::Enum of serialized object

inline void setBaseFlag(PxBaseFlag::Enum flag, bool value)

Set PxBaseFlag

  • flag[in] The flag to be set

  • value[in] The flags new value

inline void setBaseFlags(PxBaseFlags inFlags)

Set PxBaseFlags

See also



inFlags[in] The flags to be set

inline PxBaseFlags getBaseFlags() const

Returns PxBaseFlags.

See also




inline virtual bool isReleasable() const

Whether the object is subordinate.

A class is subordinate, if it can only be instantiated in the context of another class.


Whether the class is subordinate

Public Members

void *userData

user can assign this to whatever, usually to create a 1:1 relationship with a user object.

Protected Functions

inline PxConstraint(PxType concreteType, PxBaseFlags baseFlags)
inline PxConstraint(PxBaseFlags baseFlags)
inline virtual ~PxConstraint()
inline virtual bool isKindOf(const char *name) const override

Returns whether a given type name matches with the type of this instance.

template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount