Skip to content

llParticleSystem

void llParticleSystem(list Parameters)

Creates a particle system in the prim the script is attached to, based on Parameters. An empty list removes a particle system from object.

List format is [ rule-1, data-1, rule-2, data-2 ... rule-n, data-n ].

Parameters
Parameters (list)

Each prim has only one particle emitter, located at its geometric center and aligned along the prim’s local Z-axis, pointing in the positive Z direction. Particles are essentially 2D sprites and are always rendered facing the viewer’s camera (except when PSYS_PART_RIBBON_MASK is enabled).

To turn off the particle emitter completely, call the function with an empty list: llParticleSystem([]).

This example produces an effusion of glowing red spheres:

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.0, 0.0>
]);
  1. Emitter restart issue: When using particle systems with a non-zero PSYS_SRC_MAX_AGE setting, the particle system may restart without a scripted trigger. This is due to a bug that causes the emitter to “reset” when any prim properties are updated. As a workaround, use a timer or forced llSleep() and then clear the particle system once the age expires. See this forum post.

  2. Spin relative to region: The spin defined by PSYS_SRC_OMEGA is relative to the region coordinate system, NOT the prim’s local coordinate system.

  3. Omega re-alignment: New non-zero vector values for PSYS_SRC_OMEGA will not re-align the emitter with the prim. The viewer will continue rotating the emitter with the new omega values starting from the last known orientation. The emitter’s current orientation is determined by the viewer, not the simulator, so two people viewing the same effect may see different results. To re-align the emitter with the prim, create an effect with PSYS_SRC_OMEGA set to ZERO_VECTOR long enough for the viewer to render it.

  4. Target positioning: Particles moving towards a humanoid avatar (specified by PSYS_SRC_TARGET_KEY and the PSYS_PART_TARGET_POS_MASK flag) will end up at the geometric center of the avatar’s bounding box, making them appear to strike the person in the groin area. To target another point on an avatar, place a target prim at the desired location and use that prim’s key for PSYS_SRC_TARGET_KEY.

  5. Culling at distance: The viewer uses distance-based culling for particles. If your emitter is very small and culled due to distance, the particle system will not be rendered. Particles will also be culled based on their own scale. To make smaller particles visible from further away, use a larger scale with a texture containing empty padding space. If using PSYS_PART_RIBBON_MASK, ensure the Y scale is set properly as it’s used for distance calculations even though the rendering ignores it.

  6. Zero velocity particles: When PSYS_PART_FOLLOW_VELOCITY_MASK is enabled, particles with zero velocity (e.g., generated by the DROP pattern without acceleration, wind, or target position following) are not rendered. Note that particles following their source via PSYS_PART_FOLLOW_SRC_MASK do not count as having velocity, even if the source is moving.

  • Client particle limit: The default particle count for the client is normally 4096. This is the maximum total particles the client will render for ALL active particle systems in view range. Good particle system design is essential to avoid overloading others’ rendering. If your emitter isn’t producing as many particles as expected, you may be experiencing particle starvation. Client lag (low frame rates) can also reduce particle rendering.

  • Particle direction: Once particles are emitted, their direction can only be affected by PSYS_SRC_ACCEL, the PSYS_PART_TARGET_POS_MASK flag, or the PSYS_PART_FOLLOW_SRC_MASK flag. There is no built-in way to create swirling vortex effects; these must be created with a moving particle source (e.g., an orbiting script).

  • Scale interpolation: Although particle sizes are always in multiples of 0.03125 meters, PSYS_PART_INTERP_SCALE_MASK allows smooth transitions between start and end values, including scaling particles from or to nothing.

These functions are useful for storing and retrieving color and alpha values as integers:

integer ColorAlphatoRGBA(vector color, float alpha) {
return (((integer)(alpha * 255.0) & 0xFF) << 24) |
(((integer)(color.x * 255.0) & 0xFF) << 16) |
(((integer)(color.y * 255.0) & 0xFF) << 8) |
((integer)(color.z * 255.0) & 0xFF);
}
vector RGBAtoColor(integer rgba) {
return < ((rgba >> 16) & 0xFF) / 255.0, ((rgba >> 8) & 0xFF) / 255.0, (rgba & 0xFF) / 255.0 >;
}
float RGBAtoAlpha(integer rgba) {
return ((rgba >> 24) & 0xFF) / 255.0;
}

Default particle texture: At the time of writing, the default particle texture is pixiesmall.j2c from the viewer’s install directory. A historically used UUID is 168e6813-096e-07ea-97ae-fd416826f627.

Related functions: llLinkParticleSystem (acts on any prim in an object, while llParticleSystem acts only on the prim containing the script).