PxSoftBody

Defined in include/PxSoftBody.h

class PxSoftBody : public PxActor

Represents a FEM softbody including everything to calculate its definition like geometry and material properties.

Public Functions

inline virtual ~PxSoftBody()
virtual void setSoftBodyFlag(PxSoftBodyFlag::Enum flag, bool val) = 0

Set a single softbody flag.

Parameters
  • flag[in] The flag to set or clear

  • val[in] The new state of the flag

virtual void setSoftBodyFlags(PxSoftBodyFlags flags) = 0

Set the softbody flags.

Parameters

flags[in] The new softbody flags

virtual PxSoftBodyFlags getSoftBodyFlag() const = 0

Get the softbody flags.

Returns

The softbody flags

virtual void setParameter(PxFEMParameters parameters) = 0

Set parameter for FEM internal solve.

Parameters

parameters[in] The FEM parameters

virtual PxFEMParameters getParameter() const = 0

Get parameter for FEM internal solve.

Returns

The FEM parameters

virtual PxVec4 *getPositionInvMassBufferD() = 0

Get a pointer to a device buffer containing positions and inverse masses of the collision mesh.

This function returns a pointer to device memory for the positions and inverse masses of the soft body. This buffer is used to both initialize/update the collision mesh vertices of the soft body and read the simulation results.

The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The first 3 floats specify the vertex position and the last float contains the inverse mass of the vertex. The size of the buffer is the number of vertices of the collision mesh * sizeof(PxVec4).

The device memory pointed to by this pointer is allocated when a shape is attached to the softbody. Calling

PxSoftBody::detachShape() will deallocate the memory.

It is not allowed to write to this buffer from the start of the PxScene::simulate() call until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks have finished, reading the data during a completion task is explicitly allowed. The simulation will read and write directly from/into this buffer.

It is the users’ responsibility to initialize this buffer with the initial positions of the vertices of the collision mesh. See PxSoftBodyExt::allocateAndInitializeHostMirror(), PxSoftBodyExt::copyToDevice().

Note

It is mandatory to call PxSoftBody::markDirty() with PxSoftBodyDataFlag::ePOSITION_INVMASS when updating data in this buffer.

Returns

PxVec4* A pointer to a device buffer containing positions and inverse masses of the collision mesh.

virtual PxVec4 *getRestPositionBufferD() = 0

Get a pointer to a device buffer containing rest positions of the collision mesh vertices.

This function returns a pointer to device memory for the rest positions of the softbody collision mesh. This buffer is used to initialize the rest positions of the collision mesh vertices.

The simulation expects 4 floats per vertex, aligned to a 16B boundary. The first 3 specify the rest position. The last float is unused. The size of the buffer is the number of vertices in the collision mesh * sizeof(PxVec4).

The device memory pointed to by this pointer is allocated when a shape is attached to the softbody. Calling

PxSoftBody::detachShape() will deallocate the memory.

It is not allowed to write data into this buffer from the start of PxScene::simulate() until PxScene::fetchResults() returns.

It is the users’ responsibility to initialize this buffer with the initial rest positions of the vertices of the collision mesh. See PxSoftBodyExt::allocateAndInitializeHostMirror(), PxSoftBodyExt::copyToDevice().

Note

It is mandatory to call PxSoftBody::markDirty() with PxSoftBodyDataFlag::eREST_POSITION when updating data in this buffer.

Returns

PxVec4* A pointer to a device buffer containing the rest positions of the collision mesh.

virtual PxVec4 *getSimPositionInvMassBufferD() = 0

Get a pointer to a device buffer containing the vertex positions of the simulation mesh.

This function returns a pointer to device memory for the positions and inverse masses of the softbody simulation mesh. This buffer is used to both initialize/update the simulation mesh vertices of the softbody and read the simulation results.

The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The first 3 floats specify the positions and the last float specifies the inverse mass of the vertex. The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).

The device memory pointed to by this pointer is allocated when a simulation mesh is attached to the softbody. Calling

PxSoftBody::detachSimulationMesh() will deallocate the memory.

It is not allowed to write to this buffer from the start of the PxScene::simulate() call until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks have finished, reading the data during a completion task is explicitly allowed. The simulation will read and write directly from/into this buffer.

It is the users’ responsibility to initialize this buffer with the initial positions of the vertices of the simulation mesh. See PxSoftBodyExt::allocateAndInitializeHostMirror(), PxSoftBodyExt::copyToDevice().

