PxPBDParticleSystem

Defined in include/PxPBDParticleSystem.h

class PxPBDParticleSystem : public PxParticleSystem

A particle system that uses the position based dynamics(PBD) solver.

The position based dynamics solver for particle systems supports behaviors like fluid, cloth, inflatables etc.

Public Functions

inline virtual ~PxPBDParticleSystem()
virtual void setWind(const PxVec3 &wind) = 0

Set wind direction and intensity.

Parameters

wind[in] The wind direction and intensity

virtual PxVec3 getWind() const = 0

Retrieves the wind direction and intensity.

Returns

The wind direction and intensity

virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) = 0

Set the fluid boundary density scale.

Defines how strong of a contribution the boundary (typically a rigid surface) should have on a fluid particle’s density.

Parameters

fluidBoundaryDensityScale[in] Range: (0.0, 1.0)

virtual PxReal getFluidBoundaryDensityScale() const = 0

Return the fluid boundary density scale.

See setFluidBoundaryDensityScale()

Returns

the fluid boundary density scale

virtual void setFluidRestOffset(PxReal fluidRestOffset) = 0

Set the fluid rest offset.

Two fluid particles will come to rest at a distance equal to twice the fluidRestOffset value.

Parameters

fluidRestOffset[in] Range: (0, particleContactOffset)

virtual PxReal getFluidRestOffset() const = 0

Return the fluid rest offset.

See setFluidRestOffset()

Returns

the fluid rest offset

virtual void setGridSizeX(PxU32 gridSizeX) = 0

Set the particle system grid size x dimension.

Parameters

gridSizeX[in] x dimension in the particle grid

virtual void setGridSizeY(PxU32 gridSizeY) = 0

Set the particle system grid size y dimension.

Parameters

gridSizeY[in] y dimension in the particle grid

virtual void setGridSizeZ(PxU32 gridSizeZ) = 0

Set the particle system grid size z dimension.

Parameters

gridSizeZ[in] z dimension in the particle grid

inline virtual const char *getConcreteTypeName() const override

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

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

Sets the solver iteration counts for the body.

The solver iteration count determines how accurately joints and contacts are resolved. If you are having trouble with jointed bodies oscillating and behaving erratically, then setting a higher position iteration count may improve their stability.

If intersecting bodies are being depenetrated too violently, increase the number of velocity iterations. More velocity iterations will drive the relative exit velocity of the intersecting objects closer to the correct value given the restitution.

Default: 4 position iterations, 1 velocity iteration

See getSolverIterationCounts()

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

  • minVelocityIters[in] 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.

See setSolverIterationCounts()

virtual PxFilterData getSimulationFilterData() const = 0

Retrieves the collision filter settings.

Returns

The filter data

virtual void setSimulationFilterData(const PxFilterData &data) = 0

Set collision filter settings.

Allows to control with which objects the particle system collides

Parameters

data[in] The filter data

virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) = 0

Set particle flag.

Allows to control self collision etc.

Parameters
  • flag[in] The flag to set

  • val[in] The new value of the flag

virtual void setParticleFlags(PxParticleFlags flags) = 0

Set particle flags.

Allows to control self collision etc.

Parameters

flags[in] The flags to set

virtual PxParticleFlags getParticleFlags() const = 0

Retrieves the particle flags.

Returns

The particle flags

virtual void setMaxDepenetrationVelocity(PxReal maxDepenetrationVelocity) = 0

Set the maximal depenetration velocity particles can reach.

Allows to limit the particles’ maximal depenetration velocity to avoid that collision responses lead to very high particle velocities

Parameters

maxDepenetrationVelocity[in] The maximal depenetration velocity

virtual PxReal getMaxDepenetrationVelocity() = 0

Retrieves maximal depenetration velocity a particle can have.

Returns

The maximal depenetration velocity

virtual void setMaxVelocity(PxReal maxVelocity) = 0

Set the maximal velocity particles can reach.

Allows to limit the particles’ maximal velocity to control the maximal distance a particle can move per frame

Parameters

maxVelocity[in] The maximal velocity

virtual PxReal getMaxVelocity() = 0

Retrieves maximal velocity a particle can have.

Returns

The maximal velocity

virtual PxCudaContextManager *getCudaContextManager() const = 0

Return the cuda context manager.

Returns

The cuda context manager

virtual void setRestOffset(PxReal restOffset) = 0

Set the rest offset for the collision between particles and rigids or soft bodies.

A particle and a rigid or soft body will come to rest at a distance equal to the sum of their restOffset values.

Parameters

restOffset[in] Range: (0, contactOffset)

virtual PxReal getRestOffset() const = 0

Return the rest offset.

See setRestOffset()

Returns

the rest offset

virtual void setContactOffset(PxReal contactOffset) = 0

Set the contact offset for the collision between particles and rigids or soft bodies.

The contact offset needs to be larger than the rest offset. Contact constraints are generated for a particle and a rigid or softbody below the distance equal to the sum of their contacOffset values.

Parameters

contactOffset[in] Range: (restOffset, PX_MAX_F32)

virtual PxReal getContactOffset() const = 0

Return the contact offset.

See setContactOffset()

Returns

the contact offset

virtual void setParticleContactOffset(PxReal particleContactOffset) = 0

Set the contact offset for the interactions between particles.

The particle contact offset needs to be larger than the fluid rest offset and larger than the solid rest offset. Interactions for two particles are computed if their distance is below twice the particleContactOffset value.

Parameters

