PxD6Joint

Defined in include/extensions/PxD6Joint.h

class PxD6Joint : public PxJoint

A D6 joint is a general constraint between two actors.

It allows the application to individually define the linear and rotational degrees of freedom, and also to configure a variety of limits and driven degrees of freedom.

By default all degrees of freedom are locked. So to create a prismatic joint with free motion along the x-axis:

...
joint->setMotion(PxD6Axis::eX, PxD6JointMotion::eFREE);
 ...

Or a Revolute joint with motion free allowed around the x-axis:

... 
joint->setMotion(PxD6Axis::eTWIST, PxD6JointMotion::eFREE);
...

Degrees of freedom may also be set to limited instead of locked.

There are two different kinds of linear limits available. The first kind is a single limit value for all linear degrees of freedom, which may act as a linear, circular, or spherical limit depending on which degrees of freedom are limited. This is similar to a distance limit. Then, the second kind supports a pair of limit values for each linear axis, which can be used to implement a traditional prismatic joint for example.

If the twist degree of freedom is limited, is supports upper and lower limits. The two swing degrees of freedom are limited with a cone limit.

See also

PxD6JointCreate() PxJoint

Public Functions

virtual void setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type) = 0

Set the motion type around the specified axis.

Each axis may independently specify that the degree of freedom is locked (blocking relative movement along or around this axis), limited by the corresponding limit, or free.

Default: all degrees of freedom are locked

Parameters
  • axis[in] the axis around which motion is specified

  • type[in] the motion type around the specified axis

virtual PxD6Motion::Enum getMotion(PxD6Axis::Enum axis) const = 0

Get the motion type around the specified axis.

Parameters

axis[in] the degree of freedom around which the motion type is specified

Returns

the motion type around the specified axis

virtual PxReal getTwistAngle() const = 0

get the twist angle of the joint, in the range (-2*Pi, 2*Pi]

inline PxReal getTwist() const

get the twist angle of the joint

Deprecated:

Use getTwistAngle instead. Deprecated since PhysX version 4.0

virtual PxReal getSwingYAngle() const = 0

get the swing angle of the joint from the Y axis

virtual PxReal getSwingZAngle() const = 0

get the swing angle of the joint from the Z axis

virtual void setDistanceLimit(const PxJointLinearLimit &limit) = 0

Set the distance limit for the joint.

A single limit constraints all linear limited degrees of freedom, forming a linear, circular or spherical constraint on motion depending on the number of limited degrees. This is similar to a distance limit.

Parameters

limit[in] the distance limit structure

virtual PxJointLinearLimit getDistanceLimit() const = 0

Get the distance limit for the joint.

Returns

the distance limit structure

inline void setLinearLimit(const PxJointLinearLimit &limit)

Deprecated:

Use setDistanceLimit instead. Deprecated since PhysX version 4.0

inline PxJointLinearLimit getLinearLimit() const

Deprecated:

Use getDistanceLimit instead. Deprecated since PhysX version 4.0

virtual void setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair &limit) = 0

Set the linear limit for a given linear axis.

This function extends the previous setDistanceLimit call with the following features:

  • there can be a different limit for each linear axis

  • each limit is defined by two values, i.e. it can now be asymmetric

This can be used to create prismatic joints similar to PxPrismaticJoint, or point-in-quad joints, or point-in-box joints.

See also

getLinearLimit()

Parameters
virtual PxJointLinearLimitPair getLinearLimit(PxD6Axis::Enum axis) const = 0

Get the linear limit for a given linear axis.

Parameters

axis[in] The limited linear axis (must be PxD6Axis::eX, PxD6Axis::eY or PxD6Axis::eZ)

Returns

the linear limit pair structure from desired axis

virtual void setTwistLimit(const PxJointAngularLimitPair &limit) = 0

Set the twist limit for the joint.

The twist limit controls the range of motion around the twist axis.

The limit angle range is (-2*Pi, 2*Pi).

Parameters

limit[in] the twist limit structure

virtual PxJointAngularLimitPair getTwistLimit() const = 0

Get the twist limit for the joint.

Returns

the twist limit structure

virtual void setSwingLimit(const PxJointLimitCone &limit) = 0

Set the swing cone limit for the joint.

