PxMassProperties#

Defined in include/extensions/PxMassProperties.h

class PxMassProperties#

Utility class to compute and manipulate mass and inertia tensor properties.

In most cases PxRigidBodyExt::updateMassAndInertia(), PxRigidBodyExt::setMassAndUpdateInertia() should be enough to setup the mass properties of a rigid body. This utility class targets users that need to customize the mass properties computation.

Public Functions

inline PxMassProperties()#

Default constructor.

inline PxMassProperties(
const PxReal m,
const PxMat33 &inertiaT,
const PxVec3 &com,
)#

Construct from individual elements.

inline PxMassProperties(const PxGeometry &geometry)#

Compute mass properties based on a provided geometry structure.

This constructor assumes the geometry has a density of 1. Mass and inertia tensor scale linearly with density.

Parameters:

geometry[in] The geometry to compute the mass properties for. Supported geometry types are: sphere, box, capsule and convex mesh.

inline PxMassProperties operator*(const PxReal scale) const#

Scale mass properties.

Parameters:

scale[in] The linear scaling factor to apply to the mass properties.

Returns:

The scaled mass properties.

inline void translate(const PxVec3 &t)#

Translate the center of mass by a given vector and adjust the inertia tensor accordingly.

Parameters:

t[in] The translation vector for the center of mass.

Public Members

PxMat33 inertiaTensor#

The inertia tensor of the object.

PxVec3 centerOfMass#

The center of mass of the object.

PxReal mass#

The mass of the object.

Public Static Functions

static inline PxVec3 getMassSpaceInertia(
const PxMat33 &inertia,
PxQuat &massFrame,
)#

Get the entries of the diagonalized inertia tensor and the corresponding reference rotation.

Parameters:
  • inertia[in] The inertia tensor to diagonalize.

  • massFrame[out] The frame the diagonalized tensor refers to.

Returns:

The entries of the diagonalized inertia tensor.

static inline PxMat33 translateInertia(
const PxMat33 &inertia,
const PxReal mass,
const PxVec3 &t,
)#

Translate an inertia tensor using the parallel axis theorem.

Parameters:
  • inertia[in] The inertia tensor to translate.

  • mass[in] The mass of the object.

  • t[in] The relative frame to translate the inertia tensor to.

Returns:

The translated inertia tensor.

static inline PxMat33 rotateInertia(
const PxMat33 &inertia,
const PxQuat &q,
)#

Rotate an inertia tensor around the center of mass.

Parameters:
  • inertia[in] The inertia tensor to rotate.

  • q[in] The rotation from the new to the old coordinate frame, i.e. q.rotate(v) transforms the coordinates of vector v from the old to the new coordinate frame.

Returns:

The rotated inertia tensor.

static inline PxMat33 scaleInertia(
const PxMat33 &inertia,
const PxQuat &scaleRotation,
const PxVec3 &scale,
)#

Non-uniform scaling of the inertia tensor.

Parameters:
  • inertia[in] The inertia tensor to scale.

  • scaleRotation[in] The rotation from the scaling frame to the frame that inertia is expressed in. I.e. scaleRotation.rotate(v) transforms the coordinates of vertex v from inertia’s frame to the scaling-axes frame.

  • scale[in] The scaling factor for each axis (relative to the frame specified with scaleRotation).

Returns:

The scaled inertia tensor.

static inline PxMassProperties sum(
const PxMassProperties *props,
const PxTransform *transforms,
const PxU32 count,
)#

Sum up individual mass properties.

Parameters:
  • props[in] Array of mass properties to sum up.

  • transforms[in] Reference transforms for each mass properties entry.

  • count[in] The number of mass properties to sum up.

Returns:

The summed up mass properties.