particleContactOffset[in] Range: (Max(solidRestOffset, fluidRestOffset), PX_MAX_F32)

virtual PxReal getParticleContactOffset() const = 0

Return the particle contact offset.

See setParticleContactOffset()

Returns

the particle contact offset

virtual void setSolidRestOffset(PxReal solidRestOffset) = 0

Set the solid rest offset.

Two solid particles (or a solid and a fluid particle) will come to rest at a distance equal to twice the solidRestOffset value.

Parameters

solidRestOffset[in] Range: (0, particleContactOffset)

virtual PxReal getSolidRestOffset() const = 0

Return the solid rest offset.

See setSolidRestOffset()

Returns

the solid rest offset

virtual void addRigidAttachment(PxRigidActor *actor) = 0

Creates a rigid attachment between a particle and a rigid actor.

This method creates a symbolic attachment between the particle system and a rigid body for the purpose of island management. The actual attachments will be contained in the particle buffers.

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

Parameters

actor[in] The rigid actor used for the attachment

virtual void removeRigidAttachment(PxRigidActor *actor) = 0

Removes a rigid attachment between a particle and a rigid body.

This method destroys a symbolic attachment between the particle system and a rigid body for the purpose of island management.

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

Parameters

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

virtual void enableCCD(bool enable) = 0

Enable continuous collision detection for particles.

Parameters

enable[in] Boolean indicates whether continuous collision detection is enabled.

virtual PxU32 createPhase(PxParticleMaterial *material, PxParticlePhaseFlags flags) = 0

Creates combined particle flag with particle material and particle phase flags.

See PxParticlePhaseFlag

Parameters
  • material[in] A material instance to associate with the new particle group.

  • flags[in] The particle phase flags.

Returns

The combined particle group index and phase flags.

virtual PxU32 getNbParticleMaterials() const = 0

Returns number of particle materials referenced by particle phases.

Returns

The number of particle materials

virtual PxU32 getParticleMaterials(PxParticleMaterial **userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0

Returns particle materials referenced by particle phases.

Returns

The particle materials

virtual void setParticleSystemCallback(PxParticleSystemCallback *callback) = 0

Sets a user notify object which receives special simulation events when they occur.

See PxParticleSystemCallback, getParticleSystemCallback()

Note

Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored.

Note

A call to fetchResultsParticleSystem() on the PxScene will synchronize the work such that the caller knows that all worke done in the callback completed.

Parameters

callback[in] User notification callback. See PxSimulationEventCallback.

virtual PxParticleSystemCallback *getParticleSystemCallback() const = 0

Retrieves the simulationEventCallback pointer set with setSimulationEventCallback().

See PxParticleSystemCallback, setParticleSystemCallback()

Returns

The current user notify pointer. See PxSimulationEventCallback.

virtual void addParticleBuffer(PxParticleBuffer *particleBuffer) = 0

Add an existing particle buffer to the particle system.

See PxParticleBuffer.

Parameters

particleBuffer[in] a PxParticleBuffer*.

virtual void removeParticleBuffer(PxParticleBuffer *particleBuffer) = 0

Remove particle buffer from the particle system.

See PxParticleBuffer.

Parameters

particleBuffer[in] a PxParticleBuffer*.

virtual PxU32 getGpuParticleSystemIndex() = 0

Returns the GPU particle system index.

Returns

The GPU index, if the particle system is in a scene and PxSceneFlag::eENABLE_DIRECT_GPU_API is set, or 0xFFFFFFFF otherwise.

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.

virtual PxActorType::Enum getType() const = 0

Retrieves the type of actor.

See also

PxActorType

Returns

The actor type of the actor.

virtual PxScene *getScene() const = 0

Retrieves the scene which this actor belongs to.

See also

PxScene

Returns

Owner Scene. NULL if not part of a scene.

virtual void setName(const char *name) = 0

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

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

Default: NULL

See also

getName()

Parameters

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

virtual const char *getName() const = 0

Retrieves the name string set with setName().

See also

setName()

Returns

Name string associated with object.

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

Retrieves the axis aligned bounding box enclosing the actor.

See also

PxBounds3

Note

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

Parameters

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

Returns

The actor’s bounding box.

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

Raises or clears a particular actor flag.

See the list of flags PxActorFlag

Sleeping: Does NOT wake the actor up automatically.

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

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

virtual void setActorFlags(PxActorFlags inFlags) = 0

Sets the actor flags.

See the list of flags PxActorFlag

virtual PxActorFlags getActorFlags() const = 0

Reads the PxActor flags.

See the list of flags PxActorFlag

Returns

The values of the PxActor flags.

virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) = 0

Assigns dynamic actors a dominance group identifier.

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

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

Default: 0

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

Parameters

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

virtual PxDominanceGroup getDominanceGroup() const = 0

Retrieves the value set with setDominanceGroup().

Returns

The dominance group of this actor.

virtual void setOwnerClient(PxClientID inClient) = 0

Sets the owner client of an actor.

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

Default: PX_DEFAULT_CLIENT

See also

PxClientID PxScene::createClient()

virtual PxClientID getOwnerClient() const = 0

Returns the owner client that was specified at creation time.

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

See also

PxClientID PxScene::createClient()

virtual PxAggregate *getAggregate() const = 0

Retrieves the aggregate the actor might be a part of.

See also

PxAggregate

Returns

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

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 PxPBDParticleSystem(PxType concreteType, PxBaseFlags baseFlags)
inline PxPBDParticleSystem(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