PxRigidActor

Defined in include/PxRigidActor.h

class PxRigidActor : public PxActor

PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SDK.

PxRigidActor objects specify the geometry of the object by defining a set of attached shapes (see PxShape).

See also

PxActor

Subclassed by PxRigidBody, PxRigidStatic

Global Pose Manipulation

virtual PxTransform getGlobalPose() const = 0

Retrieves the actors world space transform.

The getGlobalPose() method retrieves the actor’s current actor space to world space transformation.

Note

It is not allowed to use this method while the simulation is running (except during PxScene::collide(), in PxContactModifyCallback or in contact report callbacks).

Returns

Global pose of object.

virtual void setGlobalPose(const PxTransform &pose, bool autowake = true) = 0

Method for setting an actor’s pose in the world.

This method instantaneously changes the actor space to world space transformation.

This method is mainly for dynamic rigid bodies (see PxRigidDynamic). Calling this method on static actors is likely to result in a performance penalty, since internal optimization structures for static actors may need to be recomputed. In addition, moving static actors will not interact correctly with dynamic actors or joints.

To directly control an actor’s position and have it correctly interact with dynamic bodies and joints, create a dynamic body with the PxRigidBodyFlag::eKINEMATIC flag, then use the setKinematicTarget() commands to define its path.

Even when moving dynamic actors, exercise restraint in making use of this method. Where possible, avoid:

  • moving actors into other actors, thus causing overlap (an invalid physical state)

  • moving an actor that is connected by a joint to another away from the other (thus causing joint error)

Sleeping: This call wakes dynamic actors if they are sleeping and the autowake parameter is true (default).

See also

getGlobalPose()

Note

It is not allowed to use this method if the actor is part of a PxPruningStructure that has not been added to a scene yet.

Parameters
  • pose[in] Transformation from the actors local frame to the global frame. Range: rigid body transform.

  • autowake[in] whether to wake the object if it is dynamic. This parameter has no effect for static or kinematic actors. If true and the current wake counter value is smaller than PxSceneDesc::wakeCounterResetValue it will get increased to the reset value.

Shapes

virtual bool attachShape(PxShape &shape) = 0

Attach a shape to an actor.

This call will increment the reference count of the shape.

Attaching a triangle mesh, heightfield or plane geometry shape configured as eSIMULATION_SHAPE is not supported for non-kinematic PxRigidDynamic instances.

Sleeping: Does NOT wake the actor up automatically.

Note

Mass properties of dynamic rigid actors will not automatically be recomputed to reflect the new mass distribution implied by the shape. Follow this call with a call to the PhysX extensions method PxRigidBodyExt::updateMassAndInertia() to do that.

Parameters

shape[in] the shape to attach.

Returns

True if success.

virtual void detachShape(PxShape &shape, bool wakeOnLostTouch = true) = 0

Detach a shape from an actor.

This will also decrement the reference count of the PxShape, and if the reference count is zero, will cause it to be deleted.

Sleeping: Does NOT wake the actor up automatically.

Parameters
  • shape[in] the shape to detach.

  • wakeOnLostTouch[in] Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types.

virtual PxU32 getNbShapes() const = 0

Returns the number of shapes assigned to the actor.

You can use getShapes() to retrieve the shape pointers.

See also

PxShape getShapes()

Returns

Number of shapes associated with this actor.

