Don't click here unless you want to be banned.

LSL Wiki : llParticleSystem

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
llParticleSystem(list parameters)

Makes a particle system based on the parameter list. The parameters are specified as an ordered list of parameters and values.

The following tables are valid parameters. Basically, each particle system is specified with a list consisting of the flags ORed together ([PSYS_PART_FLAGS, flag | anotherflag]) followed by the pattern ([PSYS_SRC_PATTERN, pattern]) and then pairs of parameters and their values.

Notes:

Parameter pairs (always one constant followed by parameter of specified type):
Constant Type Description Decimal
PSYS_PART_START_ALPHA float alpha of starting particle (This parameter isn't working correctly. Acts as 1 if set to value higher than 0) 2
PSYS_PART_END_ALPHA float alpha of ending particle 4
PSYS_PART_START_COLOR vector color of starting particle (for color and/or alpha to work PSYS_PART_INTERP_COLOR_MASK must be set) 1
PSYS_PART_END_COLOR vector color of ending particle 3
PSYS_PART_START_SCALE vector Starting size of particle billboard (sprite) in meters (z value is ignored). Maximum 4x4, minimum may be 0 if the same x or y value in the end scale (see below) is at least 0.03125. Using a texture with a larger masked area can give the appearance of an even smaller particle. The actual particle size is always a multiple of 0.03125. Smaller changes don't have any effect. 5
PSYS_PART_END_SCALE vector Ending size of the particle billboard in meters (z value is ignored). Maximum 4x4, minimum 0 if the same x or y value in the start scale (see above) is at least 0.03125. Using a texture with a larger masked area can give the appearance of an even smaller particle. The actual particle size is always a multiple of 0.03125. Smaller changes don't have any effect. 6
PSYS_PART_MAX_AGE float maximum age of a particle, in seconds (max 30 seconds) 7
PSYS_SRC_MAX_AGE float Length of time, in seconds, from when the source object comes into view, or the particle system's creation, that the object emits particles; after this time period no more particles are emitted. 19
PSYS_SRC_ACCEL vector particle acceleration: minimum seems to be .0078125 before any acceleration occurs (more research needed to verify); maximum seems to be 100 8
PSYS_SRC_ANGLE_BEGIN float area in radians specifying where particles will NOT be created (for ANGLE patterns) 22
PSYS_SRC_ANGLE_END float area in radians filled with particles (for ANGLE patterns) (if lower than PSYS_SRC_ANGLE_BEGIN, acts as PSYS_SRC_ANGLE_BEGIN itself, and PSYS_SRC_ANGLE_BEGIN acts as PSYS_SRC_ANGLE_END) 23
PSYS_SRC_BURST_PART_COUNT integer number of particles to release every burst 15
PSYS_SRC_BURST_RADIUS float Distance from center of source (in meters) where particles are created; only works when PSYS_PART_FOLLOW_SRC_MASK is not set. 16
PSYS_SRC_BURST_RATE float time interval (how often) to release ("burst") particles (in seconds, 0 fastest) 13
PSYS_SRC_BURST_SPEED_MIN float minimum velocity of each newly created particle; negative values act like 0 17
PSYS_SRC_BURST_SPEED_MAX float maximum velocity of each newly created particle; negative values act like 0; (if lower than PSYS_SRC_BURST_SPEED_MIN, acts as PSYS_SRC_BURST_SPEED_MIN itself, and PSYS_SRC_BURST_SPEED_MIN acts as PSYS_SRC_BURST_SPEED_MAX) 18
PSYS_SRC_INNERANGLE float deprecated, use PSYS_SRC_ANGLE_BEGIN instead. An area in radians specifying where particles will not be created. 10
PSYS_SRC_OUTERANGLE float deprecated, use PSYS_SRC_ANGLE_END instead. The area that is filled with particles, in radians. 11
PSYS_SRC_OMEGA vector rotation between bursts (in radians) (used only by SRC_PATTERN_ANGLE* patterns) 21
PSYS_SRC_TARGET_KEY key target that particles will move towards (if PSYS_PART_TARGET_POS_MASK has been set). If the key cannot be found, particles will target the emitter prim. 20
PSYS_SRC_TEXTURE string inventory item name or key of the particle texture 12
PSYS_SRC_PATTERN integer emission pattern; see pattern table below 9
PSYS_PART_FLAGS bitfield (integer) particle behavior; see flag table below 0

PSYS_PART_FLAGS followed by an integer bitfield with one or more of the following constants OR'ed together:
Constant Description Hex
PSYS_PART_BOUNCE_MASK particles bounce off object's z-axis height 0x004
PSYS_PART_EMISSIVE_MASK particles emit a glow (are prelit); otherwise reflect light 0x100
PSYS_PART_FOLLOW_SRC_MASK Particle position is relative to source object's vertical position (rotation still disperses particles); disables PSYS_SRC_BURST_RADIUS. 0x010
PSYS_PART_FOLLOW_VELOCITY_MASK rotate particles so vertical axis points towards velocity vector 0x020
PSYS_PART_INTERP_COLOR_MASK interpolate color (and alpha) from start to end 0x001
PSYS_PART_INTERP_SCALE_MASK interpolate particle scale from start to end 0x002
PSYS_PART_TARGET_LINEAR_MASK (Not listed in official documentation.) Seems to send particles in a straight line to target (cancels PSYS_SRC_ACCEL, PSYS_SRC_BURST_RADIUS, and possibly other parameters). 0x080
PSYS_PART_TARGET_POS_MASK particles move towards (target) object defined in PSYS_SRC_TARGET_KEY 0x040
PSYS_PART_WIND_MASK particle velocity is damped toward the wind 0x008
PSYS_PART_RANDOM_ACCEL_MASK unimplemented - random acceleration; use llFrand instead -
PSYS_PART_RANDOM_VEL_MASK unimplemented - random velocity; use llFrand instead -
PSYS_PART_TRAIL_MASK unimplemented - trails; emit more particles at shorter bursts instead -

PSYS_SRC_PATTERN followed by one (and only one) of the following constants:
Constant Description Hex
PSYS_SRC_PATTERN_ANGLE Shoot particles across a 2-dimensional area defined by arc radians specified in PSYS_SRC_ANGLE_END. An open area will exist in the arc defined by PSYS_SRC_ANGLE_BEGIN. 0x04
PSYS_SRC_PATTERN_ANGLE_CONE Shoot particles across a 3-dimensional cone defined by arc radians specified in PSYS_SRC_ANGLE_END. An open area will exist in the arc defined by PSYS_SRC_ANGLE_BEGIN. 0x08
PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY Not listed in official documentation. Inverse of PSYS_SRC_PATTERN_ANGLE_CONE; will shoot particles everywhere except the 3-dimensional hollow cone defined by PSYS_SRC_ANGLE_END and PSYS_SRC_ANGLE_BEGIN. 0x10
PSYS_SRC_PATTERN_DROP drop particles at source position with no initial velocity 0x01
PSYS_SRC_PATTERN_EXPLODE shoot ("explode") particles out in all directions using burst parameters 0x02
Remember, like llSetText or physics, llParticleSystem is not caused by the script, which merely turns particles on and off. Simply put, particles won't stop until llParticleSystem([]) is executed, which removes the system. This means particles won't stop when moved onto no-script land. Particle systems are rendered client-side and do not contribute to server load after the initial function call.

Also particle effects don't work on HUD objects.

Example:
// This will make an explosion of red particles, which follow the wind and glow
llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_WIND_MASK | PSYS_PART_EMISSIVE_MASK,
    PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE,
    PSYS_PART_START_COLOR, <1,0,0>]);

