PxDeformableBody

Defined in include/PxDeformableBody.h

class PxDeformableBody : public PxActor

Represents a deformable body, a base class for deformable actors.

See also

PxDeformableSurface, PxDeformableVolume, PxActor

Subclassed by PxDeformableSurface, PxDeformableVolume

Environment ID

virtual bool setEnvironmentID(PxU32 envID) = 0

Sets the environment ID for this actor.

The environment ID is an extra built-in filter group for the GPU broadphase. Actors will only collide with each-other if they have the same environment ID.

The default value is PX_INVALID_U32. Actors with this ID will collide with other actors, regardless of which environment they are a part of.

The environment ID must be set before adding the actor to a scene, and cannot change while the actor is in the scene.

If it is not PX_INVALID_U32, the environment ID must be smaller than 1<<24, i.e. the system does not support more than 1<<24 environments.

Default: PX_INVALID_U32

See also

getEnvironmentID()

Note

This is not available for CPU broadphases.

Parameters

envID[in] Environment ID for this actor.

Returns

True if success.

virtual PxU32 getEnvironmentID() const = 0

Returns the environment ID for this actor.

See also

setEnvironmentID()

Returns

Environment ID for this actor.

void *userData

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

Public Functions

virtual void setDeformableBodyFlag(PxDeformableBodyFlag::Enum flag, bool val) = 0

Raises or clears a particular deformable body flag.

See the list of flags PxDeformableBodyFlag

Default: No flags are set

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

  • val[in] The new boolean value for the flag.

virtual void setDeformableBodyFlags(PxDeformableBodyFlags flags) = 0

Sets deformable body flags.

See the list of flags PxDeformableBodyFlag

Default: No flags are set

Parameters

flags[in] The PxDeformableBodyFlags to set.

virtual PxDeformableBodyFlags getDeformableBodyFlags() const = 0

Reads the deformable body flags.

See the list of flags PxDeformableBodyFlag

See also

setDeformableBodyFlag()

Returns

The values of the deformable body flags.

virtual void setLinearDamping(const PxReal linearDamping) = 0

Sets the linear damping parameter.

After every timestep the velocity is reduced while the magnitude of the reduction depends on the linearDamping value.

See also

PxRigidBody.setLinearDamping Default: 0.05

Parameters

linearDamping[in] The linear damping parameter

virtual PxReal getLinearDamping() const = 0

Retrieves linear velocity damping parameter.

See also

setLinearDamping

Returns

The linear damping parameter

virtual void setMaxVelocity(const PxReal maxVelocity) = 0

Sets the maximal velocity vertices can reach.

Allows to limit the vertices’ maximal velocity to control the maximal distance a vertex can move per frame Default: 0.0, which means the limit is ignored.

Parameters

maxVelocity[in] The maximal velocity

virtual PxReal getMaxVelocity() const = 0

Retrieves maximal velocity a vertex can have.

Returns

The maximal velocity

virtual void setMaxDepenetrationVelocity(const PxReal maxDepenetrationVelocity) = 0

Sets the maximal depenetration velocity vertices can reach.

Allows to limit the vertices’ maximal depenetration velocity to avoid that collision responses lead to very high particle velocities Default: 0.0, which means the limit is ignored.

Parameters

maxDepenetrationVelocity[in] The maximal depenetration velocity

virtual PxReal getMaxDepenetrationVelocity() const = 0

Retrieves maximal depenetration velocity a vertex can have.

Returns

The maximal depenetration velocity

virtual void setSelfCollisionFilterDistance(const PxReal selfCollisionFilterDistance) = 0

Sets the self collision filter distance.

Penetration distance that needs to be exceeded before contacts for self collision are generated. Will only have an effect if self collisions are enabled. Default: 0.1

Parameters

selfCollisionFilterDistance[in] The self collision filter distance

virtual PxReal getSelfCollisionFilterDistance() const = 0

Retrieves the self collision filter distance.

See also

setSelfCollisionFilterDistance

Returns

The self collision filter distance

virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0

Sets the solver iteration count for the deformable body.

Since deformables are currently implemented using an XPBD solver (extended position based dynamics), minVelocityIters is ignored. Default: 4 position iterations, 1 velocity iteration

See also

getSolverIterationCounts()

Parameters
  • minPositionIters[in] Number of position iterations the solver should perform for this deformable body. Range: [1,255]

  • minVelocityIters[in] Number of velocity iterations, currently ignored. Range: [1,255]

virtual void getSolverIterationCounts(PxU32 &minPositionIters, PxU32 &minVelocityIters) const = 0

Retrieves the solver iteration counts.

See also

setSolverIterationCounts()

virtual void setSleepThreshold(const PxReal sleepThreshold) = 0

Sets the threshold controlling sleeping of the deformable body.

Threshold that defines the maximal magnitude of the linear motion a deformable body can move in one second before it becomes a candidate for sleeping.

See also

PxRigidDynamic.setSleepThreshold Default: 0.05

Parameters

sleepThreshold[in] The sleep threshold

virtual PxReal getSleepThreshold() const = 0

Retrieves the sleep threshold.

See also

setSleepThreshold

Returns

The sleep threshold

virtual void setSettlingThreshold(const PxReal settlingThreshold) = 0

Sets the threshold controlling settling phase before sleeping of the deformable body.