virtual PxU32 getShapes(PxShape **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Retrieve all the shape pointers belonging to the actor.

These are the shapes used by the actor for collision detection.

You can retrieve the number of shape pointers by calling getNbShapes()

Note: Removing shapes with PxShape::release() will invalidate the pointer of the released shape.

Parameters
  • userBuffer[out] The buffer to store the shape pointers.

  • bufferSize[in] Size of provided user buffer.

  • startIndex[in] Index of first shape pointer to be retrieved

Returns

Number of shape pointers written to the buffer.

Constraints

virtual PxU32 getNbConstraints() const = 0

Returns the number of constraint shaders attached to the actor.

You can use getConstraints() to retrieve the constraint shader pointers.

Returns

Number of constraint shaders attached to this actor.

virtual PxU32 getConstraints(PxConstraint **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Retrieve all the constraint shader pointers belonging to the actor.

You can retrieve the number of constraint shader pointers by calling getNbConstraints()

Note: Removing constraint shaders with PxConstraint::release() will invalidate the pointer of the released constraint.

Parameters
  • userBuffer[out] The buffer to store the constraint shader pointers.

  • bufferSize[in] Size of provided user buffer.

  • startIndex[in] Index of first constraint pointer to be retrieved

Returns

Number of constraint shader pointers written to the buffer.

inline PxRigidActor(PxType concreteType, PxBaseFlags baseFlags)
inline PxRigidActor(PxBaseFlags baseFlags)
inline virtual ~PxRigidActor()
inline virtual bool isKindOf(const char *name) const

Returns whether a given type name matches with the type of this instance.

Public Functions

virtual void release() = 0

Deletes the rigid actor object.

Also releases any shapes associated with the actor.

Releasing an actor will affect any objects that are connected to the actor (constraint shaders like joints etc.). Such connected objects will be deleted upon scene deletion, or explicitly by the user by calling release() on these objects. It is recommended to always remove all objects that reference actors before the actors themselves are removed. It is not possible to retrieve list of dead connected objects.

Sleeping: This call will awaken any sleeping actors contacting the deleted actor (directly or indirectly).

Calls PxActor::release() so you might want to check the documentation of that method as well.

virtual PxU32 getInternalActorIndex() const = 0

Returns the internal actor index.

Warning

This is only defined for actors that have been added to a scene.

Returns

The internal actor index, or 0xffffffff if the actor is not part of a scene.

virtual PxActorType::Enum getType() const = 0

Retrieves the type of actor.

See also

PxActorType

Returns

The actor type of the actor.

virtual PxScene *getScene() const = 0

Retrieves the scene which this actor belongs to.

See also

PxScene

Returns

Owner Scene. NULL if not part of a scene.

virtual void setName(const char *name) = 0

Sets a name string for the object that can be retrieved with getName().

This is for debugging and is not used by the SDK. The string is not copied by the SDK, only the pointer is stored.

Default: NULL

See also

getName()

Parameters

name[in] String to set the objects name to.

virtual const char *getName() const = 0

Retrieves the name string set with setName().

See also

setName()

Returns

Name string associated with object.

virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const = 0

Retrieves the axis aligned bounding box enclosing the actor.

See also

PxBounds3

Note

It is not allowed to use this method while the simulation is running (except during PxScene::collide(), in PxContactModifyCallback or in contact report callbacks).

Parameters

inflation[in] Scale factor for computed world bounds. Box extents are multiplied by this value.

Returns

The actor’s bounding box.

virtual void setActorFlag(PxActorFlag::Enum flag, bool value) = 0

Raises or clears a particular actor flag.

See the list of flags PxActorFlag

Sleeping: Does NOT wake the actor up automatically.

Parameters
  • flag[in] The PxActor flag to raise(set) or clear. See PxActorFlag.

  • value[in] The boolean value to assign to the flag.

virtual void setActorFlags(PxActorFlags inFlags) = 0

Sets the actor flags.

See the list of flags PxActorFlag

virtual PxActorFlags getActorFlags() const = 0

Reads the PxActor flags.

See the list of flags PxActorFlag

Returns

The values of the PxActor flags.

virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) = 0

Assigns dynamic actors a dominance group identifier.

PxDominanceGroup is a 5 bit group identifier (legal range from 0 to 31).

The PxScene::setDominanceGroupPair() lets you set certain behaviors for pairs of dominance groups. By default every dynamic actor is created in group 0.

Default: 0

Sleeping: Changing the dominance group does NOT wake the actor up automatically.

Parameters

dominanceGroup[in] The dominance group identifier. Range: [0..31]

virtual PxDominanceGroup getDominanceGroup() const = 0

Retrieves the value set with setDominanceGroup().

Returns

The dominance group of this actor.

virtual void setOwnerClient(PxClientID inClient) = 0

Sets the owner client of an actor.

This cannot be done once the actor has been placed into a scene.

Default: PX_DEFAULT_CLIENT

See also

PxClientID PxScene::createClient()

virtual PxClientID getOwnerClient() const = 0

Returns the owner client that was specified at creation time.

This value cannot be changed once the object is placed into the scene.

See also

PxClientID PxScene::createClient()

virtual PxAggregate *getAggregate() const = 0

Retrieves the aggregate the actor might be a part of.

See also

PxAggregate

Returns

The aggregate the actor is a part of, or NULL if the actor does not belong to an aggregate.

virtual const char *getConcreteTypeName() const = 0

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

template<class T>
inline T *is()
template<class T>
inline const T *is() const
inline PxType getConcreteType() const

Returns concrete type of object.

See also

PxConcreteType

Returns

PxConcreteType::Enum of serialized object

inline void setBaseFlag(PxBaseFlag::Enum flag, bool value)

Set PxBaseFlag

Parameters
  • flag[in] The flag to be set

  • value[in] The flags new value

inline void setBaseFlags(PxBaseFlags inFlags)

Set PxBaseFlags

See also

PxBaseFlags

Parameters

inFlags[in] The flags to be set

inline PxBaseFlags getBaseFlags() const

Returns PxBaseFlags.

See also

PxBaseFlags

Returns

PxBaseFlags

inline virtual bool isReleasable() const

Whether the object is subordinate.

A class is subordinate, if it can only be instantiated in the context of another class.

Returns

Whether the class is subordinate

Public Members

void *userData

user can assign this to whatever, usually to create a 1:1 relationship with a user object.

Protected Functions

template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount