ARE YOU ON
New scripters may not realize that water (pools, rivers, rainstorms, waves) is not “real” in the sense
of being interactive or reactive to its surrounding environment. Thus, if you want water, you have two
r 5FSSBGPSNJOHUPNBLFUIFPGGJDJBMSL water level higher than the ground level. Terraforming is
covered in the “Shaping the Land by Terraforming” section of this chapter.
effects to them. This approach is used in this section.
At SYW HQ, we have a water mill that is powered by the waterfall falling from the cliff behind. Figure
6.1 shows the completed mill from a long view.
Figure 6.1: A water mill with working wheel,
gears, and turbulent waters
You have probably seen fountains galore in Second Life, and the technical approach is simple and
consistent. You simply choose an appropriate water texture (Linden Lab supplies an excellent assortment
in your free Library folder), then animate it with a recipe such as the one in Listing 6.1. This script provides
the animation in the pool below the waterfall, and is sufficiently convincing for the human eye to perceive
what appears to be real water.
Listing 6.1: Water Animation
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 1, 1, 1.0, 1.0, 0.05);
llSetTextureAnim() is intended to use textures with multiple frames embedded; it usually plays
them as frames like in a movie. This function is described in detail in the “Texture Animation” section of
$IBQUFSi4QFDJBM&GGFDUTu5IJTMJTUJOHDPNCJOFTSMOOTH and LOOP in the first parameter (mode) so
the water appears to flow continually in the x direction. LOOP makes the animation play over and over,
while SMOOTH slides from one frame to the next. The number of rows and columns is set to 1 because
there’s only a single logical frame to this texture, and likewise for the length.