#include <PxRigidBody.h>
Public Member Functions | |
Mass Manipulation | |
virtual void | setCMassLocalPose (const PxTransform &pose)=0 |
Sets the pose of the center of mass relative to the actor. | |
virtual PxTransform | getCMassLocalPose () const =0 |
Retrieves the center of mass pose relative to the actor frame. | |
virtual void | setMass (PxReal mass)=0 |
Sets the mass of a dynamic actor. | |
virtual PxReal | getMass () const =0 |
Retrieves the mass of the actor. | |
virtual PxReal | getInvMass () const =0 |
Retrieves the inverse mass of the actor. | |
virtual void | setMassSpaceInertiaTensor (const PxVec3 &m)=0 |
Sets the inertia tensor, using a parameter specified in mass space coordinates. | |
virtual PxVec3 | getMassSpaceInertiaTensor () const =0 |
Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame. | |
virtual PxVec3 | getMassSpaceInvInertiaTensor () const =0 |
Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame. | |
Velocity | |
virtual PxVec3 | getLinearVelocity () const =0 |
Retrieves the linear velocity of an actor. | |
virtual void | setLinearVelocity (const PxVec3 &linVel, bool autowake=true)=0 |
Sets the linear velocity of the actor. | |
virtual PxVec3 | getAngularVelocity () const =0 |
Retrieves the angular velocity of the actor. | |
virtual void | setAngularVelocity (const PxVec3 &angVel, bool autowake=true)=0 |
Sets the angular velocity of the 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. | |
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. | |
virtual void | clearForce (PxForceMode::Enum mode=PxForceMode::eFORCE)=0 |
Clears the accumulated forces (sets the accumulated force back to zero). | |
virtual void | clearTorque (PxForceMode::Enum mode=PxForceMode::eFORCE)=0 |
Clears the impulsive torque defined in the global coordinate frame to the actor. | |
virtual void | setRigidBodyFlag (PxRigidBodyFlag::Enum flag, bool value)=0 |
Raises or clears a particular rigid body flag. | |
virtual void | setRigidBodyFlags (PxRigidBodyFlags inFlags)=0 |
virtual PxRigidBodyFlags | getRigidBodyFlags () const =0 |
Reads the PxRigidBody flags. | |
virtual void | setMinCCDAdvanceCoefficient (PxReal advanceCoefficient)=0 |
Sets the CCD minimum advance coefficient. | |
virtual PxReal | getMinCCDAdvanceCoefficient () const =0 |
Gets the CCD minimum 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. | |
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. | |
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. | |
virtual PxReal | getMaxContactImpulse () const =0 |
Returns the maximum impulse that may be applied at a contact. | |
PX_INLINE | PxRigidBody (PxType concreteType, PxBaseFlags baseFlags) |
PX_INLINE | PxRigidBody (PxBaseFlags baseFlags) |
virtual | ~PxRigidBody () |
virtual bool | isKindOf (const char *name) const |
Returns whether a given type name matches with the type of this instance. |
PX_INLINE PxRigidBody::PxRigidBody | ( | PxType | concreteType, | |
PxBaseFlags | baseFlags | |||
) | [inline, protected] |
PX_INLINE PxRigidBody::PxRigidBody | ( | PxBaseFlags | baseFlags | ) | [inline, protected] |
virtual PxRigidBody::~PxRigidBody | ( | ) | [inline, protected, virtual] |
virtual void PxRigidBody::addForce | ( | const PxVec3 & | force, | |
PxForceMode::Enum | mode = PxForceMode::eFORCE , |
|||
bool | autowake = true | |||
) | [pure virtual] |
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.
The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.
if this is called on an articulation link, only the link is updated, not the entire articulation.
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.
[in] | force | Force/Impulse to apply defined in the global frame. |
[in] | mode | The mode to use when applying the force/impulse(see PxForceMode) |
[in] | autowake | 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 PxRigidBody::addTorque | ( | const PxVec3 & | torque, | |
PxForceMode::Enum | mode = PxForceMode::eFORCE , |
|||
bool | autowake = true | |||
) | [pure virtual] |
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.
The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links.
if this called on an articulation link, only the link is updated, not the entire articulation.
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.
[in] | torque | Torque to apply defined in the global frame. Range: torque vector |
[in] | mode | The mode to use when applying the force/impulse(see PxForceMode). |
[in] | autowake | whether to wake up the object 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 PxRigidBody::clearForce | ( | PxForceMode::Enum | mode = PxForceMode::eFORCE |
) | [pure virtual] |
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.
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.
[in] | mode | The mode to use when clearing the force/impulse(see PxForceMode) |
virtual void PxRigidBody::clearTorque | ( | PxForceMode::Enum | mode = PxForceMode::eFORCE |
) | [pure virtual] |
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).
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.
[in] | mode | The mode to use when clearing the force/impulse(see PxForceMode). |
virtual PxVec3 PxRigidBody::getAngularVelocity | ( | ) | const [pure virtual] |
Retrieves the angular velocity of the actor.
virtual PxTransform PxRigidBody::getCMassLocalPose | ( | ) | const [pure virtual] |
Retrieves the center of mass pose relative to the actor frame.
virtual PxReal PxRigidBody::getInvMass | ( | ) | const [pure virtual] |
Retrieves the inverse mass of the actor.
virtual PxVec3 PxRigidBody::getLinearVelocity | ( | ) | const [pure virtual] |
Retrieves the linear velocity of an actor.
virtual PxReal PxRigidBody::getMass | ( | ) | const [pure virtual] |
Retrieves the mass of the actor.
virtual PxVec3 PxRigidBody::getMassSpaceInertiaTensor | ( | ) | const [pure virtual] |
Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame.
This method retrieves a mass frame inertia vector.
virtual PxVec3 PxRigidBody::getMassSpaceInvInertiaTensor | ( | ) | const [pure virtual] |
Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame.
This method retrieves a mass frame inverse inertia vector.
virtual PxReal PxRigidBody::getMaxContactImpulse | ( | ) | const [pure virtual] |
Returns the maximum impulse that may be applied at a contact.
virtual PxReal PxRigidBody::getMaxDepenetrationVelocity | ( | ) | const [pure virtual] |
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.
virtual PxReal PxRigidBody::getMinCCDAdvanceCoefficient | ( | ) | const [pure virtual] |
Gets the CCD minimum advance coefficient.
virtual PxRigidBodyFlags PxRigidBody::getRigidBodyFlags | ( | ) | const [pure virtual] |
Reads the PxRigidBody flags.
See the list of flags PxRigidBodyFlag
virtual bool PxRigidBody::isKindOf | ( | const char * | superClass | ) | const [inline, protected, virtual] |
Returns whether a given type name matches with the type of this instance.
Reimplemented from PxRigidActor.
Reimplemented in PxArticulationLink, and PxRigidDynamic.
References PxRigidActor::isKindOf().
Referenced by PxRigidDynamic::isKindOf(), and PxArticulationLink::isKindOf().
virtual void PxRigidBody::setAngularVelocity | ( | const PxVec3 & | angVel, | |
bool | autowake = true | |||
) | [pure virtual] |
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, the autowake parameter is true (default) or the new velocity is non-zero
[in] | angVel | New angular velocity of actor. Range: angular velocity vector |
[in] | autowake | Whether to wake the object up if it is asleep and the velocity is non-zero. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. |
virtual void PxRigidBody::setCMassLocalPose | ( | const PxTransform & | pose | ) | [pure virtual] |
Sets the pose of the center of mass relative to the actor.
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.
[in] | pose | Mass frame offset transform relative to the actor frame. Range: rigid body transform. |
virtual void PxRigidBody::setLinearVelocity | ( | const PxVec3 & | linVel, | |
bool | autowake = true | |||
) | [pure virtual] |
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, the autowake parameter is true (default) or the new velocity is non-zero
[in] | linVel | New linear velocity of actor. Range: velocity vector |
[in] | autowake | Whether to wake the object up if it is asleep and the velocity is non-zero. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. |
virtual void PxRigidBody::setMass | ( | PxReal | mass | ) | [pure virtual] |
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().
Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic.
Sleeping: Does NOT wake the actor up automatically.
[in] | mass | New mass value for the actor. Range: [0, PX_MAX_F32) |
virtual void PxRigidBody::setMassSpaceInertiaTensor | ( | const PxVec3 & | m | ) | [pure virtual] |
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.
Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic.
Sleeping: Does NOT wake the actor up automatically.
[in] | m | New mass space inertia tensor for the actor. |
virtual void PxRigidBody::setMaxContactImpulse | ( | PxReal | maxImpulse | ) | [pure virtual] |
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.
This value is not used in CCD unless PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE is raised on the body.
[in] | maxImpulse | the maximum contact impulse. Range: [0, PX_MAX_F32] Default: PX_MAX_F32 |
virtual void PxRigidBody::setMaxDepenetrationVelocity | ( | PxReal | biasClamp | ) | [pure virtual] |
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.
[in] | biasClamp | The maximum velocity to de-penetrate by Range: (0, PX_MAX_F32]. |
virtual void PxRigidBody::setMinCCDAdvanceCoefficient | ( | PxReal | advanceCoefficient | ) | [pure virtual] |
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
[in] | advanceCoefficient | The CCD min advance coefficient. Range: [0, 1] Default: 0.15 |
virtual void PxRigidBody::setRigidBodyFlag | ( | PxRigidBodyFlag::Enum | flag, | |
bool | value | |||
) | [pure virtual] |
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.
[in] | flag | The PxRigidBody flag to raise(set) or clear. See PxRigidBodyFlag. |
[in] | value | The new boolean value for the flag. |
virtual void PxRigidBody::setRigidBodyFlags | ( | PxRigidBodyFlags | inFlags | ) | [pure virtual] |