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:
- A prim may have at most one particle emitter running at a time. Defining another will supercede the previous one.
- Directional displays are relative to the prim's z-axis and emanate from the center of the prim.
- You must explicitly cancel an undefined lifetime particle display by passing llParticleSystem an empty list: llParticleSystem([])
- Due to Second Life's aggressive LOD settings for small prims and particles (which can't be changed by the end-user), if the emitter prim is not large enough to be seen (rendered), the particle system associated with it will not be displayed (e.g. particles in 0.01 m sphere and agent is far away).
- Most clients are configured to display 4096 particles within their draw distance (default: 96 m). If the number of particles within your client's draw distance is close to the limit, you may not see your particles or only see it sporadically.
Parameter pairs (always one constant followed by parameter of specified type):
| Constant | Type | Description | Decimal |
| PSYS_PART_START_ALPHA | float | alpha of starting particle | 2 |
| PSYS_PART_END_ALPHA | float | alpha of ending particle | 4 |
| PSYS_PART_START_COLOR | vector | color of starting particle | 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 .03125. Using a texture with a larger masked area can give the appearance of an even smaller particle. | 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 .03125. Using a texture with a larger masked area can give the appearance of an even smaller particle. | 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. Targets seem to have no distance limit (up to 739,104m tested so far)--even across sims. (Target key object needs to have been rezzed in-world by the client, else it acts as not found--thus distance is limited to each client's capabilities.) --Jiffies | 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:
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:
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.
See
ExampleParticleScript,
ExampleParticleScript1, and
LibraryKeknehvParticles for better examples.
Particles |
Functions