The cone limit is used if either or both swing axes are limited. The extents are symmetrical and measured in the frame of the parent. If only one swing degree of freedom is limited, the corresponding value from the cone limit defines the limit range.

See also

getLimitCone() PxJointLimitCone

Parameters

limit[in] the cone limit structure

virtual PxJointLimitCone getSwingLimit() const = 0

Get the cone limit for the joint.

See also

setLimitCone() PxJointLimitCone

Returns

the swing limit structure

virtual void setPyramidSwingLimit(const PxJointLimitPyramid &limit) = 0

Set a pyramidal swing limit for the joint.

The pyramid limits will only be used in the following cases:

  • both swing Y and Z are limited. The limit shape is then a pyramid.

  • Y is limited and Z is locked, or vice versa. The limit shape is an asymmetric angular section, similar to what is supported for the twist axis. The remaining cases (Y limited and Z is free, or vice versa) are not supported.

See also

getLimitCone() PxJointLimitPyramid

Parameters

limit[in] the cone limit structure

virtual PxJointLimitPyramid getPyramidSwingLimit() const = 0

Get the pyramidal swing limit for the joint.

See also

setLimitCone() PxJointLimitPyramid

Returns

the swing limit structure

virtual void setDrive(PxD6Drive::Enum index, const PxD6JointDrive &drive) = 0

Set the drive parameters for the specified drive type.

Default The default drive spring and damping values are zero, the force limit is zero, and no flags are set.

Parameters
  • index[in] the type of drive being specified

  • drive[in] the drive parameters

virtual PxD6JointDrive getDrive(PxD6Drive::Enum index) const = 0

Get the drive parameters for the specified drive type.

Parameters

index[in] the specified drive type

virtual void setDrivePosition(const PxTransform &pose, bool autowake = true) = 0

Set the drive goal pose.

The goal is relative to the constraint frame of actor[0]

Default the identity transform

Parameters
  • pose[in] The goal drive pose if positional drive is in use.

  • autowake[in] If true and the attached actors are in a scene, this call wakes them up and increases their wake counters to PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value.

virtual PxTransform getDrivePosition() const = 0

Get the drive goal pose.

virtual void setDriveVelocity(const PxVec3 &linear, const PxVec3 &angular, bool autowake = true) = 0

Set the target goal velocity for drive.

The velocity is measured in the constraint frame of actor[0]

Parameters
  • linear[in] The goal velocity for linear drive

  • angular[in] The goal velocity for angular drive

  • autowake[in] If true and the attached actors are in a scene, this call wakes them up and increases their wake counters to PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value.

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

Get the target goal velocity for joint drive.

Parameters
  • linear[in] The goal velocity for linear drive

  • angular[in] The goal velocity for angular drive

inline virtual const char *getConcreteTypeName() const

Returns string name of PxD6Joint, used for serialization.

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

Set the actors for this joint.

An actor may be NULL to indicate the world frame. At most one of the actors may be NULL.

See also

getActors()

Parameters
  • actor0[in] the first actor.

  • actor1[in] the second actor

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

Get the actors for this joint.

See also

setActors()

Parameters
  • actor0[out] the first actor.

  • actor1[out] the second actor

virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform &localPose) = 0

Set the joint local pose for an actor.

This is the relative pose which locates the joint frame relative to the actor.

See also

getLocalPose()

Parameters
  • actor[in] 0 for the first actor, 1 for the second actor.

  • localPose[in] the local pose for the actor this joint

virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0

get the joint local pose for an actor.

return the local pose for this joint

See also

setLocalPose()

Parameters

actor[in] 0 for the first actor, 1 for the second actor.

virtual PxTransform getRelativeTransform() const = 0

get the relative pose for this joint

This function returns the pose of the joint frame of actor1 relative to actor0

virtual PxVec3 getRelativeLinearVelocity() const = 0

get the relative linear velocity of the joint

This function returns the linear velocity of the origin of the constraint frame of actor1, relative to the origin of the constraint frame of actor0. The value is returned in the constraint frame of actor0

virtual PxVec3 getRelativeAngularVelocity() const = 0

get the relative angular velocity of the joint

This function returns the angular velocity of actor1 relative to actor0. The value is returned in the constraint frame of actor0

virtual void setBreakForce(PxReal force, PxReal torque) = 0

set the break force for this joint.

