new ParticleEmitter3D(pos3D, emitSize, emitTime, emitRate, emitConeAngle, tileInfo, colorStartA, colorStartB, colorEndA, colorEndB, particleTime, sizeStart, sizeEnd, speed, damping, gravity, fadeRate, randomness, additive)render3dExtras.js:1724Create a particle emitter
pos3D Vector3 optionalWorld space position of the emitter
emitSize number|Vector3 optional, default 0Spawn area, a number for a sphere diameter or a vec3 for a box
emitTime number optional, default 0How long to keep emitting, 0 is forever
emitRate number optional, default 100Particles per second, 0 does not emit
emitConeAngle number optionalHalf angle around the emit direction, PI is every direction
tileInfo TileInfo|TextureInfo optionalTile to render particles with, or a whole texture, undefined is untextured
colorStartA Color optionalColor at start of life, randomized between the start colors
colorStartB Color optionalcolorEndA Color optionalColor at end of life, randomized between the end colors
colorEndB Color optionalparticleTime number optional, default 0.5How long particles live in seconds
sizeStart number optional, default 0.1Particle size at start of life
sizeEnd number optional, default 1Particle size at end of life
speed number optional, default 0.1Spawn speed in world units per frame
damping number optional, default 1Per frame velocity multiplier, 1 is none
gravity number optional, default 0Per frame change to velocity y, negative pulls down; its own number, and
gravityScale adds a share of render3D.gravity on top
fadeRate number optional, default 0.1Fraction of life spent fading, half in and half out
randomness number optional, default 0.2Extra randomness applied to speed, size and life
additive boolean optional, default falseAdditive blending
// fire: a stream upward, yellow fading to transparent red, additive
new ParticleEmitter3D(vec3(), .5, 0, 100, .3, undefined, hsl(.12, 1, .6), hsl(.08, 1, .5), hsl(0, 1, .5, 0), hsl(0, 1, .25, 0), 1, .5, 1.5, .05, .95, 0, .3, .2, true);
Per frame multiplier on that spin, 1 keeps it
Radians per frame each particle turns in the camera plane, either way; 0 is no spin
Particles hit the level, height maps, voxel maps and mesh colliders, bouncing by
restitution and sliding along by friction; off by default, it tests each particle's move against the level every frame
Color at end of life, randomized between the end colors
Color at end of life, randomized between the end colors
Color at start of life, randomized between the start colors
Color at start of life, randomized between the start colors
Per frame velocity multiplier
Half angle around the emit direction, PI is every direction
Flatten the spawn area across the way it emits, its own up: a sphere becomes a disc
and a box a flat rectangle, for rain from a sheet of sky or flames from a patch of ground
Particles per second, 0 does not emit
Spawn area, a number for a sphere diameter or a vec3 for a box
How long to keep emitting, 0 is forever; raised while its particles are still alive,
it emits again for the added time
Fraction of life spent fading, half in and half out
Per frame change to velocity y, its own number and not render3D.gravity
Share of render3D.gravity added each frame on top of its own gravity, 0 by default so
an effect keeps its own fall wherever it is used; 1 falls with the world, like debris
Decides if a particle stops where it hits the level,
with collideLevel on; a callback that returns nothing lets it through
How many particles are alive, the first that many of particleData
Called with each particle as it is made
The live particles, 21 floats each: position, velocity, start and end color, start
and end size, life, age, angle, spin, and trail point count; the emitter owns them, nothing else needs to
Called with each particle as it goes, its life over or destroyed
How long particles live in seconds
Called with each particle each update, after it moves
The particle the callbacks get, one object for every particle and call
Extra randomness applied to speed, size and life
Particle size at end of life
Particle size at start of life
Spawn speed in world units per frame
How much a particle grips where it lands, 0 to 1: its speed along the surface is
cut by this much on each hit, on top of the friction, 1 stops it there
The trail points of every particle, trailMax per particle oldest first, when trailTime is set
Trail points kept per particle, from trailTime
Seconds of each particle's path to draw as a ribbon behind it, 0 draws billboards;
with engineVariableStep it keeps trailTime * frameRate updates of path
Where the emitter was at its last update, for when its parent is destroyed
Stop emitting, and go away once the particles already out have finished like the 2D emitter's do
immediate boolean optional
Draw the particles, as flat squares or as streaks when trailTime is set
- The whole emitter sorts as one thing, its particles are not sorted against each other
- With render3D.instancing on the squares go out as one instanced draw of render3D.billboardMesh
Spawn new particles, move the live ones, and go away when done