Note

It is mandatory to call PxSoftBody::markDirty() with PxSoftBodyDataFlag::eSIM_POSITION_INVMASS when updating data in this buffer.

Returns

PxVec4* A pointer to a device buffer containing the vertex positions of the simulation mesh.

virtual PxVec4 *getSimVelocityBufferD() = 0

Get a pointer to a device buffer containing the vertex velocities of the simulation mesh.

This function returns a pointer to device memory for the velocities of the softbody simulation mesh vertices. This buffer is used to both initialize/update the simulation mesh vertex velocities of the soft body and read the simulation results.

The simulation expects 4 consecutive floats for each vertex, aligned to a 16B boundary. The first 3 specify the velocities for each vertex. The final float is unused. The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).

The device memory pointed to by this pointer is allocated when a simulation mesh is attached to the softbody. Calling

PxSoftBody::detachSimulationMesh() will deallocate the memory.

It is not allowed to write to this buffer from the start of the PxScene::simulate() call until PxScene::fetchResults() returns. Reading the data is allowed once all the PhysX tasks have finished, reading the data during a completion task is explicitly allowed. The simulation will read and write directly from/into this buffer.

It is the users’ responsibility to initialize this buffer with the initial velocities of the vertices of the simulation mesh. See PxSoftBodyExt::allocateAndInitializeHostMirror(), PxSoftBodyExt::copyToDevice().

Note

It is mandatory to call PxSoftBody::markDirty() with PxSoftBodyDataFlag::eSIM_VELOCITY when updating data in this buffer.

Returns

PxVec4* A pointer to a device buffer containing the vertex velocities of the simulation mesh.

virtual void markDirty(PxSoftBodyDataFlags flags) = 0

Marks per-vertex simulation state and configuration buffers dirty to signal to the simulation that changes have been made.

Calling this function is mandatory to notify the simulation of changes made in the positionInvMass, simPositionInvMass, simVelocity and rest position buffers.

This function can be called multiple times, and dirty flags are accumulated internally until PxScene::simulate() is called.

Parameters

flags – The buffers that have been updated.

virtual void setKinematicTargetBufferD(const PxVec4 *positions, PxSoftBodyFlags flags) = 0

Set the device buffer containing the kinematic targets for this softbody.

This function sets the kinematic targets for a softbody to a user-provided device buffer. This buffer is read by the simulation to obtain the target position for each vertex of the simulation mesh.

The simulation expects 4 consecutive float for each vertex, aligned to a 16B boundary. The first 3 floats specify the target positions. The last float determines (together with the flag argument) if the target is active or not. For a softbody with the flag PxSoftBodyFlag::eKINEMATIC raised, all target positions are considered valid. In case a softbody has the PxSoftBodyFlag::ePARTIALLY_KINEMATIC

raised, only target positions whose corresponding last float has been set to 0.f are considered valid target positions.

The size of the buffer is the number of vertices of the simulation mesh * sizeof(PxVec4).

It is the users responsibility to manage the memory pointed to by the input to this function, as well as guaranteeing the integrity of the input data. In particular, this means that it is not allowed to write this data from from the start of PxScene::simulate() until PxScene::fetchResults() returns. The memory is not allowed to be deallocated until PxScene::fetchResults() returns.

See also

PxConfigureSoftBodyKinematicTarget

Calling this function with a null pointer for the positions will clear the input and resume normal simulation. This will also clear both the PxSoftBodyFlag::eKINEMATIC and PxSoftBodyFlag::ePARTIALLY_KINEMATIC flags of the softbody.

This call is persistent across calls to PxScene::simulate(). Once this function is called, the simulation will look up the target positions from the same buffer for every call to PxScene::simulate(). The user is allowed to update the target positions without calling this function again, provided that the synchronization requirements are adhered to (no changes between start of PxScene::simulate() until PxScene::fetchResults() returns).

Parameters
virtual PxCudaContextManager *getCudaContextManager() const = 0

Return the cuda context manager.

Returns

The cuda context manager

virtual void setWakeCounter(PxReal wakeCounterValue) = 0

Sets the wake counter for the soft body.

The wake counter value determines the minimum amount of time until the soft body can be put to sleep. Please note that a soft 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)

Note

Passing in a positive value will wake the soft 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 soft body.

Returns

The wake counter of the soft body.

