PxDeformableVolume
Defined in include/PxDeformableVolume.h
-
class PxDeformableVolume : public PxDeformableBody
Represents a deformable volume.
The deformable volume feature is exclusively supported on GPU. The full GPU pipeline needs to be enabled in order to make use of deformable bodies, see PxSceneFlag::eENABLE_GPU_DYNAMICS, PxBroadPhaseType::eGPU.
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 setDeformableVolumeFlag(PxDeformableVolumeFlag::Enum flag, bool val) = 0
Raises or clears a particular deformable volume flag.
See the list of flags PxDeformableVolumeFlag
Default: No flags are set
- Parameters
flag – [in] The PxDeformableVolumeFlag to raise(set) or clear. See PxDeformableVolumeFlag.
val – [in] The new boolean value for the flag.
-
virtual void setDeformableVolumeFlags(PxDeformableVolumeFlags flags) = 0
Sets deformable volume flags.
See the list of flags PxDeformableVolumeFlag
Default: No flags are set
- Parameters
flags – [in] The PxDeformableVolumeFlags to set.
-
virtual PxDeformableVolumeFlags getDeformableVolumeFlags() const = 0
Reads the deformable volume flags.
See the list of flags PxDeformableVolumeFlag
See also
setDeformableVolumeFlag()
- Returns
The values of the deformable volume flags.
-
virtual void setSelfCollisionStressTolerance(const PxReal selfCollisionStressTolerance) = 0
Sets the self collision stress tolerance.
Stress threshold to deactivate collision contacts in case the local stress magnitude exceeds the threshold. Default: 0.9
- Parameters
selfCollisionStressTolerance – [in] The maximal depenetration velocity
-
virtual PxReal getSelfCollisionStressTolerance() const = 0
Retrieves the self collision stress tolerance.
See also
setSelfCollisionFilterDistance
- Returns
The self collision filter distance
-
virtual PxVec4 *getPositionInvMassBufferD() = 0
Gets 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 deformable volume. This buffer is used to both initialize/update the collision mesh vertices of the deformable volume 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 deformable volume. Calling
PxDeformableVolume::detachShape() will deallocate the memory.See also
PxTetrahedronMesh::getNbVertices().
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 PxDeformableVolumeExt::allocateAndInitializeHostMirror(), PxDeformableVolumeExt::copyToDevice().
Note
It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::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
Gets 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 deformable volume 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 deformable volume. Calling
PxDeformableVolume::detachShape() will deallocate the memory.See also
PxTetrahedronMesh::getNbVertices().
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 PxDeformableVolumeExt::allocateAndInitializeHostMirror(), PxDeformableVolumeExt::copyToDevice().
Note
It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::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
Gets 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 deformable volume simulation mesh. This buffer is used to both initialize/update the simulation mesh vertices of the deformable volume 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 deformable volume. Calling
PxDeformableVolume::detachSimulationMesh() will deallocate the memory.See also
PxTetrahedronMesh::getNbVertices().
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 PxDeformableVolumeExt::allocateAndInitializeHostMirror(), PxDeformableVolumeExt::copyToDevice().
Note
It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::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
Gets 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 deformable volume simulation mesh vertices. This buffer is used to both initialize/update the simulation mesh vertex velocities of the deformable volume 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 deformable volume. Calling
PxDeformableVolume::detachSimulationMesh() will deallocate the memory.See also
PxTetrahedronMesh::getNbVertices().
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 PxDeformableVolumeExt::allocateAndInitializeHostMirror(), PxDeformableVolumeExt::copyToDevice().
Note
It is mandatory to call PxDeformableVolume::markDirty() with PxDeformableVolumeDataFlag::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(PxDeformableVolumeDataFlags 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.
See also
getPositionInvMassBufferD, getSimVelocityBufferD, getRestPositionBufferD, getSimPositionInvMassBufferD
- Parameters
flags – The buffers that have been updated.
-
virtual void setKinematicTargetBufferD(const PxVec4 *positions) = 0
Sets the device buffer containing the kinematic targets for this deformable volume.
This function sets the kinematic targets for a deformable volume 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 deformable volume with the flag PxDeformableBodyFlag::eKINEMATIC raised, all target positions are considered valid. In case a deformable volume has the PxDeformableVolumeFlag::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
PxConfigureDeformableVolumeKinematicTarget Setting the kinematic targets has no effect if neither PxDeformableBodyFlag::eKINEMATIC nor PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC is set.
See also
PxTetrahedronMesh::getNbVertices().
Calling this function with a null pointer for the positions will clear the input and resume normal simulation. PxDeformableBodyFlag::eKINEMATIC or PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC are ignored if no targets are set.
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
positions – A pointer to a device buffer containing the kinematic targets for this deformable volume.
-
virtual void setKinematicTargetBufferD(const PxVec4 *positions, PxDeformableVolumeFlags flags) = 0
Deprecated: Sets the device buffer containing the kinematic targets for this deformable volume.
This function sets the kinematic targets for a deformable volume 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 deformable volume with the flag PxDeformableVolumeFlag::eKINEMATIC raised, all target positions are considered valid. In case a deformable volume has the PxDeformableVolumeFlag::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
PxConfigureDeformableVolumeKinematicTarget
See also
PxTetrahedronMesh::getNbVertices().
Calling this function with a null pointer for the positions will clear the input and resume normal simulation. This will also clear both the PxDeformableVolumeFlag::eKINEMATIC and PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC flags of the deformable volume.
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
positions – A pointer to a device buffer containing the kinematic targets for this deformable volume.
flags – Flags specifying the type of kinematic deformable volume: this function ignores all flags except PxDeformableVolumeFlag::eKINEMATIC and PxDeformableVolumeFlag::ePARTIALLY_KINEMATIC.
-
virtual bool attachSimulationMesh(PxTetrahedronMesh &simulationMesh, PxDeformableVolumeAuxData &deformableVolumeAuxData) = 0
Attaches a simulation mesh.
Attaches the simulation mesh (geometry) and a state containing inverse mass, rest pose etc. required to compute the deformation.
See also
detachSimulationMesh, PxDeformableBody.attachShape
- Parameters
simulationMesh – [in] The tetrahedral mesh used to compute the deformable’s deformation
deformableVolumeAuxData – [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 detachSimulationMesh() = 0
Detaches the simulation mesh.
Detaches the simulation mesh and simulation state used to compute the deformation.
See also
attachSimulationMesh, PxDeformableBody.detachShape
-
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 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 PxDeformableVolumeAuxData *getDeformableVolumeAuxData() = 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 PxDeformableVolumeAuxData *getDeformableVolumeAuxData() const = 0
const version of getDeformableVolumeAuxData()
-
virtual PxU32 getGpuDeformableVolumeIndex() = 0
Returns the GPU deformable volume index.
- Returns
The GPU index, or 0xFFFFFFFF if the deformable volume is not in a scene.
-
inline virtual const char *getConcreteTypeName() const final override
Gets the concrete type name.
- Returns
The name of the concrete type.
-
inline void setSoftBodyFlag(PxDeformableVolumeFlag::Enum flag, bool val)
Deprecated.
See also
setDeformableVolumeFlag
-
inline void setSoftBodyFlags(PxDeformableVolumeFlags flags)
Deprecated.
See also
setDeformableVolumeFlags
-
inline PxDeformableVolumeFlags getSoftBodyFlag() const
Deprecated.
See also
getDeformableVolumeFlags
-
inline PxDeformableVolumeAuxData *getSoftBodyAuxData()
Deprecated.
See also
getDeformableVolumeAuxData
-
inline const PxDeformableVolumeAuxData *getSoftBodyAuxData() const
Deprecated.
See also
getDeformableVolumeAuxData
-
virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0
Deprecated Default: 4 position iterations, 1 velocity iteration.
See also
PxDeformableBody.setSolverIterationCounts()
- 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
Deprecated.
See also
PxDeformableBody.setSolverIterationCount()
-
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 deformable volume’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 deformable volume are filtered.
tetId – [in] The tetradedron in the deformable volume that is filtered. If tetId is PX_MAX_NB_DEFORMABLE_VOLUME_TET, this particle will filter against all tetrahedra in this deformable volume.
-
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 deformable volume’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 deformable volume are filtered.
tetId – [in] The tetrahedron in the deformable volume 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 deformable volume.
Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. The deformable volume 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 deformable volume’s collision mesh.
tetId – [in] The tetrahedron in the deformable volume’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 deformable volume.
Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. The deformable volume 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 deformable volume 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 deformable volume’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 deformable volume 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 deformable volume’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 deformable volume and a rigid body.
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The deformable volume keeps track of these attachments but the rigid body does not.
This method attaches a vertex on the deformable volume 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 deformable volume’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 deformable volume 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 deformable volume and a rigid body.
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The deformable volume keeps track of these attachments but the rigid body does not.
This method removes a previously-created attachment between a vertex of the deformable volume 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 deformable volume and a rigid body.
- Parameters
actor – [in] The rigid body actor used for collision filter
tetIdx – [in] The index of a tetrahedron in the deformable volume’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 deformable volume and a rigid body.
- Parameters
actor – [in] The rigid body actor used for collision filter
tetIdx – [in] The index of a tetrahedron in the deformable volume’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 deformable volume and a rigid body.
Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. The deformable volume 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 deformable volume’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(PxDeformableVolume *otherDeformableVolume, PxU32 otherTetIdx, PxU32 tetIdx1) = 0
Creates collision filter between a tetrahedron in a deformable volume and a tetrahedron in another deformable volume.
- Parameters
otherDeformableVolume – [in] The other deformable volume actor used for collision filter
otherTetIdx – [in] The index of the tetrahedron in the other deformable volume’s collision mesh to be filtered.
tetIdx1 – [in] The index of the tetrahedron in the deformable volume’s collision mesh to be filtered. If tetId1 is PX_MAX_NB_DEFORMABLE_VOLUME_TET, the tetrahedron with index otherTetIdx in the other deformable volume will filter against all tetrahedra in this deformable volume.
-
virtual void removeSoftBodyFilter(PxDeformableVolume *otherDeformableVolume, PxU32 otherTetIdx, PxU32 tetIdx1) = 0
Removes collision filter between a tetrahedron in a deformable volume and a tetrahedron in other deformable volume.
- Parameters
otherDeformableVolume – [in] The other deformable volume actor used for collision filter
otherTetIdx – [in] The index of the other tetrahedron in the other deformable volume’s collision mesh whose collision with the tetrahedron with the deformable volume is filtered.
tetIdx1 – [in] The index of the tetrahedron in the deformable volume’s collision mesh whose collision with the other tetrahedron with the other deformable volume is filtered.
-
virtual void addSoftBodyFilters(PxDeformableVolume *otherDeformableVolume, PxU32 *otherTetIndices, PxU32 *tetIndices, PxU32 tetIndicesSize) = 0
Creates collision filters between a tetrahedron in a deformable volume with another deformable volume.
- Parameters
otherDeformableVolume – [in] The other deformable volume actor used for collision filter
otherTetIndices – [in] The indices of the tetrahedron in the other deformable volume’s collision mesh to be filtered.
tetIndices – [in] The indices of the tetrahedron of the deformable volume’s collision mesh to be filtered.
tetIndicesSize – [in] The size of tetIndices.
-
virtual void removeSoftBodyFilters(PxDeformableVolume *otherDeformableVolume, PxU32 *otherTetIndices, PxU32 *tetIndices, PxU32 tetIndicesSize) = 0
Removes collision filters between a tetrahedron in a deformable volume with another deformable volume.
- Parameters
otherDeformableVolume – [in] The other deformable volume actor used for collision filter
otherTetIndices – [in] The indices of the tetrahedron in the other deformable volume’s collision mesh to be filtered.
tetIndices – [in] The indices of the tetrahedron of the deformable volume’s collision mesh to be filtered.
tetIndicesSize – [in] The size of tetIndices.
-
virtual PxU32 addSoftBodyAttachment(PxDeformableVolume *deformableVolume0, PxU32 tetIdx0, const PxVec4 &tetBarycentric0, PxU32 tetIdx1, const PxVec4 &tetBarycentric1, PxConeLimitedConstraint *constraint = NULL, PxReal constraintOffset = 0.0f) = 0
Creates an attachment between two deformable volumes.
This method attaches a point inside a tetrahedron of the collision mesh to a point in another deformable volume’s tetrahedron collision mesh.
- Parameters
deformableVolume0 – [in] The deformable volume actor used for the attachment
tetIdx0 – [in] The index of a tetrahedron in the other deformable volume that contains the point to be attached to the deformable volume
tetBarycentric0 – [in] The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx0
tetIdx1 – [in] The index of a tetrahedron in the deformable volume’s collision mesh that contains the point to be attached to the deformableVolume0
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(PxDeformableVolume *deformableVolume0, PxU32 handle) = 0
Releases an attachment between a deformable volume and the other deformable volume.
Be aware that destroying the deformable volume 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 deformable volume’s tetrahedron collision mesh.
- Parameters
deformableVolume0 – [in] The deformable volume 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 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 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.
The wake counter is zero.
The linear velocity of all vertices is zero.
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 ¶ms) = 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.
-
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 PxDeformableVolume(PxType concreteType, PxBaseFlags baseFlags)
-
inline PxDeformableVolume(PxBaseFlags baseFlags)
-
inline virtual ~PxDeformableVolume()
-
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
-
virtual bool setEnvironmentID(PxU32 envID) = 0