Regular API function

simAddParticleObject / sim.addParticleObject

Description Adds a particle object that will be simulated and displayed in the scene. Particle objects are containers that hold several items (particles) of a given type. This can be used for several different applications (e.g. simulation of air/water jets) See also sim.addParticleObjectItem and sim.removeParticleObject
C/C++
synopsis
simInt simAddParticleObject(simInt objectType,simFloat size,simFloat density,const simVoid* parameters,simFloat lifeTime,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission)
C/C++
parameters
size: diameter of the particles (spheres)
density: density of the particles
parameters: points to an array of values, allowing to specify additional parameters. Can be nullptr. The first value (an integer) indicates how many parameters will be set. All following values come in pair (an integer indicating what parameter, and a float indicating the parameter value. Following indicates the parameters:
0: Bullet friction coefficient (default: 0.0)
1: Bullet restitution coefficient (default: 0.0)
2: ODE friction coefficient (default: 0.0)
3: ODE soft ERP value (default: 0.2)
4: ODE soft CFM values (default: 0.0)
5: Bullet, ODE, Newton and Vortex linear drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)
6: Bullet, ODE, Newton and Vortex quadratic drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)
7: Bullet, ODE, Newton and Vortex linear drag parameter in air (z>0) if sim.particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)
8: Bullet, ODE, Newton and Vortex quadratic drag parameter in air (z>0) if sim.particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)
9: Vortex friction (default: 0.0)
10: Vortex restitution (default: 0.0)
11: Vortex restitution threshold (default: 0.001)
12: Vortex compliance (default: 0.0)
13: Vortex damping (default: 0.0)
14: Vortex adhesive force (default: 0.0)
15: Newton static friction (default: 0.0)
16: Newton kinetic friction (default: 0.0)
17: Newton restitution (default: 0.0)
If a parameter is not set, then its default value is used. As an example, following array: [3,0,0.5,2,0.5,9,0.5] will set Bullet's, ODE's and Vortex's friction coefficients to 0.5
lifeTime: simulation time after which the particles are destroyed. Set to 0.0 for an unlimited lifetime.
maxItemCount: the maximum number of particles that this object can hold
ambient_diffuse: default ambient/diffuse color (pointer to 3 rgb values). Can be nullptr
setToNULL: not used, set to nullptr
specular: default specular color (pointer to 3 rgb values). Can be nullptr
emission: default emissive color (pointer to 3 rgb values). Can be nullptr
C/C++
return value
handle of the particle object if successful, -1 otherwise
Lua
synopsis
int particleObjectHandle=sim.addParticleObject(int objectType,float size,float density,float[] parameters,float lifeTime,int maxItemCount,float[3] ambient_diffuse=nil,nil,float[3] specular=nil,float[3] emission=nil)
Lua
parameters
Similar to the C-function counterpart
Lua
return values
Similar to the C-function counterpart
Python
synopsis
int particleObjectHandle=sim.addParticleObject(int objectType,float size,float density,list parameters,float lifeTime,int maxItemCount,list ambient_diffuse=None,None,list specular=None,list emission=None)

<