Q: How do I get my object to stop emitting particles? I removed the script, but it won't stop.
A: Call llParticleSystem again with an empty list. Particles aren't actually generated by the script; rather, the script only toggles a setting on the prim. This behavior is similar to llSetScale or llSetText--the scale or text are a part of the object, and will only be changed when a new setting is fed to them. Particles work the same way.

Example:
default {
     state_entry() 
     {
          llParticleSystem([]);
     }
}
addendum: a quick and easy way to do this while still retaining the particle parameters (in case you should wish to re-initiate the particles later) is to set the particle count (particles emitted per burst) to 0.

Q: Is it just me or is PSYS_SRC_BURST_RATE not acting at all like it should? Sometimes it emits it in the time I set, sometimes it takes 4x as long, or sometimes it emits fractions of a second after it just last emitted.
A: Check if there are other particles in-view that could be sucking up SL's particle limit set in preferences. Increase the particle limit, move to an area with less particles, and/or reduce PSYS_SRC_BURST_PART_COUNT.

Q: How do I make the rotation of the particle match the source prim with PSYS_SRC_PATTERN_DROP?
A: If you use PSYS_SRC_PATTERN_DROP then all particles are rezzed with the same orientation that ignores the source prim. You can change the rotation using PSYS_PART_FOLLOW_VELOCITY_MASK but this is a one time setting that applies to all particles. This can be faked though by using PSYS_SRC_PATTERN_ANGLE with a <0,0,0> velocity. Using PSYS_SRC_PATTERN_ANGLE causes the particles to match the orientation of the source prim.

Q: When I change regions, particles that were existing in the previous region follow me and continue to live until they reach the end of their lifespan, or in the case of targeted particles, move across the grid to wherever they were supposed to go. Why is this?
A: Particles exist entirely on the clientside in Second Life, and given that they may last a maximum of thirty seconds, they are not flushed from existance on region change. This results in the client rendering them carrying out their parameters until their life is over. Only you can see the rogue particles; they are only capable of targeting something in the same region as the emitter, and any apparent exceptions are only the result of how the client deals with old particles.

See ExampleParticleScript, ExampleParticleScript1, and LibraryKeknehvParticles for better examples.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Particles | Functions
There are 45 comments on this page. [Display comments/form]