PxRigidActorExt

Defined in include/extensions/PxRigidActorExt.h

class PxRigidActorExt

utility functions for use with PxRigidActor and subclasses

Public Static Functions

static inline PxShape *createExclusiveShape(PxRigidActor &actor, const PxGeometry &geometry, PxMaterial *const *materials, PxU16 materialCount, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)

Creates a new shape with default properties and a list of materials and adds it to the list of shapes of this actor.

This is equivalent to the following

PxShape* shape(…) = PxGetPhysics().createShape(…); // reference count is 1 actor->attachShape(shape); // increments reference count shape->release(); // releases user reference, leaving reference count at 1

As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted.

Sleeping: Does NOT wake the actor up automatically.

Note

The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see PxShapeFlag). Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for non-kinematic PxRigidDynamic instances.

Note

Creating compounds with a very large number of shapes may adversely affect performance and stability.

Parameters
  • actor[in] the actor to which to attach the shape

  • geometry[in] the geometry of the shape

  • materials[in] a pointer to an array of material pointers

  • materialCount[in] the count of materials

  • shapeFlags[in] optional PxShapeFlags

Returns

The newly created shape.

static inline PxShape *createExclusiveShape(PxRigidActor &actor, const PxGeometry &geometry, const PxMaterial &material, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE)

Creates a new shape with default properties and a single material adds it to the list of shapes of this actor.

This is equivalent to the following

PxShape* shape(…) = PxGetPhysics().createShape(…); // reference count is 1 actor->attachShape(shape); // increments reference count shape->release(); // releases user reference, leaving reference count at 1

As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted.

Sleeping: Does NOT wake the actor up automatically.

Note

The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see PxShapeFlag). Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for non-kinematic PxRigidDynamic instances.

Note

Creating compounds with a very large number of shapes may adversely affect performance and stability.

Parameters
  • actor[in] the actor to which to attach the shape

  • geometry[in] the geometry of the shape

  • material[in] the material for the shape

  • shapeFlags[in] optional PxShapeFlags

Returns

The newly created shape.

static PxBounds3 *getRigidActorShapeLocalBoundsList(const PxRigidActor &actor, PxU32 &numBounds)

Gets a list of bounds based on shapes in rigid actor.

This list can be used to cook/create bounding volume hierarchy though PxCooking API.

See also

PxShape PxBVH PxCooking::createBVH PxCooking::cookBVH

Parameters
  • actor[in] The actor from which the bounds list is retrieved.

  • numBounds[out] Number of bounds in returned list.

static PxBVH *createBVHFromActor(PxPhysics &physics, const PxRigidActor &actor)

Convenience function to create a PxBVH object from a PxRigidActor.

The computed PxBVH can then be used in PxScene::addActor() or PxAggregate::addActor(). After adding the actor & BVH to the scene/aggregate, release the PxBVH object by calling PxBVH::release().

Parameters
  • physics[in] The physics object. The function will retrieve the insertion callback from it.

  • actor[in] The actor to compute a PxBVH for.

Returns

The PxBVH for this actor.