PxRigidDynamic

Defined in include/PxRigidDynamic.h

Inheritance Relationships

Base Type

class PxRigidDynamic : public PxRigidBody

PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.

Creation

Instances of this class are created by calling PxPhysics::createRigidDynamic() and deleted with release().

Visualizations

Global Pose Manipulation

virtual PxTransform getGlobalPose() const = 0

Retrieves the actors world space transform.

The getGlobalPose() method retrieves the actor’s current actor space to world space transformation.

Note

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

Returns

Global pose of object.

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

Method for setting an actor’s pose in the world.

This method instantaneously changes the actor space to world space transformation.

This method is mainly for dynamic rigid bodies (see PxRigidDynamic). Calling this method on static actors is likely to result in a performance penalty, since internal optimization structures for static actors may need to be recomputed. In addition, moving static actors will not interact correctly with dynamic actors or joints.

To directly control an actor’s position and have it correctly interact with dynamic bodies and joints, create a dynamic body with the PxRigidBodyFlag::eKINEMATIC flag, then use the setKinematicTarget() commands to define its path.

Even when moving dynamic actors, exercise restraint in making use of this method. Where possible, avoid:

  • moving actors into other actors, thus causing overlap (an invalid physical state)

  • moving an actor that is connected by a joint to another away from the other (thus causing joint error)

Sleeping: This call wakes dynamic actors if they are sleeping and the autowake parameter is true (default).

See also

getGlobalPose()

Parameters
  • pose[in] Transformation from the actors local frame to the global frame. Range: rigid body transform.

  • autowake[in] whether to wake the object if it is dynamic. This parameter has no effect for static or kinematic actors. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

Shapes

virtual bool attachShape(PxShape &shape) = 0

Attach a shape to an actor.

This call will increment the reference count of the shape.

Attaching a triangle mesh, heightfield or plane geometry shape configured as eSIMULATION_SHAPE is not supported for non-kinematic PxRigidDynamic instances.

Sleeping: Does NOT wake the actor up automatically.

Note

Mass properties of dynamic rigid actors will not automatically be recomputed to reflect the new mass distribution implied by the shape. Follow this call with a call to the PhysX extensions method PxRigidBodyExt::updateMassAndInertia() to do that.

Parameters

shape[in] the shape to attach.

Returns

True if success.

virtual void detachShape(PxShape &shape, bool wakeOnLostTouch = true) = 0

Detach a shape from an actor.

This will also decrement the reference count of the PxShape, and if the reference count is zero, will cause it to be deleted.

Sleeping: Does NOT wake the actor up automatically.

Parameters
  • shape[in] the shape to detach.

  • wakeOnLostTouch[in] Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types.

virtual PxU32 getNbShapes() const = 0

Returns the number of shapes assigned to the actor.

You can use getShapes() to retrieve the shape pointers.

See also

PxShape getShapes()

Returns

Number of shapes associated with this actor.