Threshold that defines the maximal magnitude of the linear motion a deformable body can move in one second before it becomes a candidate for sleeping and settling damping is engaged. The settling threshold needs to be higher than the sleep threshold. Default: 0.1

See also

setSettlingDamping

Parameters

settlingThreshold[in] The settling threshold

virtual PxReal getSettlingThreshold() const = 0

Retrieves the settling threshold.

See also

setSettlingThreshold

Returns

The settling threshold

virtual void setSettlingDamping(const PxReal settlingDamping) = 0

Sets the damping parameter used for settling phase.

If the maximum linear velocity of the deformable body falls below the settling threshold, the deformable body enters the settling phase in which the settling damping is applied.

Default: 10.0

See also

setLinearDamping, setSettlingThreshold

Parameters

settlingDamping[in] The settling damping

virtual PxReal getSettlingDamping() const = 0

Retrieves settling damping parameter.

See also

setSettlingDamping

Returns

The settling damping parameter

virtual void setWakeCounter(PxReal wakeCounterValue) = 0

Sets the wake counter for the deformable body.

The wake counter value determines the minimum amount of time until the deformable body can be put to sleep. Please note that a deformable body will not be put to sleep if any vertex velocity is above the specified threshold or if other awake objects are touching it.

Default: 0.4 (which corresponds to 20 frames for a time step of 0.02)

See also

isSleeping() getWakeCounter()

Note

Passing in a positive value will wake the deformable body up automatically.

Parameters

wakeCounterValue[in] Wake counter value. Range: [0, PX_MAX_F32)

virtual PxReal getWakeCounter() const = 0

Returns the wake counter of the deformable body.

See also

isSleeping() setWakeCounter()

Returns

The wake counter of the deformable body.

virtual bool isSleeping() const = 0

Returns true if this deformable body is sleeping.

When an actor does not move for a period of time, it is no longer simulated in order to save time. This state is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, or a sleep-affecting property is changed by the user, the entire sleep mechanism should be transparent to the user.

A deformable volume can only go to sleep if all vertices are ready for sleeping. A deformable body is guaranteed to be awake if at least one of the following holds:

  • The wake counter is positive (

    See also

    setWakeCounter()).

  • The velocity of any vertex is above the sleep threshold.

If a deformable body is sleeping, the following state is guaranteed:

  • The wake counter is zero.

  • The linear velocity of all vertices is zero.

When a deformable body gets inserted into a scene, it will be considered asleep if all the points above hold, else it will be treated as awake.

See also

isSleeping()

Note

It is invalid to use this method if the deformable body has not been added to a scene already.

Returns

True if the deformable body is sleeping.

virtual PxShape *getShape() = 0

Retrieve a shape pointer belonging to the actor.

See also

PxShape getNbShapes() PxShape::release()

virtual bool attachShape(PxShape &shape) = 0

Attaches a shape.

Attaches the shape to use for collision detection for deformable surfaces and volumes. Each deformable needs to have exactly one exclusive shape attached for simulation. If a shape has already been attached to a deformable, detachShape needs to be called prior to attaching a new shape.

Deformable surfaces need a shape with triangle mesh geometry, which can be created with PxPhysics::createShape(const PxGeometry&, const PxDeformableSurfaceMaterial& material, bool, PxShapeFlags), or PxPhysics::createShape(const PxGeometry&, PxDeformableSurfaceMaterial*const*, PxU16, bool, PxShapeFlags) Deformable surfaces use the same triangle mesh for collision detection and dynamics computations.

Deformable volumes need a shape with tetrahedron mesh geometry, which can be created with PxPhysics::createShape(const PxGeometry&, const PxDeformableVolumeMaterial& material, bool, PxShapeFlags), or PxPhysics::createShape(const PxGeometry&, PxDeformableVolumeMaterial*const*, PxU16, bool, PxShapeFlags) Deformable volumes additionally need a separate tetrahedron mesh for dynamics, which can be attached using PxDeformbleVolume::attachSimulationMesh.

Parameters

shape[in] The shape to use for collisions, (and dynamics in case of deformable surfaces)

Returns

Returns true if the operation was successful

virtual void detachShape() = 0

Detaches the shape.

Detaches the shape used for collision detection.

See also

void PxDeformableVolume.detachSimulationMesh()

virtual PxCudaContextManager *getCudaContextManager() const = 0

Returns the cuda context manager.

Returns

The cuda context manager

virtual void setParameter(const PxFEMParameters &params) = 0

Deprecated: Sets parameters for FEM internal solve.

See also

getParameter()

Parameters

params[in] parameters

virtual PxFEMParameters getParameter() const = 0

Deprecated: Gets parameters for FEM internal solve.

See also

setParameter()

Returns

parameters

virtual void release() = 0

Deletes the actor.

Do not keep a reference to the deleted instance.

If the actor belongs to a PxAggregate object, it is automatically removed from the aggregate.

See also

PxBase.release(), PxAggregate

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.

See also

PxActorFlag getActorFlags()

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

See also

PxActorFlag setActorFlag()

virtual PxActorFlags getActorFlags() const = 0

Reads the PxActor flags.

See the list of flags PxActorFlag

See also

PxActorFlag setActorFlag()

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.

See also

getDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair()

Parameters

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

virtual PxDominanceGroup getDominanceGroup() const = 0

Retrieves the value set with setDominanceGroup().

See also

setDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair()

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.

See also

PxSerialization::isSerializable

Returns

Whether the class is subordinate

Protected Functions

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

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

template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount