PxRigidBodyExt Class Reference
[Extensions]
utility functions for use with PxRigidBody and subclasses
More...
#include <PxRigidBodyExt.h>
Static Public Member Functions | |
static bool | updateMassAndInertia (PxRigidBody &body, const PxReal *shapeDensities, PxU32 shapeDensityCount, const PxVec3 *massLocalPose=NULL) |
Computation of mass properties for a rigid body actor. | |
static bool | updateMassAndInertia (PxRigidBody &body, PxReal density, const PxVec3 *massLocalPose=NULL) |
Computation of mass properties for a rigid body actor. | |
static bool | setMassAndUpdateInertia (PxRigidBody &body, const PxReal *shapeMasses, PxU32 shapeMassCount, const PxVec3 *massLocalPose=NULL) |
Computation of mass properties for a rigid body actor. | |
static bool | setMassAndUpdateInertia (PxRigidBody &body, PxReal mass, const PxVec3 *massLocalPose=NULL) |
Computation of mass properties for a rigid body actor. | |
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 void | linearSweepSingle (PxRigidBody &body, PxBatchQuery &batchQuery, const PxVec3 &unitDir, const PxReal distance, PxSceneQueryFilterFlags filterFlags, bool useShapeFilterData=true, PxFilterData *filterDataList=NULL, PxU32 filterDataCount=0, void *userData=NULL, const PxSweepCache *sweepCache=NULL) |
Performs a linear sweep through space with the body's geometry objects. | |
static void | linearSweepMultiple (PxRigidBody &body, PxBatchQuery &batchQuery, const PxVec3 &unitDir, const PxReal distance, PxSceneQueryFilterFlags filterFlags, bool useShapeFilterData=true, PxFilterData *filterDataList=NULL, PxU32 filterDataCount=0, void *userData=NULL, const PxSweepCache *sweepCache=NULL) |
Performs a linear sweep through space with the body's geometry objects, returning all overlaps. |
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.
PxForceMode determines if the force is to be conventional or impulsive.
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). Only eFORCE and eIMPULSE are supported. [in] wakeup Specify if the call should wake up the actor.
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.
PxForceMode determines if the force is to be conventional or impulsive.
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). Only eFORCE and eIMPULSE are supported. [in] wakeup Specify if the call should wake up the actor.
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.
PxForceMode determines if the force is to be conventional or impulsive.
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). Only eFORCE and eIMPULSE are supported. [in] wakeup Specify if the call should wake up the actor.
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.
PxForceMode determines if the force is to be conventional or impulsive.
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). Only eFORCE and eIMPULSE are supported. [in] wakeup Specify if the call should wake up the actor.
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 void PxRigidBodyExt::linearSweepMultiple | ( | PxRigidBody & | body, | |
PxBatchQuery & | batchQuery, | |||
const PxVec3 & | unitDir, | |||
const PxReal | distance, | |||
PxSceneQueryFilterFlags | filterFlags, | |||
bool | useShapeFilterData = true , |
|||
PxFilterData * | filterDataList = NULL , |
|||
PxU32 | filterDataCount = 0 , |
|||
void * | userData = NULL , |
|||
const PxSweepCache * | sweepCache = NULL | |||
) | [static] |
Performs a linear sweep through space with the body's geometry objects, returning all overlaps.
- Note:
- Supported geometries are: PxBoxGeometry, PxSphereGeometry, PxCapsuleGeometry. Other geometry types will be ignored.
Internally this call is mapped to PxBatchQuery::linearCompoundGeometrySweepMultiple().
- Parameters:
-
[in] body The rigid body to sweep. [in] batchQuery The scene query object to process the query. [in] unitDir Normalized direction of the sweep. [in] distance Sweep distance. Needs to be larger than 0. [in] filterFlags Choose if to sweep against static, dynamic or both types of objects, or other filter logic. See PxSceneQueryFilterFlags. [in] useShapeFilterData True if the filter data of the body shapes should be used for the query. False if no filtering is needed or separate filter data is provided. [in] filterDataList Custom filter data to use for each geometry object of the body. Only considered if useShapeFilterData is false. [in] filterDataCount Number of filter data entries [in] userData user can assign this to a value of his choice, usually to identify this particular query [in] sweepCache Sweep cache to use with the query
- Returns:
- returns the all overlapping objects.
static void PxRigidBodyExt::linearSweepSingle | ( | PxRigidBody & | body, | |
PxBatchQuery & | batchQuery, | |||
const PxVec3 & | unitDir, | |||
const PxReal | distance, | |||
PxSceneQueryFilterFlags | filterFlags, | |||
bool | useShapeFilterData = true , |
|||
PxFilterData * | filterDataList = NULL , |
|||
PxU32 | filterDataCount = 0 , |
|||
void * | userData = NULL , |
|||
const PxSweepCache * | sweepCache = NULL | |||
) | [static] |
Performs a linear sweep through space with the body's geometry objects.
- Note:
- Supported geometries are: PxBoxGeometry, PxSphereGeometry, PxCapsuleGeometry. Other geometry types will be ignored.
Internally this call is mapped to PxBatchQuery::linearCompoundGeometrySweepSingle().
- Parameters:
-
[in] body The rigid body to sweep. [in] batchQuery The scene query object to process the query. [in] unitDir Normalized direction of the sweep. [in] distance Sweep distance. Needs to be larger than 0. [in] filterFlags Choose if to sweep against static, dynamic or both types of objects, or other filter logic. See PxSceneQueryFilterFlags. [in] useShapeFilterData True if the filter data of the body shapes should be used for the query. False if no filtering is needed or separate filter data is provided. [in] filterDataList Custom filter data to use for each geometry object of the body. Only considered if useShapeFilterData is false. [in] filterDataCount Number of filter data entries [in] userData user can assign this to a value of his choice, usually to identify this particular query [in] sweepCache Sweep cache to use with the query
- Returns:
- returns the closest overlapping object.
static bool PxRigidBodyExt::setMassAndUpdateInertia | ( | PxRigidBody & | body, | |
PxReal | mass, | |||
const PxVec3 * | massLocalPose = NULL | |||
) | [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 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.
- Returns:
- Boolean. True on success else false.
- See also:
- PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertia PxRigidBody::setMass
static bool PxRigidBodyExt::setMassAndUpdateInertia | ( | PxRigidBody & | body, | |
const PxReal * | shapeMasses, | |||
PxU32 | shapeMassCount, | |||
const PxVec3 * | massLocalPose = NULL | |||
) | [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 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.
- Returns:
- Boolean. True on success else false.
- See also:
- PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertia PxRigidBody::setMass
static bool PxRigidBodyExt::updateMassAndInertia | ( | PxRigidBody & | body, | |
PxReal | density, | |||
const PxVec3 * | massLocalPose = NULL | |||
) | [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.
- Returns:
- Boolean. True on success else false.
- See also:
- PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertia PxRigidBody::setMass
static bool PxRigidBodyExt::updateMassAndInertia | ( | PxRigidBody & | body, | |
const PxReal * | shapeDensities, | |||
PxU32 | shapeDensityCount, | |||
const PxVec3 * | massLocalPose = NULL | |||
) | [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.
- Shapes without PxShapeFlag::eSIMULATION_SHAPE set are ignored.
- Shapes with plane, triangle mesh or heightfield geometry and PxShapeFlag::eSIMULATION_SHAPE set are not allowed for PxRigidBody collision
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. 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.
- Returns:
- Boolean. True on success else false.
- See also:
- PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertia PxRigidBody::setMass
The documentation for this class was generated from the following file:
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com