|
In this post, I'll show you how to script a realistic spout that sprays from your whale. You will need to add in another cube shaped prim and position it inside the whale. I positioned mine up near the blow-hole. |
![]() |
|
Add the following script to that prim. It begins with a
llParticleSystem call. This system call is passed a list, which
basically means that there is a matching set of [...] inside the (.. ) Each CAPITALIZED parameter is a system variable that is set by a number, a vector, or a floating point number. |
|
Download
updateParticles()
{
llParticleSystem([
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE,
PSYS_SRC_MAX_AGE, 0., //partcile emitter always runs
PSYS_SRC_BURST_RATE, .3, // about 3 bursts a sec
PSYS_SRC_BURST_PART_COUNT, 50, // 50 at a whack = about 150 a second
PSYS_SRC_BURST_RADIUS, 1, // particles appear about 1 meter above the prim Z axis
PSYS_SRC_BURST_SPEED_MIN, 1., // 1 meter
PSYS_SRC_BURST_SPEED_MAX, 5., // to 5 meters spurts
PSYS_SRC_ACCEL, <0.0,0.0,-1.>, // make them fall a bit
PSYS_SRC_ANGLE_BEGIN, PI, // a narrow emitter, like a spray hose
PSYS_SRC_ANGLE_END, PI,
PSYS_SRC_OMEGA, <0.,0.0,0.0>, // no rotation
PSYS_PART_MAX_AGE, 4., // they last 4 second, so 4 * 150 = 600 particles are visible
PSYS_PART_START_COLOR, <1,1,1>, // white
PSYS_PART_END_COLOR, <1,1,1>,
PSYS_PART_START_ALPHA, .7, // faded a bit
PSYS_PART_END_ALPHA, 0.1, // faded a lot at the start
PSYS_PART_START_SCALE, <.08,.8,0>, // long and narrow to make jets
PSYS_PART_END_SCALE, <.05,.1,0>, PSYS_PART_FLAGS, 0 | PSYS_PART_INTERP_COLOR_MASK |
PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK | PSYS_PART_WIND_MASK]);
}
default
{
state_entry()
{
llParticleSystem([]);
}
llMessageLinked(LINK_SET,0,"on",NULL_KEY); // part of another script
link_message(integer sender, integer num, string str, key id)
{
if (str == "on") {
updateParticles();
} else if (str == "off") {
llParticleSystem([]);
}
}
}
Back to the Best Free Tools in Second Life and OpenSim.