- Direct Known Subclasses:
PxPBDParticleSystem
A particle system simulates a bunch of particles that interact with each other. The interactions can be simple collisions with friction (granular material) ore more complex like fluid interactions, cloth, inflatables etc.
-
Nested Class Summary
Nested classes/interfaces inherited from class physx.NativeObject
NativeObject.Allocator<T> -
Field Summary
FieldsFields inherited from class physx.NativeObject
address, isExternallyAllocated, SIZEOF_BYTE, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_POINTER, SIZEOF_SHORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParticleBuffer(PxParticleBuffer particleBuffer) Add an existing particle buffer to the particle system.voidaddRigidAttachment(PxRigidActor actor) Creates a rigid attachment between a particle and a rigid actor.static PxParticleSystemarrayGet(long baseAddress, int index) intcreatePhase(PxParticleMaterial material, PxParticlePhaseFlags flags) Creates combined particle flag with particle material and particle phase flags.voidenableCCD(boolean enable) Enable continuous collision detection for particlesfloatReturn the contact offsetReturn the cuda context managerintReturns the GPU particle system index.floatRetrieves maximal depenetration velocity a particle can have.floatRetrieves maximal velocity a particle can have.intReturns number of particle materialsfloatReturn the particle contact offsetRetrieves the particle flags.Retrieves the simulationEventCallback pointer set with setSimulationEventCallback().floatReturn the rest offsetRetrieves the collision filter settings.floatReturn the solid rest offsetvoidremoveParticleBuffer(PxParticleBuffer particleBuffer) Remove particle buffer from the particle system.voidRemoves a rigid attachment between a particle and a rigid body.voidsetContactOffset(float contactOffset) Set the contact offset for the collision between particles and rigids or soft bodiesvoidsetMaxDepenetrationVelocity(float maxDepenetrationVelocity) Set the maximal depenetration velocity particles can reachvoidsetMaxVelocity(float maxVelocity) Set the maximal velocity particles can reachvoidsetParticleContactOffset(float particleContactOffset) Set the contact offset for the interactions between particlesvoidsetParticleFlag(PxParticleFlagEnum flag, boolean val) Set particle flagvoidsetParticleFlags(PxParticleFlags flags) Set particle flagsvoidSets a user notify object which receives special simulation events when they occur.voidsetRestOffset(float restOffset) Set the rest offset for the collision between particles and rigids or soft bodies.voidSet collision filter settingsvoidsetSolidRestOffset(float solidRestOffset) Set the solid rest offsetvoidsetSolverIterationCounts(int minPositionIters, int minVelocityIters) Sets the solver iteration counts for the body.static PxParticleSystemwrapPointer(long address) Methods inherited from class physx.physics.PxActor
getActorFlags, getDominanceGroup, getName, getOwnerClient, getScene, getType, getUserData, getWorldBounds, getWorldBounds, setActorFlag, setActorFlags, setDominanceGroup, setName, setOwnerClient, setUserDataMethods inherited from class physx.common.PxBase
getBaseFlags, getConcreteType, getConcreteTypeName, isReleasable, release, setBaseFlag, setBaseFlagsMethods inherited from class physx.NativeObject
checkNotNull, equals, getAddress, hashCode
-
Field Details
-
SIZEOF
public static final int SIZEOF -
ALIGNOF
public static final int ALIGNOF- See Also:
-
-
Constructor Details
-
PxParticleSystem
protected PxParticleSystem() -
PxParticleSystem
protected PxParticleSystem(long address)
-
-
Method Details
-
wrapPointer
-
arrayGet
-
setSolverIterationCounts
public void setSolverIterationCounts(int minPositionIters, int minVelocityIters) 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
- Parameters:
minPositionIters- Number of position iterations the solver should perform for this body. Range: [1,255]minVelocityIters- Number of velocity iterations the solver should perform for this body. Range: [1,255]See #getSolverIterationCounts()
-
getSimulationFilterData
Retrieves the collision filter settings.- Returns:
- The filter data
-
setSimulationFilterData
Set collision filter settingsAllows to control with which objects the particle system collides
- Parameters:
data- The filter data
-
setParticleFlag
Set particle flagAllows to control self collision etc.
- Parameters:
flag- The flag to setval- The new value of the flag
-
setParticleFlags
Set particle flagsAllows to control self collision etc.
- Parameters:
flags- The flags to set
-
getParticleFlags
Retrieves the particle flags.- Returns:
- The particle flags
-
setMaxDepenetrationVelocity
public void setMaxDepenetrationVelocity(float maxDepenetrationVelocity) Set the maximal depenetration velocity particles can reachAllows to limit the particles' maximal depenetration velocity to avoid that collision responses lead to very high particle velocities
- Parameters:
maxDepenetrationVelocity- The maximal depenetration velocity
-
getMaxDepenetrationVelocity
public float getMaxDepenetrationVelocity()Retrieves maximal depenetration velocity a particle can have.- Returns:
- The maximal depenetration velocity
-
setMaxVelocity
public void setMaxVelocity(float maxVelocity) Set the maximal velocity particles can reachAllows to limit the particles' maximal velocity to control the maximal distance a particle can move per frame
- Parameters:
maxVelocity- The maximal velocity
-
getMaxVelocity
public float getMaxVelocity()Retrieves maximal velocity a particle can have.- Returns:
- The maximal velocity
-
getCudaContextManager
Return the cuda context manager- Returns:
- The cuda context manager
-
setRestOffset
public void setRestOffset(float restOffset) 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- Range: (0, contactOffset)
-
getRestOffset
public float getRestOffset()Return the rest offset- Returns:
- the rest offset
See #setRestOffset()
-
setContactOffset
public void setContactOffset(float contactOffset) Set the contact offset for the collision between particles and rigids or soft bodiesThe 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- Range: (restOffset, PX_MAX_F32)
-
getContactOffset
public float getContactOffset()Return the contact offset- Returns:
- the contact offset
See #setContactOffset()
-
setParticleContactOffset
public void setParticleContactOffset(float particleContactOffset) Set the contact offset for the interactions between particlesThe 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- Range: (Max(solidRestOffset, fluidRestOffset), PX_MAX_F32)
-
getParticleContactOffset
public float getParticleContactOffset()Return the particle contact offset- Returns:
- the particle contact offset
See #setParticleContactOffset()
-
setSolidRestOffset
public void setSolidRestOffset(float solidRestOffset) Set the solid rest offsetTwo solid particles (or a solid and a fluid particle) will come to rest at a distance equal to twice the solidRestOffset value.
- Parameters:
solidRestOffset- Range: (0, particleContactOffset)
-
getSolidRestOffset
public float getSolidRestOffset()Return the solid rest offset- Returns:
- the solid rest offset
See #setSolidRestOffset()
-
addRigidAttachment
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- The rigid actor used for the attachment
-
removeRigidAttachment
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- The rigid body actor used for the attachment
-
enableCCD
public void enableCCD(boolean enable) Enable continuous collision detection for particles- Parameters:
enable- Boolean indicates whether continuous collision detection is enabled.
-
createPhase
Creates combined particle flag with particle material and particle phase flags.- Parameters:
material- A material instance to associate with the new particle group.flags- The particle phase flags.- Returns:
- The combined particle group index and phase flags.
See #PxParticlePhaseFlag
-
getNbParticleMaterials
public int getNbParticleMaterials()Returns number of particle materials- Returns:
- The number of particle materials
-
setParticleSystemCallback
Sets a user notify object which receives special simulation events when they occur.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- User notification callback. See PxSimulationEventCallback.See #PxParticleSystemCallback, #getParticleSystemCallback()
-
getParticleSystemCallback
Retrieves the simulationEventCallback pointer set with setSimulationEventCallback().- Returns:
- The current user notify pointer. See PxSimulationEventCallback.
See #PxParticleSystemCallback, #setParticleSystemCallback()
-
addParticleBuffer
Add an existing particle buffer to the particle system.- Parameters:
particleBuffer- a PxParticleBuffer*.See #PxParticleBuffer.
-
removeParticleBuffer
Remove particle buffer from the particle system.- Parameters:
particleBuffer- a PxParticleBuffer*.See #PxParticleBuffer.
-
getGpuParticleSystemIndex
public int getGpuParticleSystemIndex()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.
-