virtual bool isSleeping() const = 0

Returns true if this soft 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 soft body can only go to sleep if all vertices are ready for sleeping. A soft 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 soft body is sleeping, the following state is guaranteed:

  • The wake counter is zero.

  • The linear velocity of all vertices is zero.

When a soft 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 soft body has not been added to a scene already.

Returns

True if the soft body is sleeping.

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

Sets the solver iteration counts for the body.

The solver iteration count determines how accurately deformation and contacts are resolved. If you are having trouble with softbodies that are not as stiff as they should be, then setting a higher position iteration count may improve the behavior.

If intersecting bodies are being depenetrated too violently, increase the number of velocity iterations.

Default: 4 position iterations, 1 velocity iteration

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

  • minVelocityIters[in] Minimal number of velocity iterations the solver should perform for this body. Range: [1,255]

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

Retrieves the solver iteration counts.

virtual PxShape *getShape() = 0

Retrieves the shape pointer belonging to the actor.

See also

PxShape getNbShapes() PxShape::release()

Returns

Pointer to the collision mesh’s shape

virtual PxTetrahedronMesh *getCollisionMesh() = 0

Retrieve the collision mesh pointer.

Allows to access the geometry of the tetrahedral mesh used to perform collision detection

Returns

Pointer to the collision mesh

virtual const PxTetrahedronMesh *getCollisionMesh() const = 0

Const version of getCollisionMesh()

virtual PxTetrahedronMesh *getSimulationMesh() = 0

Retrieves the simulation mesh pointer.

Allows to access the geometry of the tetrahedral mesh used to compute the object’s deformation

Returns

Pointer to the simulation mesh

virtual const PxTetrahedronMesh *getSimulationMesh() const = 0

Const version of getSimulationMesh()

virtual PxSoftBodyAuxData *getSoftBodyAuxData() = 0

Retrieves the simulation state pointer.

Allows to access the additional data of the simulation mesh (inverse mass, rest state etc.). The geometry part of the data is stored in the simulation mesh.

Returns

Pointer to the simulation state

virtual const PxSoftBodyAuxData *getSoftBodyAuxData() const = 0

const version of getSoftBodyAuxData()

virtual bool attachShape(PxShape &shape) = 0

Attaches a shape.

Attaches the shape to use for collision detection

Parameters

shape[in] The shape to use for collisions

Returns

Returns true if the operation was successful

virtual bool attachSimulationMesh(PxTetrahedronMesh &simulationMesh, PxSoftBodyAuxData &softBodyAuxData) = 0

Attaches a simulation mesh.

Attaches the simulation mesh (geometry) and a state containing inverse mass, rest pose etc. required to compute the softbody deformation.

Parameters
  • simulationMesh[in] The tetrahedral mesh used to compute the softbody’s deformation

  • softBodyAuxData[in] A state that contain a mapping from simulation to collision mesh, volume information etc.

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 detachSimulationMesh()

virtual void detachSimulationMesh() = 0

Detaches the simulation mesh.

Detaches the simulation mesh and simulation state used to compute the softbody deformation.

See also

void detachShape()

virtual void release() = 0

Releases the softbody.

Releases the softbody and frees its resources.

virtual void addParticleFilter(PxPBDParticleSystem *particlesystem, const PxParticleBuffer *buffer, PxU32 particleId, PxU32 tetId) = 0

Creates a collision filter between a particle and a tetrahedron in the soft body’s collision mesh.

Parameters
  • particlesystem[in] The particle system used for the collision filter

  • buffer[in] The PxParticleBuffer to which the particle belongs to.

  • particleId[in] The particle whose collisions with the tetrahedron in the soft body are filtered.

  • tetId[in] The tetradedron in the soft body that is filtered. If tetId is PX_MAX_NB_SOFTBODY_TET, this particle will filter against all tetrahedra in this soft body.

virtual void removeParticleFilter(PxPBDParticleSystem *particlesystem, const PxParticleBuffer *buffer, PxU32 particleId, PxU32 tetId) = 0

Removes a collision filter between a particle and a tetrahedron in the soft body’s collision mesh.

Parameters
  • particlesystem[in] The particle system used for the collision filter

  • buffer[in] The PxParticleBuffer to which the particle belongs to.

  • particleId[in] The particle whose collisions with the tetrahedron in the soft body are filtered.

  • tetId[in] The tetrahedron in the soft body is filtered.

