A particle function is used to simulate smoke, fire, rain, fireworks, jet exhaust, explosion, blood, dazzle, ...etc. A particle in Second Life is created by the function llParticleSystem.
What a particle is, is simply floating images (textures). LSL creates particles by the function llParticleSystem(), which takes a bunch of parameters. These parameters controls how many of of the particle images to float, the rate they are created, their duration, their color, in what direction they move, their speed, in what orientation, what size. Remember, a particle is simply a bunch of floating images and nothing more. By changing their number, direction, size, color, orientation, over time, they appear as smokes, lasers, rain, cloud, blood, explosion, etc.
llParticleSystem() takes a list as argument, of the form [p1,v1, p2,v2,...], where the p are the parameter names and v their values.
Here's a simple example:
// Particle that simulates a single firework burst partyOn(){ llParticleSystem([ PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, PSYS_SRC_MAX_AGE, 0., PSYS_PART_MAX_AGE, 9., PSYS_SRC_BURST_RATE, 20., PSYS_SRC_BURST_PART_COUNT, 500, PSYS_SRC_BURST_RADIUS, .1, PSYS_SRC_BURST_SPEED_MIN, 3., PSYS_SRC_BURST_SPEED_MAX, 3., PSYS_SRC_ACCEL, <0.0,0.0,-0.8>, PSYS_PART_START_COLOR, <246,38,9>/255., PSYS_PART_END_COLOR, <246,38,9>/255, PSYS_PART_START_ALPHA, 0.9, PSYS_PART_END_ALPHA, 0.0, PSYS_PART_START_SCALE, <.3,.3,0>, PSYS_PART_END_SCALE, <.1,.1,0>, PSYS_PART_FLAGS , 0 | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK | PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK //| PSYS_PART_WIND_MASK ]); } default { state_entry() { partyOn(); } }
Here's a brief explanation: There are 2 types of parameters. Those having prefix “PSYS_SRC_” are about the particle emitter. Those having prefix “PSYS_PART_” are about the particle sprites themselves.
The following are specific examples. It really takes playing with them inworld to understand them.
Experiment with this generic template: Generic Particle Template.
Reference:
Page created: 2007-03. © 2007 by Xah Lee.