if the constraint force or torque on the joint exceeds the specified values, the joint will break, at which point it will not constrain the two actors and the flag PxConstraintFlag::eBROKEN will be set. The force and torque are measured in the joint frame of the first actor

Parameters
  • force[in] the maximum force the joint can apply before breaking

  • torque[in] the maximum torque the joint can apply before breaking

virtual void getBreakForce(PxReal &force, PxReal &torque) const = 0

get the break force for this joint.

See also

setBreakForce()

Parameters
  • force[out] the maximum force the joint can apply before breaking

  • torque[out] the maximum torque the joint can apply before breaking

virtual void setConstraintFlags(PxConstraintFlags flags) = 0

set the constraint flags for this joint.

See also

PxConstraintFlag

Parameters

flags[in] the constraint flags

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

set a constraint flags for this joint to a specified value.

See also

PxConstraintFlag

Parameters
  • flag[in] the constraint flag

  • value[in] the value to which to set the flag

virtual PxConstraintFlags getConstraintFlags() const = 0

get the constraint flags for this joint.

See also

PxConstraintFlag

Returns

the constraint flags

virtual void setInvMassScale0(PxReal invMassScale) = 0

set the inverse mass scale for actor0.

See also

getInvMassScale0

Parameters

invMassScale[in] the scale to apply to the inverse mass of actor 0 for resolving this constraint

virtual PxReal getInvMassScale0() const = 0

get the inverse mass scale for actor0.

See also

setInvMassScale0

Returns

inverse mass scale for actor0

virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0

set the inverse inertia scale for actor0.

See also

getInvMassScale0

Parameters

invInertiaScale[in] the scale to apply to the inverse inertia of actor0 for resolving this constraint

virtual PxReal getInvInertiaScale0() const = 0

get the inverse inertia scale for actor0.

Returns

inverse inertia scale for actor0

virtual void setInvMassScale1(PxReal invMassScale) = 0

set the inverse mass scale for actor1.

See also

getInvMassScale1

Parameters

invMassScale[in] the scale to apply to the inverse mass of actor 1 for resolving this constraint

virtual PxReal getInvMassScale1() const = 0

get the inverse mass scale for actor1.

See also

setInvMassScale1

Returns

inverse mass scale for actor1

virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0

set the inverse inertia scale for actor1.

Parameters

invInertiaScale[in] the scale to apply to the inverse inertia of actor1 for resolving this constraint

virtual PxReal getInvInertiaScale1() const = 0

get the inverse inertia scale for actor1.

Returns

inverse inertia scale for actor1

virtual PxConstraint *getConstraint() const = 0

Retrieves the PxConstraint corresponding to this joint.

This can be used to determine, among other things, the force applied at the joint.

Returns

the constraint

virtual void setName(const char *name) = 0

Sets a name string for the object that can be retrieved with getName().

This is for debugging and is not used by the SDK. The string is not copied by the SDK, only the pointer is stored.

See also

getName()

Parameters

name[in] String to set the objects name to.

virtual const char *getName() const = 0

Retrieves the name string set with setName().

See also

setName()

Returns

Name string associated with object.

virtual void release() = 0

Deletes the joint.

Note

This call does not wake up the connected rigid bodies.

virtual PxScene *getScene() const = 0

Retrieves the scene which this joint belongs to.

See also

PxScene

Returns

Owner Scene. NULL if not part of a scene.

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

Returns

PxConcreteType::Enum of serialized object

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

Set PxBaseFlag

Parameters
  • flag[in] The flag to be set

  • value[in] The flags new value

inline void setBaseFlags(PxBaseFlags inFlags)

Set PxBaseFlags

See also

PxBaseFlags

Parameters

inFlags[in] The flags to be set

inline PxBaseFlags getBaseFlags() const

Returns PxBaseFlags.

See also

PxBaseFlags

Returns

PxBaseFlags

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.

Returns

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.

Public Static Functions

static void getBinaryMetaData(PxOutputStream &stream)

Put class meta data in stream, used for serialization.

Protected Functions

inline PxD6Joint(PxType concreteType, PxBaseFlags baseFlags)

Constructor.

inline PxD6Joint(PxBaseFlags baseFlags)

Deserialization constructor.

inline virtual bool isKindOf(const char *name) const

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