virtual PxU32 addParticleAttachment(PxPBDParticleSystem *particlesystem, const PxParticleBuffer *buffer, PxU32 particleId, PxU32 tetId, const PxVec4 &barycentric) = 0

Creates an attachment between a particle and a soft body.

Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the particle system does not.

Parameters
  • particlesystem[in] The particle system used for the attachment

  • buffer[in] The PxParticleBuffer to which the particle belongs to.

  • particleId[in] The particle that is attached to a tetrahedron in the soft body’s collision mesh.

  • tetId[in] The tetrahedron in the soft body’s collision mesh to attach the particle to.

  • barycentric[in] The barycentric coordinates of the particle attachment position with respect to the tetrahedron specified with tetId.

Returns

Returns a handle that identifies the attachment created. This handle can be used to release the attachment later

virtual void removeParticleAttachment(PxPBDParticleSystem *particlesystem, PxU32 handle) = 0

Removes an attachment between a particle and a soft body.

Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the particle system does not.

Parameters
  • particlesystem[in] The particle system used for the attachment

  • handle[in] Index that identifies the attachment. This handle gets returned by the addParticleAttachment when the attachment is created

virtual void addRigidFilter(PxRigidActor *actor, PxU32 vertId) = 0

Creates a collision filter between a vertex in a soft body and a rigid body.

Parameters
  • actor[in] The rigid body actor used for the collision filter

  • vertId[in] The index of a vertex in the softbody’s collision mesh whose collisions with the rigid body are filtered.

virtual void removeRigidFilter(PxRigidActor *actor, PxU32 vertId) = 0

Removes a collision filter between a vertex in a soft body and a rigid body.

Parameters
  • actor[in] The rigid body actor used for the collision filter

  • vertId[in] The index of a vertex in the softbody’s collision mesh whose collisions with the rigid body are filtered.

virtual PxU32 addRigidAttachment(PxRigidActor *actor, PxU32 vertId, const PxVec3 &actorSpacePose, PxConeLimitedConstraint *constraint = NULL) = 0

Creates a rigid attachment between a soft body and a rigid body.

Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the rigid body does not.

This method attaches a vertex on the soft body collision mesh to the rigid body.

Parameters
  • actor[in] The rigid body actor used for the attachment

  • vertId[in] The index of a vertex in the softbody’s collision mesh that gets attached to the rigid body.

  • actorSpacePose[in] The location of the attachment point expressed in the rigid body’s coordinate system.

  • constraint[in] The user defined cone distance limit constraint to limit the movement between a vertex in the soft body and rigid body.

Returns

Returns a handle that identifies the attachment created. This handle can be used to relese the attachment later

virtual void removeRigidAttachment(PxRigidActor *actor, PxU32 handle) = 0

Releases a rigid attachment between a soft body and a rigid body.

Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the rigid body does not.

This method removes a previously-created attachment between a vertex of the soft body collision mesh and the rigid body.

Parameters
  • actor[in] The rigid body actor used for the attachment

  • handle[in] Index that identifies the attachment. This handle gets returned by the addRigidAttachment when the attachment is created

virtual void addTetRigidFilter(PxRigidActor *actor, PxU32 tetIdx) = 0

Creates collision filter between a tetrahedron in a soft body and a rigid body.

Parameters
  • actor[in] The rigid body actor used for collision filter

  • tetIdx[in] The index of a tetrahedron in the softbody’s collision mesh whose collisions with the rigid body is filtered.

virtual void removeTetRigidFilter(PxRigidActor *actor, PxU32 tetIdx) = 0

Removes collision filter between a tetrahedron in a soft body and a rigid body.

Parameters
  • actor[in] The rigid body actor used for collision filter

  • tetIdx[in] The index of a tetrahedron in the softbody’s collision mesh whose collisions with the rigid body is filtered.

virtual PxU32 addTetRigidAttachment(PxRigidActor *actor, PxU32 tetIdx, const PxVec4 &barycentric, const PxVec3 &actorSpacePose, PxConeLimitedConstraint *constraint = NULL) = 0

Creates a rigid attachment between a soft body and a rigid body.

Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the rigid body does not.

This method attaches a point inside a tetrahedron of the collision to the rigid body.

