PxRigidBodyExt Class Reference
[Extensions]

utility functions for use with PxRigidBody and subclasses More...

#include <PxRigidBodyExt.h>

List of all members.

Static Public Member Functions

static bool updateMassAndInertia (PxRigidBody &body, const PxReal *shapeDensities, PxU32 shapeDensityCount, const PxVec3 *massLocalPose=NULL, bool includeNonSimShapes=false)
 Computation of mass properties for a rigid body actor.
static bool updateMassAndInertia (PxRigidBody &body, PxReal density, const PxVec3 *massLocalPose=NULL, bool includeNonSimShapes=false)
 Computation of mass properties for a rigid body actor.
static bool setMassAndUpdateInertia (PxRigidBody &body, const PxReal *shapeMasses, PxU32 shapeMassCount, const PxVec3 *massLocalPose=NULL, bool includeNonSimShapes=false)
 Computation of mass properties for a rigid body actor.
static bool setMassAndUpdateInertia (PxRigidBody &body, PxReal mass, const PxVec3 *massLocalPose=NULL, bool includeNonSimShapes=false)
 Computation of mass properties for a rigid body actor.
static PxMassProperties computeMassPropertiesFromShapes (const PxShape *const *shapes, PxU32 shapeCount)
 Compute the mass, inertia tensor and center of mass from a list of shapes.
static void addForceAtPos (PxRigidBody &body, const PxVec3 &force, const PxVec3 &pos, PxForceMode::Enum mode=PxForceMode::eFORCE, bool wakeup=true)
 Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.
static void addForceAtLocalPos (PxRigidBody &body, const PxVec3 &force, const PxVec3 &pos, PxForceMode::Enum mode=PxForceMode::eFORCE, bool wakeup=true)
 Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.
static void addLocalForceAtPos (PxRigidBody &body, const PxVec3 &force, const PxVec3 &pos, PxForceMode::Enum mode=PxForceMode::eFORCE, bool wakeup=true)
 Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.
static void addLocalForceAtLocalPos (PxRigidBody &body, const PxVec3 &force, const PxVec3 &pos, PxForceMode::Enum mode=PxForceMode::eFORCE, bool wakeup=true)
 Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.
static PxVec3 getVelocityAtPos (const PxRigidBody &body, const PxVec3 &pos)
 Computes the velocity of a point given in world coordinates if it were attached to the specified body and moving with it.
static PxVec3 getLocalVelocityAtLocalPos (const PxRigidBody &body, const PxVec3 &pos)
 Computes the velocity of a point given in local coordinates if it were attached to the specified body and moving with it.
static PxVec3 getVelocityAtOffset (const PxRigidBody &body, const PxVec3 &pos)
 Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the specified body and moving with it.
static bool linearSweepSingle (PxRigidBody &body, PxScene &scene, const PxVec3 &unitDir, const PxReal distance, PxHitFlags outputFlags, PxSweepHit &closestHit, PxU32 &shapeIndex, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL, const PxQueryCache *cache=NULL, const PxReal inflation=0.0f)
 Performs a linear sweep through space with the body's geometry objects.
static PxU32 linearSweepMultiple (PxRigidBody &body, PxScene &scene, const PxVec3 &unitDir, const PxReal distance, PxHitFlags outputFlags, PxSweepHit *touchHitBuffer, PxU32 *touchHitShapeIndices, PxU32 touchHitBufferSize, PxSweepHit &block, PxI32 &blockingShapeIndex, bool &overflow, const PxQueryFilterData &filterData=PxQueryFilterData(), PxQueryFilterCallback *filterCall=NULL, const PxQueryCache *cache=NULL, const PxReal inflation=0.0f)
 Performs a linear sweep through space with the body's geometry objects, returning all overlaps.
static void computeVelocityDeltaFromImpulse (const PxRigidBody &body, const PxVec3 &impulsiveForce, const PxVec3 &impulsiveTorque, PxVec3 &deltaLinearVelocity, PxVec3 &deltaAngularVelocity)
 Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body.
static void computeVelocityDeltaFromImpulse (const PxRigidBody &body, const PxTransform &globalPose, const PxVec3 &point, const PxVec3 &impulse, const PxReal invMassScale, const PxReal invInertiaScale, PxVec3 &deltaLinearVelocity, PxVec3 &deltaAngularVelocity)
 Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account.
static void computeLinearAngularImpulse (const PxRigidBody &body, const PxTransform &globalPose, const PxVec3 &point, const PxVec3 &impulse, const PxReal invMassScale, const PxReal invInertiaScale, PxVec3 &linearImpulse, PxVec3 &angularImpulse)
 Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account.


Detailed Description

utility functions for use with PxRigidBody and subclasses

See also:
PxRigidBody PxRigidDynamic PxArticulationLink

Member Function Documentation

static void PxRigidBodyExt::addForceAtLocalPos ( PxRigidBody body,
const PxVec3 force,
const PxVec3 pos,
PxForceMode::Enum  mode = PxForceMode::eFORCE,
bool  wakeup = true 
) [static]

Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in local coordinates, to the actor.

Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

Note:
if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation
PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

Parameters:
[in] body The rigid body to apply the force to.
[in] force Force/impulse to add, defined in the global frame. Range: force vector
[in] pos Position in the local frame to add the force at. Range: position vector
[in] mode The mode to use when applying the force/impulse(see PxForceMode).
[in] wakeup Specify if the call should wake up the actor.
See also:
PxForceMode

addForceAtPos() addLocalForceAtPos() addLocalForceAtLocalPos()

static void PxRigidBodyExt::addForceAtPos ( PxRigidBody body,
const PxVec3 force,
const PxVec3 pos,
PxForceMode::Enum  mode = PxForceMode::eFORCE,
bool  wakeup = true 
) [static]

Applies a force (or impulse) defined in the global coordinate frame, acting at a particular point in global coordinates, to the actor.

Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

Note:
if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation
PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

Parameters:
[in] body The rigid body to apply the force to.
[in] force Force/impulse to add, defined in the global frame. Range: force vector
[in] pos Position in the global frame to add the force at. Range: position vector
[in] mode The mode to use when applying the force/impulse(see PxForceMode).
[in] wakeup Specify if the call should wake up the actor.
See also:
PxForceMode

addForceAtLocalPos() addLocalForceAtPos() addLocalForceAtLocalPos()

static void PxRigidBodyExt::addLocalForceAtLocalPos ( PxRigidBody body,
const PxVec3 force,
const PxVec3 pos,
PxForceMode::Enum  mode = PxForceMode::eFORCE,
bool  wakeup = true 
) [static]

Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in local coordinates, to the actor.

Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

Note:
if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation
PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

Parameters:
[in] body The rigid body to apply the force to.
[in] force Force/impulse to add, defined in the local frame. Range: force vector
[in] pos Position in the local frame to add the force at. Range: position vector
[in] mode The mode to use when applying the force/impulse(see PxForceMode).
[in] wakeup Specify if the call should wake up the actor.
See also:
PxForceMode

addForceAtPos() addForceAtLocalPos() addLocalForceAtPos()

static void PxRigidBodyExt::addLocalForceAtPos ( PxRigidBody body,
const PxVec3 force,
const PxVec3 pos,
PxForceMode::Enum  mode = PxForceMode::eFORCE,
bool  wakeup = true 
) [static]

Applies a force (or impulse) defined in the actor local coordinate frame, acting at a particular point in global coordinates, to the actor.

Note that if the force does not act along the center of mass of the actor, this will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a total external force on an object by calling this once every frame.

Note:
if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire articulation
PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a given point.

Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default).

Parameters:
[in] body The rigid body to apply the force to.
[in] force Force/impulse to add, defined in the local frame. Range: force vector
[in] pos Position in the global frame to add the force at. Range: position vector
[in] mode The mode to use when applying the force/impulse(see PxForceMode).
[in] wakeup Specify if the call should wake up the actor.
See also:
PxForceMode

addForceAtPos() addForceAtLocalPos() addLocalForceAtLocalPos()

static void PxRigidBodyExt::computeLinearAngularImpulse ( const PxRigidBody body,
const PxTransform globalPose,
const PxVec3 point,
const PxVec3 impulse,
const PxReal  invMassScale,
const PxReal  invInertiaScale,
PxVec3 linearImpulse,
PxVec3 angularImpulse 
) [static]

Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account.

This function is useful for extracting the respective linear and angular impulses from a contact or joint when the mass/inertia ratios have been adjusted.

Parameters:
[in] body The rigid body
[in] globalPose The body's world space transform
[in] point The point in world space where the impulse is applied
[in] impulse The impulse vector in world space
[in] invMassScale The inverse mass scale
[in] invInertiaScale The inverse inertia scale
[out] linearImpulse The linear impulse
[out] angularImpulse The angular impulse

static PxMassProperties PxRigidBodyExt::computeMassPropertiesFromShapes ( const PxShape *const *  shapes,
PxU32  shapeCount 
) [static]

Compute the mass, inertia tensor and center of mass from a list of shapes.

Parameters:
[in] shapes The shapes to compute the mass properties from.
[in] shapeCount The number of provided shapes.
Returns:
The mass properties from the combined shapes.
See also:
PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass

static void PxRigidBodyExt::computeVelocityDeltaFromImpulse ( const PxRigidBody body,
const PxTransform globalPose,
const PxVec3 point,
const PxVec3 impulse,
const PxReal  invMassScale,
const PxReal  invInertiaScale,
PxVec3 deltaLinearVelocity,
PxVec3 deltaAngularVelocity 
) [static]

Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account.

This function is useful for extracting the respective linear and angular velocity changes from a contact or joint when the mass/inertia ratios have been adjusted.

Note:
if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account.
Parameters:
[in] body The rigid body
[in] globalPose The body's world space transform
[in] point The point in world space where the impulse is applied
[in] impulse The impulse vector in world space
[in] invMassScale The inverse mass scale
[in] invInertiaScale The inverse inertia scale
[out] deltaLinearVelocity The linear velocity change
[out] deltaAngularVelocity The angular velocity change

static void PxRigidBodyExt::computeVelocityDeltaFromImpulse ( const PxRigidBody body,
const PxVec3 impulsiveForce,
const PxVec3 impulsiveTorque,
PxVec3 deltaLinearVelocity,
PxVec3 deltaAngularVelocity 
) [static]

Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body.

The rigid body is left unaffected unless a subsequent independent call is executed that actually applies the computed changes to velocity and angular velocity.

Note:
if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account.
See also:
PxRigidBody::getLinearVelocity, PxRigidBody::setLinearVelocity, PxRigidBody::getAngularVelocity, PxRigidBody::setAngularVelocity
Parameters:
[in] body The body under consideration.
[in] impulsiveForce The impulsive force that would be applied to the specified rigid body.
[in] impulsiveTorque The impulsive torque that would be applied to the specified rigid body.
[out] deltaLinearVelocity The change in linear velocity that would arise if impulsiveForce was to be applied to the specified rigid body.
[out] deltaAngularVelocity The change in angular velocity that would arise if impulsiveTorque was to be applied to the specified rigid body.

static PxVec3 PxRigidBodyExt::getLocalVelocityAtLocalPos ( const PxRigidBody body,
const PxVec3 pos 
) [static]

Computes the velocity of a point given in local coordinates if it were attached to the specified body and moving with it.

Parameters:
[in] body The rigid body the point is attached to.
[in] pos Position we wish to determine the velocity for, defined in the local frame. Range: position vector
Returns:
The velocity of point in the local frame.
See also:
getLocalPointVelocity()

static PxVec3 PxRigidBodyExt::getVelocityAtOffset ( const PxRigidBody body,
const PxVec3 pos 
) [static]

Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the specified body and moving with it.

Parameters:
[in] body The rigid body the point is attached to.
[in] pos Position (offset from the origin of the body) we wish to determine the velocity for, defined in the global frame. Range: position vector
Returns:
The velocity of point (offset from the origin of the body) in the global frame.
See also:
getLocalPointVelocity()

static PxVec3 PxRigidBodyExt::getVelocityAtPos ( const PxRigidBody body,
const PxVec3 pos 
) [static]

