PxRigidBody is a base class shared between dynamic rigid body objects. More...
#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. More... | |
virtual PxTransform | getCMassLocalPose () const =0 |
Retrieves the center of mass pose relative to the actor frame. More... | |
virtual void | setMass (PxReal mass)=0 |
Sets the mass of a dynamic actor. More... | |
virtual PxReal | getMass () const =0 |
Retrieves the mass of the actor. More... | |
virtual PxReal | getInvMass () const =0 |
Retrieves the inverse mass of the actor. More... | |
virtual void | setMassSpaceInertiaTensor (const PxVec3 &m)=0 |
Sets the inertia tensor, using a parameter specified in mass space coordinates. More... | |
virtual PxVec3 | getMassSpaceInertiaTensor () const =0 |
Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame. More... | |
virtual PxVec3 | getMassSpaceInvInertiaTensor () const =0 |
Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame. More... | |
Damping | |
virtual void | setLinearDamping (PxReal linDamp)=0 |
Sets the linear damping coefficient. More... | |
virtual PxReal | getLinearDamping () const =0 |
Retrieves the linear damping coefficient. More... | |
virtual void | setAngularDamping (PxReal angDamp)=0 |
Sets the angular damping coefficient. More... | |
virtual PxReal | getAngularDamping () const =0 |
Retrieves the angular damping coefficient. More... | |
Velocity | |
virtual PxVec3 | getLinearVelocity () const =0 |
Retrieves the linear velocity of an actor. More... | |
virtual void | setLinearVelocity (const PxVec3 &linVel, bool autowake=true)=0 |
Sets the linear velocity of the actor. More... | |
virtual PxVec3 | getAngularVelocity () const =0 |
Retrieves the angular velocity of the actor. More... | |
virtual void | setAngularVelocity (const PxVec3 &angVel, bool autowake=true)=0 |
Sets the angular velocity of the actor. More... | |
virtual void | setMaxAngularVelocity (PxReal maxAngVel)=0 |
Lets you set the maximum angular velocity permitted for this actor. More... | |
virtual PxReal | getMaxAngularVelocity () const =0 |
Retrieves the maximum angular velocity permitted for this actor. More... | |
virtual void | setMaxLinearVelocity (PxReal maxLinVel)=0 |
Lets you set the maximum linear velocity permitted for this actor. More... | |
virtual PxReal | getMaxLinearVelocity () const =0 |
Retrieves the maximum angular velocity permitted for this actor. More... | |
Public Member Functions inherited from PxRigidActor | |
virtual void | release ()=0 |
Deletes the rigid actor object. More... | |
virtual PxTransform | getGlobalPose () const =0 |
Retrieves the actors world space transform. More... | |
virtual void | setGlobalPose (const PxTransform &pose, bool autowake=true)=0 |
Method for setting an actor's pose in the world. More... | |
virtual bool | attachShape (PxShape &shape)=0 |
virtual void | detachShape (PxShape &shape, bool wakeOnLostTouch=true)=0 |
virtual PxU32 | getNbShapes () const =0 |
Returns the number of shapes assigned to the actor. More... | |
virtual PxU32 | getShapes (PxShape **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Retrieve all the shape pointers belonging to the actor. More... | |
virtual PxU32 | getNbConstraints () const =0 |
Returns the number of constraint shaders attached to the actor. More... | |
virtual PxU32 | getConstraints (PxConstraint **userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const =0 |
Retrieve all the constraint shader pointers belonging to the actor. More... | |
Public Member Functions inherited from PxActor | |
virtual PxActorType::Enum | getType () const =0 |
Retrieves the type of actor. More... | |
virtual PxScene * | getScene () const =0 |
Retrieves the scene which this actor belongs to. More... | |
virtual void | setName (const char *name)=0 |
Sets a name string for the object that can be retrieved with getName(). More... | |
virtual const char * | getName () const =0 |
Retrieves the name string set with setName(). More... | |
virtual PxBounds3 | getWorldBounds (float inflation=1.01f) const =0 |
Retrieves the axis aligned bounding box enclosing the actor. More... | |
virtual void | setActorFlag (PxActorFlag::Enum flag, bool value)=0 |
Raises or clears a particular actor flag. More... | |
virtual void | setActorFlags (PxActorFlags inFlags)=0 |
sets the actor flags More... | |
virtual PxActorFlags | getActorFlags () const =0 |
Reads the PxActor flags. More... | |
virtual void | setDominanceGroup (PxDominanceGroup dominanceGroup)=0 |
Assigns dynamic actors a dominance group identifier. More... | |
virtual PxDominanceGroup | getDominanceGroup () const =0 |
Retrieves the value set with setDominanceGroup(). More... | |
virtual void | setOwnerClient (PxClientID inClient)=0 |
Sets the owner client of an actor. More... | |
virtual PxClientID | getOwnerClient () const =0 |
Returns the owner client that was specified with at creation time. More... | |
virtual PxAggregate * | getAggregate () const =0 |
Retrieves the aggregate the actor might be a part of. More... | |
Public Member Functions inherited from PxBase | |
virtual const char * | getConcreteTypeName () const =0 |
Returns string name of dynamic type. More... | |
template<class T > | |
T * | is () |
template<class T > | |
const T * | is () const |
PX_FORCE_INLINE PxType | getConcreteType () const |
Returns concrete type of object. More... | |
PX_FORCE_INLINE void | setBaseFlag (PxBaseFlag::Enum flag, bool value) |
Set PxBaseFlag. More... | |
PX_FORCE_INLINE void | setBaseFlags (PxBaseFlags inFlags) |
Set PxBaseFlags. More... | |
PX_FORCE_INLINE PxBaseFlags | getBaseFlags () const |
Returns PxBaseFlags. More... | |
virtual bool | isReleasable () const |
Whether the object is subordinate. More... | |
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. More... | |
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. More... | |
virtual void | clearForce (PxForceMode::Enum mode=PxForceMode::eFORCE)=0 |
Clears the accumulated forces (sets the accumulated force back to zero). More... | |
virtual void | clearTorque (PxForceMode::Enum mode=PxForceMode::eFORCE)=0 |
Clears the impulsive torque defined in the global coordinate frame to the actor. More... | |
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. More... | |
virtual void | setRigidBodyFlag (PxRigidBodyFlag::Enum flag, bool value)=0 |
Raises or clears a particular rigid body flag. More... | |
virtual void | setRigidBodyFlags (PxRigidBodyFlags inFlags)=0 |
virtual PxRigidBodyFlags | getRigidBodyFlags () const =0 |
Reads the PxRigidBody flags. More... | |
virtual void | setMinCCDAdvanceCoefficient (PxReal advanceCoefficient)=0 |
Sets the CCD minimum advance coefficient. More... | |
virtual PxReal | getMinCCDAdvanceCoefficient () const =0 |
Gets the CCD minimum advance coefficient. More... | |
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. More... | |
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. More... | |
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. More... | |
virtual PxReal | getMaxContactImpulse () const =0 |
Returns the maximum impulse that may be applied at a contact. More... | |
virtual PxU32 | getInternalIslandNodeIndex () const =0 |
Returns the island node index that only for internal use only. More... | |
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. More... | |
Additional Inherited Members | |
Public Attributes inherited from PxActor | |
void * | userData |
user can assign this to whatever, usually to create a 1:1 relationship with a user object. More... | |
Protected Member Functions inherited from PxRigidActor | |
PX_INLINE | PxRigidActor (PxType concreteType, PxBaseFlags baseFlags) |
PX_INLINE | PxRigidActor (PxBaseFlags baseFlags) |
virtual | ~PxRigidActor () |
Protected Member Functions inherited from PxActor | |
PX_INLINE | PxActor (PxType concreteType, PxBaseFlags baseFlags) |
PX_INLINE | PxActor (PxBaseFlags baseFlags) |
virtual | ~PxActor () |
Protected Member Functions inherited from PxBase | |
PX_INLINE | PxBase (PxType concreteType, PxBaseFlags baseFlags) |
Constructor setting concrete type and base flags. More... | |
PX_INLINE | PxBase (PxBaseFlags baseFlags) |
Deserialization constructor setting base flags. More... | |
virtual | ~PxBase () |
Destructor. More... | |
template<class T > | |
bool | typeMatch () const |
Protected Attributes inherited from PxBase | |
PxType | mConcreteType |
PxBaseFlags | mBaseFlags |
PxRigidBody is a base class shared between dynamic rigid body objects.
|
inlineprotected |
|
inlineprotected |
|
inlineprotectedvirtual |
|
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.
Sleeping: This call wakes the actor if it is sleeping and the autowake parameter is true (default) or the force is non-zero.
[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. |
|
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.
Sleeping: This call wakes the actor if it is sleeping and the autowake parameter is true (default) or the torque is non-zero.
[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. |
|
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.
[in] | mode | The mode to use when clearing the force/impulse(see PxForceMode) |
|
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).
[in] | mode | The mode to use when clearing the force/impulse(see PxForceMode). |
|
pure virtual |
Retrieves the angular damping coefficient.
|
pure virtual |
Retrieves the angular velocity of the actor.
|
pure virtual |
Retrieves the center of mass pose relative to the actor frame.
|
pure virtual |
Returns the island node index that only for internal use only.
|
pure virtual |
Retrieves the inverse mass of the actor.
|
pure virtual |
Retrieves the linear damping coefficient.
|
pure virtual |
Retrieves the linear velocity of an actor.
|
pure virtual |
Retrieves the mass of the actor.
|
pure virtual |
Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame.
This method retrieves a mass frame inertia vector.
|
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.
|
pure virtual |
Retrieves the maximum angular velocity permitted for this actor.
|
pure virtual |
Returns the maximum impulse that may be applied at a contact.
|
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.
|
pure virtual |
Retrieves the maximum angular velocity permitted for this actor.
|
pure virtual |
Gets the CCD minimum advance coefficient.
|
pure virtual |
Reads the PxRigidBody flags.
See the list of flags PxRigidBodyFlag
|
inlineprotectedvirtual |
Returns whether a given type name matches with the type of this instance.
Reimplemented from PxRigidActor.
Reimplemented in PxRigidDynamic, and PxArticulationLink.
References PxRigidActor::isKindOf().
Referenced by PxArticulationLink::isKindOf(), and PxRigidDynamic::isKindOf().
|
pure virtual |
Sets the angular damping coefficient.
Zero represents no damping.
The angular damping coefficient must be nonnegative.
Default: 0.05
[in] | angDamp | Angular damping coefficient. Range: [0, PX_MAX_F32) |
|
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. |
|
pure virtual |
Sets the pose of the center of mass relative to the actor.
Default: the identity transform
[in] | pose | Mass frame offset transform relative to the actor frame. Range: rigid body transform. |
|
pure virtual |
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.
|
pure virtual |
Sets the linear damping coefficient.
Zero represents no damping. The damping coefficient must be nonnegative.
Default: 0.0
[in] | linDamp | Linear damping coefficient. Range: [0, PX_MAX_F32) |
|
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. |
|
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().
Default: 1.0
Sleeping: Does NOT wake the actor up automatically.
[in] | mass | New mass value for the actor. Range: [0, PX_MAX_F32) |
|
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.
Default: (1.0, 1.0, 1.0)
Sleeping: Does NOT wake the actor up automatically.
[in] | m | New mass space inertia tensor for the actor. |
|
pure virtual |
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
[in] | maxAngVel | Max allowable angular velocity for actor. Range: [0, PX_MAX_F32) |
|
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.
[in] | maxImpulse | the maximum contact impulse. Range: [0, PX_MAX_F32] Default: PX_MAX_F32 |
|
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]. |
|
pure virtual |
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
[in] | maxLinVel | Max allowable linear velocity for actor. Range: [0, PX_MAX_F32) |
|
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 |
|
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. |
|
pure virtual |