Parameters
  • actor[in] The rigid body actor used for the attachment

  • tetIdx[in] The index of a tetrahedron in the softbody’s collision mesh that contains the point to be attached to the rigid body

  • barycentric[in] The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx

  • actorSpacePose[in] The location of the attachment point expressed in the rigid body’s coordinate system.

  • constraint[in] The user defined cone distance limit constraint to limit the movement between a tet and rigid body.

Returns

Returns a handle that identifies the attachment created. This handle can be used to release the attachment later

virtual void addSoftBodyFilter(PxSoftBody *otherSoftBody, PxU32 otherTetIdx, PxU32 tetIdx1) = 0

Creates collision filter between a tetrahedron in a soft body and a tetrahedron in another soft body.

Parameters
  • otherSoftBody[in] The other soft body actor used for collision filter

  • otherTetIdx[in] The index of the tetrahedron in the other softbody’s collision mesh to be filtered.

  • tetIdx1[in] The index of the tetrahedron in the softbody’s collision mesh to be filtered. If tetId1 is PX_MAX_NB_SOFTBODY_TET, the tetrahedron with index otherTetIdx in the other softbody will filter against all tetrahedra in this soft body.

virtual void removeSoftBodyFilter(PxSoftBody *otherSoftBody, PxU32 otherTetIdx, PxU32 tetIdx1) = 0

Removes collision filter between a tetrahedron in a soft body and a tetrahedron in other soft body.

Parameters
  • otherSoftBody[in] The other soft body actor used for collision filter

  • otherTetIdx[in] The index of the other tetrahedron in the other softbody’s collision mesh whose collision with the tetrahedron with the soft body is filtered.

  • tetIdx1[in] The index of the tetrahedron in the softbody’s collision mesh whose collision with the other tetrahedron with the other soft body is filtered.

virtual void addSoftBodyFilters(PxSoftBody *otherSoftBody, PxU32 *otherTetIndices, PxU32 *tetIndices, PxU32 tetIndicesSize) = 0

Creates collision filters between a tetrahedron in a soft body with another soft body.

Parameters
  • otherSoftBody[in] The other soft body actor used for collision filter

  • otherTetIndices[in] The indices of the tetrahedron in the other softbody’s collision mesh to be filtered.

  • tetIndices[in] The indices of the tetrahedron of the softbody’s collision mesh to be filtered.

  • tetIndicesSize[in] The size of tetIndices.

virtual void removeSoftBodyFilters(PxSoftBody *otherSoftBody, PxU32 *otherTetIndices, PxU32 *tetIndices, PxU32 tetIndicesSize) = 0

Removes collision filters between a tetrahedron in a soft body with another soft body.

Parameters
  • otherSoftBody[in] The other soft body actor used for collision filter

  • otherTetIndices[in] The indices of the tetrahedron in the other softbody’s collision mesh to be filtered.

  • tetIndices[in] The indices of the tetrahedron of the softbody’s collision mesh to be filtered.

  • tetIndicesSize[in] The size of tetIndices.

virtual PxU32 addSoftBodyAttachment(PxSoftBody *softbody0, PxU32 tetIdx0, const PxVec4 &tetBarycentric0, PxU32 tetIdx1, const PxVec4 &tetBarycentric1, PxConeLimitedConstraint *constraint = NULL, PxReal constraintOffset = 0.0f) = 0

Creates an attachment between two soft bodies.

This method attaches a point inside a tetrahedron of the collision mesh to a point in another soft body’s tetrahedron collision mesh.

Parameters
  • softbody0[in] The soft body actor used for the attachment

  • tetIdx0[in] The index of a tetrahedron in the other soft body that contains the point to be attached to the soft body

  • tetBarycentric0[in] The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx0

  • tetIdx1[in] The index of a tetrahedron in the softbody’s collision mesh that contains the point to be attached to the softbody0

  • tetBarycentric1[in] The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx1

  • constraint[in] The user defined cone distance limit constraint to limit the movement between tets.

  • constraintOffset[in] Offsets the cone and distance limit constraint along its axis, in order to specify the location of the cone tip.

Returns

Returns a handle that identifies the attachment created. This handle can be used to release the attachment later

virtual void removeSoftBodyAttachment(PxSoftBody *softbody0, PxU32 handle) = 0

Releases an attachment between a soft body and the other soft body.

Be aware that destroying the soft body before destroying the attachment is illegal and may cause a crash.

This method removes a previously-created attachment between a point inside a tetrahedron of the collision mesh to a point in another soft body’s tetrahedron collision mesh.

