Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Particles Good_particle_script_example  

Good_particle_script_example

The script

Category: Particles
By : Xah Lee
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Good_particle_script_example
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Good_particle_script_example_1.lsl
1 // This script is from http://xahlee.org/sl/ .
2
3 // Copyright © 2007 Xah Lee.
4
5 // Permission is granted for use or modification provided this note is intact.
6
7
8
9 // This is a template for particles.
10
11 // tweak the various parameters to get different effects.
12
13 // Make sure that floats stays float and integers stays integers.
14
15
16
17 partyOn(){
18
20
21 //------------------------------------
22
23 // overall pattern of the whole particles
24
25 // pick one in the following.
26
27
28
29 // The pattern EXPLODE is good for fireworks. The DROP would be good for water drops. The PATTERN_ANGLE will burst particles in a pie-shape in the x-plane. Good for example for rainbow. ANGLE_CONE is a cone along the z-axes, good for example for jet exhaust, or water fountain. ANGLE_CONE_EMPTY is like ANGLE_CONE, but where ANGLE_CONE shoots, ANGLE_CONE_EMPTY will not.
30
31
32
34
35 PSYS_SRC_PATTERN_EXPLODE
36
37 //PSYS_SRC_PATTERN_DROP
38
39 //PSYS_SRC_PATTERN_ANGLE
40
41 //PSYS_SRC_PATTERN_ANGLE_CONE
42
43 //PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY
44
45 ,
46
47 //------------------------------------
48
49 // THE SHAPE OF EACH PARTICLE
50
51
52
53 PSYS_SRC_TEXTURE, "", // invt name, or UUID of a texture
54
55
56
57 //------------------------------------
58
59 // parameters for the particle emiter. (units for time are in seconds.)
60
61
62
63 // duration of the emitter will be spawning. Use 0. for forever. “60.” is the max.
64
66
67
68
69 //frequency of spawning
70
72
73
74
75 // number of particles per burst
76
78
79
80
81 // The distance the particle will be created from the emitter.
82
84
85
86
87 // Particles will fly off at a random speed between min and max. For example, if you want a firework burst such that all sparkles are on the increasingly larger spherical boundary, set the max and min speed to the same value such as “1.0”. If you want the firework sparkles to be inside the spherical boundary as well, use for example “0.1” and “1.0”.
88
90
92
93
94
95 // A force on the particle after they are emitted. Each unit is meter per second. Max is 100. So, to emulate water falling from a sprinkler nozzle, use <0.0,0.0,-0.8> to emulate a gravity. To emulate smoke being sucked into a tunnel, use a vector with non-zero x and y coordinates.
96
97 PSYS_SRC_ACCEL, <0.0,0.0,-0.8>,
98
99
100
101 // The following are for the directions of the particle burst. They are valid if the particle pattern is one of PSYS_SRC_PATTERN_ANGLE, PSYS_SRC_PATTERN_ANGLE_CONE, PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY. The PSYS_SRC_OMEGA will rotate the shooting. Angle starts from the z-axes and are in radians.
102
104
106
107 PSYS_SRC_OMEGA, < 0., 0. , 0.>,
108
109
110
111 //------------------------------------
112
113 // parameters that controls the particle sprites (a sprite is a 2D image that always faces the viewer. Particles are sprites.)
114
115
116
117 // the age of each particle. Max is 30.
118
120
121
122
123 // The end color must have PSYS_PART_INTERP_COLOR_MASK on in PSYS_PART_FLAGS
124
125 PSYS_PART_START_COLOR, <1,0,0>,
126
127 PSYS_PART_END_COLOR, <0,0,1>,
128
129
130
131 // The ALPHA is transparency, from 0 to 1. 1 means opaque.
132
134
136
137
138
139 //scale change. valid values are from 0.031 to 4.0 .
140
141 //must have INTERP_SCALE_MASK on in PSYS_PART_FLAGS.
142
143 PSYS_PART_START_SCALE, <1,1,0>,
144
145 PSYS_PART_END_SCALE, <.1,.1,0>,
146
147
148
149 //------------------------------------
150
151 // miscellaneous behaviors controlled by PSYS_PART_FLAGS
152
154
155 , 0
156
157
158
159 // glows. Basically brighter.
160
162
163
164
165 // change particle color. Makes PSYS_PART_START_COLOR, PSYS_PART_END_COLOR work.
166
168
169
170
171 // make it change size during its life. makes PSYS_PART_START_SCALE, PSYS_PART_END_SCALE work.
172
174
175
176
177 // make particles bounce off emiter's z-axis height, works only when the particle falls after bust.
178
180
181
182
183 // The PSYS_PART_FOLLOW_SRC_MASK makes the emitted particle's positions follow the emiter (disables PSYS_SRC_BURST_RADIUS). If not set, then particles once emitted outside of the PSYS_SRC_BURST_RADIUS will flow by themselves. For example, a blinking LED on a watch should have this set. Smokes from a cigerette should not have this set.
184
186
187
188
189 // Orient the particle sprite (the image) with the emiter's bursting direction. For example, a rotating water sprinkler should have this set. But if your sprite is textual such as “I Love You”, then it should not have this set.
190
192
193
194
195 // straight line to target (cancels PSYS_SRC_ACCEL, PSYS_SRC_BURST_RADIUS)
196
198
199
200
201 // make it blown by wind
202
204
205
206
207 //make particles follow a target specified at PSYS_SRC_TARGET_KEY
208
210
211
212
213 //------------------------------------
214
215 // following behavior. (needs PSYS_PART_FOLLOW_VELOCITY_MASK on)
216
217
218
220
221 ]);
222
223 }
224
225
226
227 default { state_entry() { partyOn(); } }

Back to the Best Free Tools in Second Life and OpenSim.