Computes the velocity of a point given in world coordinates if it were attached to the specified body and moving with it.

Parameters:
[in] body The rigid body the point is attached to.
[in] pos Position we wish to determine the velocity for, defined in the global frame. Range: position vector
Returns:
The velocity of point in the global frame.
See also:
getLocalPointVelocity()

static PxU32 PxRigidBodyExt::linearSweepMultiple ( PxRigidBody body,
PxScene scene,
const PxVec3 unitDir,
const PxReal  distance,
PxHitFlags  outputFlags,
PxSweepHit touchHitBuffer,
PxU32 touchHitShapeIndices,
PxU32  touchHitBufferSize,
PxSweepHit block,
PxI32 &  blockingShapeIndex,
bool &  overflow,
const PxQueryFilterData filterData = PxQueryFilterData(),
PxQueryFilterCallback filterCall = NULL,
const PxQueryCache cache = NULL,
const PxReal  inflation = 0.0f 
) [static]

Performs a linear sweep through space with the body's geometry objects, returning all overlaps.

Note:
Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored.
This function sweeps all shapes attached to a given rigid body through space and reports all objects in the scene that intersect any of the shapes' swept paths until there are no more objects to report or a blocking hit is encountered.

Parameters:
[in] body The rigid body to sweep.
[in] scene The scene object to process the query.
[in] unitDir Normalized direction of the sweep.
[in] distance Sweep distance. Needs to be larger than 0.
[in] outputFlags Specifies which properties should be written to the hit information.
[out] touchHitBuffer Raycast hit information buffer. If the buffer overflows, an arbitrary subset of touch hits is returned (typically the query should be restarted with a larger buffer).
[out] touchHitShapeIndices After the query is completed, touchHitShapeIndices[i] will contain the body index that caused the hit stored in hitBuffer[i]
[in] touchHitBufferSize Size of both touch hit buffers in elements.
[out] block Closest blocking hit is returned via this reference.
[out] blockingShapeIndex Set to -1 if if a blocking hit was not found, otherwise set to closest blocking hit shape index. The touching hits are reported separately in hitBuffer.
[out] overflow Set to true if touchHitBuffer didn't have enough space for all results. Touch hits will be incomplete if overflow occurred. Possible solution is to restart the query with a larger buffer.
[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, otherwise shape->getQueryFilterData() will be used instead.
[in] filterCall Custom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking.
[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit.
[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal.
Returns:
the number of touching hits. If overflow is set to true, the results are incomplete. In case of overflow there are also no guarantees that all touching hits returned are closer than the blocking hit.
See also:
PxScene PxQueryFlags PxFilterData PxBatchQueryPreFilterShader PxBatchQueryPostFilterShader PxSweepHit

static bool PxRigidBodyExt::linearSweepSingle ( PxRigidBody body,
PxScene scene,
const PxVec3 unitDir,
const PxReal  distance,
PxHitFlags  outputFlags,
PxSweepHit closestHit,
PxU32 shapeIndex,
const PxQueryFilterData filterData = PxQueryFilterData(),
PxQueryFilterCallback filterCall = NULL,
const PxQueryCache cache = NULL,
const PxReal  inflation = 0.0f 
) [static]

Performs a linear sweep through space with the body's geometry objects.

Note:
Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored.

If eTOUCH is returned from the filter callback, it will trigger an error and the hit will be discarded.

The function sweeps all shapes attached to a given rigid body through space and reports the nearest object in the scene which intersects any of of the shapes swept paths. Information about the closest intersection is written to a PxSweepHit structure.

Parameters:
[in] body The rigid body to sweep.
[in] scene The scene object to process the query.
[in] unitDir Normalized direction of the sweep.
[in] distance Sweep distance. Needs to be larger than 0.
[in] outputFlags Specifies which properties should be written to the hit information.
[out] closestHit Closest hit result.
[out] shapeIndex Index of the body shape that caused the closest hit.
[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, otherwise shape->getQueryFilterData() will be used instead.
[in] filterCall Custom filtering logic (optional). Only used if the corresponding PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking.
[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit.
[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal.
Returns:
True if a blocking hit was found.
See also:
PxScene PxQueryFlags PxFilterData PxBatchQueryPreFilterShader PxBatchQueryPostFilterShader PxSweepHit

static bool PxRigidBodyExt::setMassAndUpdateInertia ( PxRigidBody body,
PxReal  mass,
const PxVec3 massLocalPose = NULL,
bool  includeNonSimShapes = false 
) [static]

Computation of mass properties for a rigid body actor.

This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass.

If no collision shapes are found, the inertia tensor is set to (1,1,1)

See also:
updateMassAndInertia for more details.
Parameters:
[in,out] body The rigid body for which to set the mass and centre of mass local pose properties.
[in] mass The mass of the body. Must be greater than 0.
[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE, PxShapeFlag::ePARTICLE_DRAIN) should be taken into account.
Returns:
Boolean. True on success else false.
See also:
PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass

static bool PxRigidBodyExt::setMassAndUpdateInertia ( PxRigidBody body,
const PxReal *  shapeMasses,
PxU32  shapeMassCount,
const PxVec3 massLocalPose = NULL,
bool  includeNonSimShapes = false 
) [static]

Computation of mass properties for a rigid body actor.

This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the sum of all user-supplied shape mass values, and the inertia and center of mass are computed according to the rigid body's shapes and the per shape mass input values.

If no collision shapes are found, the inertia tensor is set to (1,1,1)

Note:
If a single mass value should be used for the actor as a whole then the overloaded method setMassAndUpdateInertia() with a single mass parameter can be used instead.
See also:
updateMassAndInertia for more details.
Parameters:
[in,out] body The rigid body for which to set the mass and centre of mass local pose properties.
[in] shapeMasses The per shape mass values. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set. Other shapes are ignored. The mass values must be greater than 0.
[in] shapeMassCount The number of provided mass values.
[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE, PxShapeFlag::ePARTICLE_DRAIN) should be taken into account.
Returns:
Boolean. True on success else false.
See also:
PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass

static bool PxRigidBodyExt::updateMassAndInertia ( PxRigidBody body,
PxReal  density,
const PxVec3 massLocalPose = NULL,
bool  includeNonSimShapes = false 
) [static]

Computation of mass properties for a rigid body actor.

See previous method for details.

Parameters:
[in,out] body The rigid body.
[in] density The density of the body. Used to compute the mass of the body. The density must be greater than 0.
[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE, PxShapeFlag::ePARTICLE_DRAIN) should be taken into account.
Returns:
Boolean. True on success else false.
See also:
PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass

static bool PxRigidBodyExt::updateMassAndInertia ( PxRigidBody body,
const PxReal *  shapeDensities,
PxU32  shapeDensityCount,
const PxVec3 massLocalPose = NULL,
bool  includeNonSimShapes = false 
) [static]

Computation of mass properties for a rigid body actor.

To simulate a dynamic rigid actor, the SDK needs a mass and an inertia tensor.

This method offers functionality to compute the necessary mass and inertia properties based on the shapes declared in the PxRigidBody descriptor and some additionally specified parameters. For each shape, the shape geometry, the shape positioning within the actor and the specified shape density are used to compute the body's mass and inertia properties.

This method will set the mass, center of mass, and inertia tensor

if no collision shapes are found, the inertia tensor is set to (1,1,1) and the mass to 1

if massLocalPose is non-NULL, the rigid body's center of mass parameter will be set to the user provided value (massLocalPose) and the inertia tensor will be resolved at that point.

Note:
If all shapes of the actor have the same density then the overloaded method updateMassAndInertia() with a single density parameter can be used instead.
Parameters:
[in,out] body The rigid body.
[in] shapeDensities The per shape densities. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set (or for all shapes if includeNonSimShapes is set to true). Other shapes are ignored. The density values must be greater than 0.
[in] shapeDensityCount The number of provided density values.
[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed.
[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE, PxShapeFlag::ePARTICLE_DRAIN) should be taken into account.
Returns:
Boolean. True on success else false.
See also:
PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass


The documentation for this class was generated from the following file:


Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com