Parameters
  • softbody0[in] The softbody actor used for the attachment.

  • handle[in] Index that identifies the attachment. This handle gets returned by the addSoftBodyAttachment when the attachment is created.

virtual void addClothFilter(PxFEMCloth *cloth, PxU32 triIdx, PxU32 tetIdx) = 0

Creates collision filter between a tetrahedron in a soft body and a triangle in a cloth.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for collision filter

  • triIdx[in] The index of the triangle in the cloth mesh to be filtered.

  • tetIdx[in] The index of the tetrahedron in the softbody’s collision mesh to be filtered. If tetId is PX_MAX_NB_SOFTBODY_TET, this cloth triangle will filter against all tetrahedra in this soft body.

virtual void removeClothFilter(PxFEMCloth *cloth, PxU32 triIdx, PxU32 tetIdx) = 0

Removes collision filter between a tetrahedron in a soft body and a triangle in a cloth.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for collision filter

  • triIdx[in] The index of the triangle in the cloth mesh to be filtered.

  • tetIdx[in] The index of the tetrahedron in the softbody’s collision mesh to be filtered.

virtual void addVertClothFilter(PxFEMCloth *cloth, PxU32 vertIdx, PxU32 tetIdx) = 0

Creates collision filter between a tetrahedron in a soft body and a vertex in a cloth.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for collision filter

  • vertIdx[in] The index of the vertex in the cloth mesh to be filtered.

  • tetIdx[in] The index of the tetrahedron in the softbody’s collision mesh to be filtered. If tetId is PX_MAX_NB_SOFTBODY_TET, this cloth vertex will filter against all tetrahedra in this soft body.

virtual void removeVertClothFilter(PxFEMCloth *cloth, PxU32 vertIdx, PxU32 tetIdx) = 0

Removes collision filter between a tetrahedron in a soft body and a vertex in a cloth.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for collision filter

  • vertIdx[in] The index of the vertex in the cloth mesh to be filtered.

  • tetIdx[in] The index of the tetrahedron in the softbody’s collision mesh to be filtered.

virtual PxU32 addClothAttachment(PxFEMCloth *cloth, PxU32 triIdx, const PxVec4 &triBarycentric, PxU32 tetIdx, const PxVec4 &tetBarycentric, PxConeLimitedConstraint *constraint = NULL, PxReal constraintOffset = 0.0f) = 0

Creates an attachment between a soft body and a cloth.

Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the cloth does not.

This method attaches a point inside a tetrahedron of the collision mesh to a cloth.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for the attachment

  • triIdx[in] The index of a triangle in the cloth mesh that contains the point to be attached to the soft body

  • triBarycentric[in] The barycentric coordinates of the attachment point inside the triangle specified by triangleIdx

  • tetIdx[in] The index of a tetrahedron in the softbody’s collision mesh that contains the point to be attached to the cloth

  • tetBarycentric[in] The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx

  • constraint[in] The user defined cone distance limit constraint to limit the movement between a triangle in the fem cloth and a tet in the soft body.

  • constraintOffset[in] Offsets the cone and distance limit constraint along its axis, in order to specify the location of the cone tip.

Returns

Returns a handle that identifies the attachment created. This handle can be used to release the attachment later

virtual void removeClothAttachment(PxFEMCloth *cloth, PxU32 handle) = 0

Releases an attachment between a cloth and a soft body.

Be aware that destroying the cloth before destroying the attachment is illegal and may cause a crash. The soft body keeps track of these attachments but the cloth does not.

This method removes a previously-created attachment between a point inside a collision mesh tetrahedron and a point inside a cloth mesh.

Warning

Feature under development, only for internal usage.

Parameters
  • cloth[in] The cloth actor used for the attachment

  • handle[in] Index that identifies the attachment. This handle gets returned by the addClothAttachment when the attachment is created

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

Retrieves the axis aligned bounding box enclosing the soft body.

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 soft body’s bounding box.

virtual PxU32 getGpuSoftBodyIndex() = 0

Returns the GPU soft body index.

Returns

The GPU index, or 0xFFFFFFFF if the soft body is not in a scene.

inline virtual const char *getConcreteTypeName() const override

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

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 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.

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

inline PxSoftBody(PxType concreteType, PxBaseFlags baseFlags)
inline PxSoftBody(PxBaseFlags baseFlags)
inline virtual bool isKindOf(const char *name) const override

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