virtual PxU32 getShapes(PxShape **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Retrieve all the shape pointers belonging to the actor.

These are the shapes used by the actor for collision detection.

You can retrieve the number of shape pointers by calling getNbShapes()

Note: Removing shapes with PxShape::release() will invalidate the pointer of the released shape.

Parameters
  • userBuffer[out] The buffer to store the shape pointers.

  • bufferSize[in] Size of provided user buffer.

  • startIndex[in] Index of first shape pointer to be retrieved

Returns

Number of shape pointers written to the buffer.

Constraints

virtual PxU32 getNbConstraints() const = 0

Returns the number of constraint shaders attached to the actor.

You can use getConstraints() to retrieve the constraint shader pointers.

Returns

Number of constraint shaders attached to this actor.

virtual PxU32 getConstraints(PxConstraint **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Retrieve all the constraint shader pointers belonging to the actor.

You can retrieve the number of constraint shader pointers by calling getNbConstraints()

Note: Removing constraint shaders with PxConstraint::release() will invalidate the pointer of the released constraint.

Parameters
  • userBuffer[out] The buffer to store the constraint shader pointers.

  • bufferSize[in] Size of provided user buffer.

  • startIndex[in] Index of first constraint pointer to be retrieved

Returns

Number of constraint shader pointers written to the buffer.

Mass Manipulation

virtual void setCMassLocalPose(const PxTransform &pose) = 0

Sets the pose of the center of mass relative to the actor.

Default: the identity transform

See also

getCMassLocalPose() PxRigidBodyDesc.massLocalPose

Note

Changing this transform will not move the actor in the world!

Note

Setting an unrealistic center of mass which is a long way from the body can make it difficult for the SDK to solve constraints. Perhaps leading to instability and jittering bodies.

Parameters

pose[in] Mass frame offset transform relative to the actor frame. Range: rigid body transform.

virtual PxTransform getCMassLocalPose() const = 0

Retrieves the center of mass pose relative to the actor frame.

See also

setCMassLocalPose() PxRigidBodyDesc.massLocalPose

Returns

The center of mass pose relative to the actor frame.

virtual void setMass(PxReal mass) = 0

Sets the mass of a dynamic actor.

The mass must be non-negative.

setMass() does not update the inertial properties of the body, to change the inertia tensor use setMassSpaceInertiaTensor() or the PhysX extensions method PxRigidBodyExt::updateMassAndInertia().

Default: 1.0

Sleeping: Does NOT wake the actor up automatically.

See also

getMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor()

Note

A value of 0 is interpreted as infinite mass.

Note

Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic.

Parameters

mass[in] New mass value for the actor. Range: [0, PX_MAX_F32)

virtual PxReal getMass() const = 0

Retrieves the mass of the actor.

See also

setMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor()

Note

A value of 0 is interpreted as infinite mass.

Returns

The mass of this actor.

virtual PxReal getInvMass() const = 0

Retrieves the inverse mass of the actor.

See also

setMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor()

Returns

The inverse mass of this actor.

virtual void setMassSpaceInertiaTensor(const PxVec3 &m) = 0

Sets the inertia tensor, using a parameter specified in mass space coordinates.

Note that such matrices are diagonal — the passed vector is the diagonal.

If you have a non diagonal world/actor space inertia tensor(3x3 matrix). Then you need to diagonalize it and set an appropriate mass space transform. See setCMassLocalPose().

The inertia tensor elements must be non-negative.

Default: (1.0, 1.0, 1.0)

Sleeping: Does NOT wake the actor up automatically.

See also

PxRigidBodyDesc.massSpaceInertia getMassSpaceInertia() setMass() setCMassLocalPose()

Note

A value of 0 in an element is interpreted as infinite inertia along that axis.

Note

Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic.

Parameters

m[in] New mass space inertia tensor for the actor.

virtual PxVec3 getMassSpaceInertiaTensor() const = 0

Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame.

This method retrieves a mass frame inertia vector.

See also

PxRigidBodyDesc.massSpaceInertia setMassSpaceInertiaTensor() setMass() setCMassLocalPose()

Note

A value of 0 in an element is interpreted as infinite inertia along that axis.

Returns

The mass space inertia tensor of this actor.

virtual PxVec3 getMassSpaceInvInertiaTensor() const = 0

Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame.

This method retrieves a mass frame inverse inertia vector.

See also

PxRigidBodyDesc.massSpaceInertia setMassSpaceInertiaTensor() setMass() setCMassLocalPose()

Note

A value of 0 in an element is interpreted as infinite inertia along that axis.

Returns

The mass space inverse inertia tensor of this actor.

Damping

virtual void setLinearDamping(PxReal linDamp) = 0

Sets the linear damping coefficient.

Zero represents no damping. The damping coefficient must be nonnegative.

Default: 0.0

Parameters

linDamp[in] Linear damping coefficient. Range: [0, PX_MAX_F32)

virtual PxReal getLinearDamping() const = 0

Retrieves the linear damping coefficient.

Returns

The linear damping coefficient associated with this actor.

virtual void setAngularDamping(PxReal angDamp) = 0

Sets the angular damping coefficient.

Zero represents no damping.

The angular damping coefficient must be nonnegative.

Default: 0.05

Parameters

angDamp[in] Angular damping coefficient. Range: [0, PX_MAX_F32)

virtual PxReal getAngularDamping() const = 0

Retrieves the angular damping coefficient.

Returns

The angular damping coefficient associated with this actor.

Velocity

virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0

Lets you set the maximum linear velocity permitted for this actor.

With this function, you can set the maximum linear velocity permitted for this rigid body. Higher angular velocities are clamped to this value.

Note: The angular velocity is clamped to the set value before the solver, which means that the limit may still be momentarily exceeded.

Default: PX_MAX_F32

Parameters

maxLinVel[in] Max allowable linear velocity for actor. Range: [0, PX_MAX_F32)

virtual PxReal getMaxLinearVelocity() const = 0

Retrieves the maximum angular velocity permitted for this actor.

Returns

The maximum allowed angular velocity for this actor.

virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0

Lets you set the maximum angular velocity permitted for this actor.

For various internal computations, very quickly rotating actors introduce error into the simulation, which leads to undesired results.

With this function, you can set the maximum angular velocity permitted for this rigid body. Higher angular velocities are clamped to this value.

Note: The angular velocity is clamped to the set value before the solver, which means that the limit may still be momentarily exceeded.

Default: 100.0

Parameters

maxAngVel[in] Max allowable angular velocity for actor. Range: [0, PX_MAX_F32)

virtual PxReal getMaxAngularVelocity() const = 0

Retrieves the maximum angular velocity permitted for this actor.

Returns

The maximum allowed angular velocity for this actor.

Forces

virtual void addForce(const PxVec3 &force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0

Applies a force (or impulse) defined in the global coordinate frame to the actor at its center of mass.

This will not induce a torque.

PxForceMode determines if the force is to be conventional or impulsive.

Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same accumulators and are just short hand for multiplying the vector parameter by inverse mass and then using PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively.

Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the force is non-zero.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Note

The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.

Note

if this is called on an articulation link, only the link is updated, not the entire articulation.

Note

see PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in linear velocity that will arise from the application of an impulsive force, where an impulsive force is applied force multiplied by a timestep.

Parameters
  • force[in] Force/Impulse to apply defined in the global frame.

  • mode[in] The mode to use when applying the force/impulse(see PxForceMode)

  • autowake[in] Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

virtual void addTorque(const PxVec3 &torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0

Applies an impulsive torque defined in the global coordinate frame to the actor.

PxForceMode determines if the torque is to be conventional or impulsive.

Each actor has an angular acceleration and an angular velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same accumulators and are just short hand for multiplying the vector parameter by inverse inertia and then using PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively.

Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the torque is non-zero.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Note

The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.

Note

if this called on an articulation link, only the link is updated, not the entire articulation.

Note

see PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in angular velocity that will arise from the application of an impulsive torque, where an impulsive torque is an applied torque multiplied by a timestep.

Parameters
  • torque[in] Torque to apply defined in the global frame. Range: torque vector

  • mode[in] The mode to use when applying the force/impulse(see PxForceMode).

  • autowake[in] Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0

Clears the accumulated forces (sets the accumulated force back to zero).

Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same accumulators (see PxRigidBody::addForce() for details); therefore the effect of calling clearForce(PxForceMode::eFORCE) is equivalent to calling clearForce(PxForceMode::eACCELERATION), and the effect of calling clearForce(PxForceMode::eIMPULSE) is equivalent to calling clearForce(PxForceMode::eVELOCITY_CHANGE).

PxForceMode determines if the cleared force is to be conventional or impulsive.

Note

The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters

mode[in] The mode to use when clearing the force/impulse(see PxForceMode)

virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0

Clears the impulsive torque defined in the global coordinate frame to the actor.

PxForceMode determines if the cleared torque is to be conventional or impulsive.

Each actor has an angular acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same accumulators (see PxRigidBody::addTorque() for details); therefore the effect of calling clearTorque(PxForceMode::eFORCE) is equivalent to calling clearTorque(PxForceMode::eACCELERATION), and the effect of calling clearTorque(PxForceMode::eIMPULSE) is equivalent to calling clearTorque(PxForceMode::eVELOCITY_CHANGE).

Note

The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters

mode[in] The mode to use when clearing the force/impulse(see PxForceMode).

virtual void setForceAndTorque(const PxVec3 &force, const PxVec3 &torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0

Sets the impulsive force and torque defined in the global coordinate frame to the actor.

PxForceMode determines if the cleared torque is to be conventional or impulsive.

Note

The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0

Raises or clears a particular rigid body flag.

See the list of flags PxRigidBodyFlag

Default: no flags are set

Sleeping: Does NOT wake the actor up automatically.

Parameters
  • flag[in] The PxRigidBody flag to raise(set) or clear. See PxRigidBodyFlag.

  • value[in] The new boolean value for the flag.

virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0
virtual PxRigidBodyFlags getRigidBodyFlags() const = 0

Reads the PxRigidBody flags.

See the list of flags PxRigidBodyFlag

Returns

The values of the PxRigidBody flags.

virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0

Sets the CCD minimum advance coefficient.

The CCD minimum advance coefficient is a value in the range [0, 1] that is used to control the minimum amount of time a body is integrated when it has a CCD contact. The actual minimum amount of time that is integrated depends on various properties, including the relative speed and collision shapes of the bodies involved in the contact. From these properties, a numeric value is calculated that determines the maximum distance (and therefore maximum time) which these bodies could be integrated forwards that would ensure that these bodies did not pass through each-other. This value is then scaled by CCD minimum advance coefficient to determine the amount of time that will be consumed in the CCD pass.

Things to consider: A large value (approaching 1) ensures that the objects will always advance some time. However, larger values increase the chances of objects gently drifting through each-other in scenes which the constraint solver can’t converge, e.g. scenes where an object is being dragged through a wall with a constraint. A value of 0 ensures that the pair of objects stop at the exact time-of-impact and will not gently drift through each-other. However, with very small/thin objects initially in contact, this can lead to a large amount of time being dropped and increases the chances of jamming. Jamming occurs when the an object is persistently in contact with an object such that the time-of-impact is 0, which results in no time being advanced for those objects in that CCD pass.

The chances of jamming can be reduced by increasing the number of CCD mass

See also

PxSceneDesc.ccdMaxPasses. However, increasing this number increases the CCD overhead.

Parameters

advanceCoefficient[in] The CCD min advance coefficient. Range: [0, 1] Default: 0.15

virtual PxReal getMinCCDAdvanceCoefficient() const = 0

Gets the CCD minimum advance coefficient.

Returns

The value of the CCD min advance coefficient.

virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0

Sets the maximum depenetration velocity permitted to be introduced by the solver.

This value controls how much velocity the solver can introduce to correct for penetrations in contacts.

Parameters

biasClamp[in] The maximum velocity to de-penetrate by Range: (0, PX_MAX_F32].

virtual PxReal getMaxDepenetrationVelocity() const = 0

Returns the maximum depenetration velocity the solver is permitted to introduced.

This value controls how much velocity the solver can introduce to correct for penetrations in contacts.

Returns

The maximum penetration bias applied by the solver.

virtual void setMaxContactImpulse(PxReal maxImpulse) = 0

Sets a limit on the impulse that may be applied at a contact.

The maximum impulse at a contact between two dynamic or kinematic bodies will be the minimum of the two limit values. For a collision between a static and a dynamic body, the impulse is limited by the value for the dynamic body.

Parameters

maxImpulse[in] the maximum contact impulse. Range: [0, PX_MAX_F32] Default: PX_MAX_F32

virtual PxReal getMaxContactImpulse() const = 0

Returns the maximum impulse that may be applied at a contact.

Returns

The maximum impulse that may be applied at a contact

virtual void setContactSlopCoefficient(PxReal slopCoefficient) = 0

Sets a distance scale whereby the angular influence of a contact on the normal constraint in a contact is zeroed if normal.cross(offset) falls below this tolerance.

Rather than acting as an absolute value, this tolerance is scaled by the ratio rXn.dot(angVel)/normal.dot(linVel) such that contacts that have relatively larger angular velocity than linear normal velocity (e.g. rolling wheels) achieve larger slop values as the angular velocity increases.

Parameters

slopCoefficient[in] the Slop coefficient. Range: [0, PX_MAX_F32] Default: 0

virtual PxReal getContactSlopCoefficient() const = 0

Returns the contact slop coefficient.

Returns

The contact slop coefficient.

virtual PxNodeIndex getInternalIslandNodeIndex() const = 0

Returns the island node index.

Returns

The island node index.

Kinematic Actors

virtual void setKinematicTarget(const PxTransform &destination) = 0

Moves kinematically controlled dynamic actors through the game world.

You set a dynamic actor to be kinematic using the PxRigidBodyFlag::eKINEMATIC flag with setRigidBodyFlag().

The move command will result in a velocity that will move the body into the desired pose. After the move is carried out during a single time step, the velocity is returned to zero. Thus, you must continuously call this in every time step for kinematic actors so that they move along a path.

This function simply stores the move destination until the next simulation step is processed, so consecutive calls will simply overwrite the stored target variable.

The motion is always fully carried out.

Sleeping: This call wakes the actor if it is sleeping and will set the wake counter to PxSceneDesc::wakeCounterResetValue.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters

destination[in] The desired pose for the kinematic actor, in the global frame. Range: rigid body transform.

virtual bool getKinematicTarget(PxTransform &target) const = 0

Get target pose of a kinematically controlled dynamic actor.

Parameters

target[out] Transform to write the target pose to. Only valid if the method returns true.

Returns

True if the actor is a kinematically controlled dynamic and the target has been set, else False.

Sleeping

virtual bool isSleeping() const = 0

Returns true if this body is sleeping.

When an actor does not move for a period of time, it is no longer simulated in order to save time. This state is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, or one of its properties is changed by the user, the entire sleep mechanism should be transparent to the user.

In general, a dynamic rigid actor is guaranteed to be awake if at least one of the following holds:

  • The wake counter is positive (see setWakeCounter()).

  • The linear or angular velocity is non-zero.

  • A non-zero force or torque has been applied.

If a dynamic rigid actor is sleeping, the following state is guaranteed:

  • The wake counter is zero.

  • The linear and angular velocity is zero.

  • There is no force update pending.

When an actor gets inserted into a scene, it will be considered asleep if all the points above hold, else it will be treated as awake.

If an actor is asleep after the call to PxScene::fetchResults() returns, it is guaranteed that the pose of the actor was not changed. You can use this information to avoid updating the transforms of associated objects.

Note

A kinematic actor is asleep unless a target pose has been set (in which case it will stay awake until two consecutive simulation steps without a target pose being set have passed). The wake counter will get set to zero or to the reset value PxSceneDesc::wakeCounterResetValue in the case where a target pose has been set to be consistent with the definitions above.

Note

It is invalid to use this method if the actor has not been added to a scene already.

Note

It is not allowed to use this method while the simulation is running.

Returns

True if the actor is sleeping.

virtual void setSleepThreshold(PxReal threshold) = 0

Sets the mass-normalized kinetic energy threshold below which an actor may go to sleep.

Actors whose kinetic energy divided by their mass is below this threshold will be candidates for sleeping.

Default: 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed

Parameters

threshold[in] Energy below which an actor may go to sleep. Range: [0, PX_MAX_F32)

virtual PxReal getSleepThreshold() const = 0

Returns the mass-normalized kinetic energy below which an actor may go to sleep.

Returns

The energy threshold for sleeping.

virtual void setStabilizationThreshold(PxReal threshold) = 0

Sets the mass-normalized kinetic energy threshold below which an actor may participate in stabilization.

Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization.

This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc.

Default: 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed

Parameters

threshold[in] Energy below which an actor may participate in stabilization. Range: [0,inf)

virtual PxReal getStabilizationThreshold() const = 0

Returns the mass-normalized kinetic energy below which an actor may participate in stabilization.

Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization.

Returns

The energy threshold for participating in stabilization.

virtual PxRigidDynamicLockFlags getRigidDynamicLockFlags() const = 0

Reads the PxRigidDynamic lock flags.

See the list of flags PxRigidDynamicLockFlag

Returns

The values of the PxRigidDynamicLock flags.

virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) = 0

Raises or clears a particular rigid dynamic lock flag.

See the list of flags PxRigidDynamicLockFlag

Default: no flags are set

Parameters
  • flag[in] The PxRigidDynamicLockBody flag to raise(set) or clear. See PxRigidBodyFlag.

  • value[in] The new boolean value for the flag.

virtual void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) = 0
virtual PxVec3 getLinearVelocity() const = 0

Retrieves the linear velocity of an actor.

Note

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

Returns

The linear velocity of the actor.

virtual void setLinearVelocity(const PxVec3 &linVel, bool autowake = true) = 0

Sets the linear velocity of the actor.

Note that if you continuously set the velocity of an actor yourself, forces such as gravity or friction will not be able to manifest themselves, because forces directly influence only the velocity/momentum of an actor.

Default: (0.0, 0.0, 0.0)

Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the new velocity is non-zero.

Note

It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters
  • linVel[in] New linear velocity of actor. Range: velocity vector

  • autowake[in] Whether to wake the object up if it is asleep. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

virtual PxVec3 getAngularVelocity() const = 0

Retrieves the angular velocity of the actor.

Note

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

Returns

The angular velocity of the actor.

virtual void setAngularVelocity(const PxVec3 &angVel, bool autowake = true) = 0

Sets the angular velocity of the actor.

Note that if you continuously set the angular velocity of an actor yourself, forces such as friction will not be able to rotate the actor, because forces directly influence only the velocity/momentum.

Default: (0.0, 0.0, 0.0)

Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the new velocity is non-zero.

Note

It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters
  • angVel[in] New angular velocity of actor. Range: angular velocity vector

  • autowake[in] Whether to wake the object up if it is asleep. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

virtual void setWakeCounter(PxReal wakeCounterValue) = 0

Sets the wake counter for the actor.

The wake counter value determines the minimum amount of time until the body can be put to sleep. Please note that a body will not be put to sleep if the energy is above the specified threshold (see setSleepThreshold()) or if other awake bodies are touching it.

Default: 0.4 (which corresponds to 20 frames for a time step of 0.02)

Note

Passing in a positive value will wake the actor up automatically.

Note

It is invalid to use this method for kinematic actors since the wake counter for kinematics is defined based on whether a target pose has been set (see the comment in isSleeping()).

Note

It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set.

Parameters

wakeCounterValue[in] Wake counter value. Range: [0, PX_MAX_F32)

virtual PxReal getWakeCounter() const = 0

Returns the wake counter of the actor.

Note

It is not allowed to use this method while the simulation is running.

Returns

The wake counter of the actor.

virtual void wakeUp() = 0

Wakes up the actor if it is sleeping.

The actor will get woken up and might cause other touching actors to wake up as well during the next simulation step.

Note

This will set the wake counter of the actor to the value specified in PxSceneDesc::wakeCounterResetValue.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Note

It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined based on whether a target pose has been set (see the comment in isSleeping()).

virtual void putToSleep() = 0

Forces the actor to sleep.

The actor will stay asleep during the next simulation step if not touched by another non-sleeping actor.

Note

Any applied force will be cleared and the velocity and the wake counter of the actor will be set to 0.

Note

It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set.

Note

It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined based on whether a target pose has been set (see the comment in isSleeping()).

virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0

Sets the solver iteration counts for the body.

The solver iteration count determines how accurately joints and contacts are resolved. If you are having trouble with jointed bodies oscillating and behaving erratically, then setting a higher position iteration count may improve their stability.

If intersecting bodies are being depenetrated too violently, increase the number of velocity iterations. More velocity iterations will drive the relative exit velocity of the intersecting objects closer to the correct value given the restitution.

Default: 4 position iterations, 1 velocity iteration

Parameters
  • minPositionIters[in] Number of position iterations the solver should perform for this body. Range: [1,255]

  • minVelocityIters[in] Number of velocity iterations the solver should perform for this body. Range: [0,255]

virtual void getSolverIterationCounts(PxU32 &minPositionIters, PxU32 &minVelocityIters) const = 0

Retrieves the solver iteration counts.

virtual PxReal getContactReportThreshold() const = 0

Retrieves the force threshold for contact reports.

The contact report threshold is a force threshold. If the force between two actors exceeds this threshold for either of the two actors, a contact report will be generated according to the contact report threshold flags provided by the filter shader/callback. See PxPairFlag.

The threshold used for a collision between a dynamic actor and the static environment is the threshold of the dynamic actor, and all contacts with static actors are summed to find the total normal force.

Default: PX_MAX_F32

Returns

Force threshold for contact reports.

virtual void setContactReportThreshold(PxReal threshold) = 0

Sets the force threshold for contact reports.

See getContactReportThreshold().

Parameters

threshold[in] Force threshold for contact reports. Range: [0, PX_MAX_F32)

inline virtual const char *getConcreteTypeName() const

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

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

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

Public Functions

virtual void release() = 0

Deletes the rigid actor object.

Also releases any shapes associated with the actor.

Releasing an actor will affect any objects that are connected to the actor (constraint shaders like joints etc.). Such connected objects will be deleted upon scene deletion, or explicitly by the user by calling release() on these objects. It is recommended to always remove all objects that reference actors before the actors themselves are removed. It is not possible to retrieve list of dead connected objects.

Sleeping: This call will awaken any sleeping actors contacting the deleted actor (directly or indirectly).

Calls PxActor::release() so you might want to check the documentation of that method as well.

virtual PxU32 getInternalActorIndex() const = 0

Returns the internal actor index.

Warning

This is only defined for actors that have been added to a scene.

Returns

The internal actor index, or 0xffffffff if the actor is not part of a scene.

virtual PxActorType::Enum getType() const = 0

Retrieves the type of actor.

See also

PxActorType

Returns

The actor type of the actor.

virtual PxScene *getScene() const = 0

Retrieves the scene which this actor belongs to.

See also

PxScene

Returns

Owner Scene. NULL if not part of a scene.

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.

Default: NULL

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 PxBounds3 getWorldBounds(float inflation = 1.01f) const = 0

Retrieves the axis aligned bounding box enclosing the actor.

See also

PxBounds3

Note

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

Parameters

inflation[in] Scale factor for computed world bounds. Box extents are multiplied by this value.

Returns

The actor’s bounding box.

virtual void setActorFlag(PxActorFlag::Enum flag, bool value) = 0

Raises or clears a particular actor flag.

See the list of flags PxActorFlag

Sleeping: Does NOT wake the actor up automatically.

Parameters
  • flag[in] The PxActor flag to raise(set) or clear. See PxActorFlag.

  • value[in] The boolean value to assign to the flag.

virtual void setActorFlags(PxActorFlags inFlags) = 0

Sets the actor flags.

See the list of flags PxActorFlag

virtual PxActorFlags getActorFlags() const = 0

Reads the PxActor flags.

See the list of flags PxActorFlag

Returns

The values of the PxActor flags.

virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) = 0

Assigns dynamic actors a dominance group identifier.

PxDominanceGroup is a 5 bit group identifier (legal range from 0 to 31).

The PxScene::setDominanceGroupPair() lets you set certain behaviors for pairs of dominance groups. By default every dynamic actor is created in group 0.

Default: 0

Sleeping: Changing the dominance group does NOT wake the actor up automatically.

Parameters

dominanceGroup[in] The dominance group identifier. Range: [0..31]

virtual PxDominanceGroup getDominanceGroup() const = 0

Retrieves the value set with setDominanceGroup().

Returns

The dominance group of this actor.

virtual void setOwnerClient(PxClientID inClient) = 0

Sets the owner client of an actor.

This cannot be done once the actor has been placed into a scene.

Default: PX_DEFAULT_CLIENT

See also

PxClientID PxScene::createClient()

virtual PxClientID getOwnerClient() const = 0

Returns the owner client that was specified at creation time.

This value cannot be changed once the object is placed into the scene.

See also

PxClientID PxScene::createClient()

virtual PxAggregate *getAggregate() const = 0

Retrieves the aggregate the actor might be a part of.

See also

PxAggregate

Returns

The aggregate the actor is a part of, or NULL if the actor does not belong to an aggregate.

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.

Protected Functions

template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount