Animate the texture on the specified face/faces of the specified prim/prims by setting the texture scale and offset. Identical to llSetTextureAnim except able to modify any prim in the link set.

Syntax

void llSetLinkTextureAnim( integer link, integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate );

Forced delay: 0.0 seconds. Energy: 10.0.

Parameters

integer link (link)
Link number (0: unlinked, 1: root prim, >1: child prims and seated avatars) or a LINK_* flag to effect
integer mode (bit_field)
bit field of Mode flags
integer face
face number or ALL_SIDES
integer sizex
horizontal frames (ignored for ROTATE and SCALE)
integer sizey
vertical frames (ignored for ROTATE and SCALE)
float start
Start position/frame number (or radians for ROTATE)
float length
number of frames to display (or radians for ROTATE)
float rate
Frames per second, or radians per second when ROTATE is set, or UV coordinates when SMOOTH is set (must not be zero)

If face is ALL_SIDES then the function works on all sides.

start supports negative indexes.

Frames are numbered from left to right, top to bottom, starting at 0.
If rate is negative, it has the same effect as using the REVERSE flag.[2]
If length is 0, it is considered to be sizex*sizey if both are above 0, otherwise 1.

Specification

IndexPositiveNegative
First0-length
Lastlength - 1-1

Indexes

Frames

Frames are sub-rectangles within the texture. A set of frames with 2 horizontal (sizex) and 3 vertical (sizey) means the overall texture is divided into 3 rows of 2 columns of images, each of which is a frame. llSetLinkTextureAnim will animate across these 6 starting with the top left image and going across and down, optionally repeating. If SMOOTH is set the frames slide smoothly from one to the next, if off, each frame is displayed in turn centered on the face.

Constants

FlagDescription
LINK_ROOT1refers to the root prim in a multi-prim linked set[1]
LINK_SET-1refers to all prims
LINK_ALL_OTHERS-2refers to all other prims
FlagDescription
LINK_ALL_CHILDREN-3refers to all children, (everything but the root)
LINK_THIS-4refers to the prim the script is in
ModesDescription
ANIM_ON0x1Texture animation is on. This must be set to start the animation, cleared to stop it.
LOOP0x2Loop the texture animation.
REVERSE0x4Play animation in reverse direction.
PING_PONG0x8Play animation going forwards, then backwards.
SMOOTH0x10Slide in the X direction, instead of playing separate frames.
In both SCALE and ROTATE modes, causes smooth transitions.
ROTATE0x20Animate texture rotation.
Does not work with SCALE
SCALE0x40Animate the texture scale.
Does not work with ROTATE

Caveats

Examples

This slides a texture smoothly, along the horizontal U-axis, and loops it when it gets to the end.

For Blinn-Phong materials, the texture's rotation for each side affects the apparent motion. So if the texture is rotated 90 degrees by use of the edit box, the texture may not flow in the direction expected.

For PBR materials, the Blinn-Phong texture rotation for each side affects the apparent motion, and any Blinn-Phong transform component (for example the offsets argument of PRIM_TEXTURE) which is not animated will be applied to the PBR material as well. Thus, a GLTF material without a GLTF texture transform will animate identically to a Blinn-Phong material. If a GLTF texture transform (for example PRIM_GLTF_BASE_COLOR) is applied, it will be in addition to the Blinn-Phong transform and texture animation. This allows for more flexibility, however a more complex GLTF texture transform will not loop as easily.

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, 1);

This slides a texture smoothly, along the horizontal U-axis, in the opposite direction

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, -1);

This divides a texture into 64 "cells", 8 across, and 8 down, and flips through them, left to right, top to bottom. This is useful for cell animation.

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | LOOP, ALL_SIDES, 8, 8, 0, 64, 6.4 );

This rotates a texture counter-clockwise at 2 revolutions per second. Change the last value to -2*TWO_PI to rotate clockwise.

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES,1,1,0, TWO_PI, 2*TWO_PI);

This scales a texture larger and smaller.

llSetLinkTextureAnim(LINK_THIS, ANIM_ON | SMOOTH | SCALE | PING_PONG | LOOP, ALL_SIDES, 1, 1, 1, 3, 2);

This turns off all texture animations

llSetLinkTextureAnim(LINK_THIS, FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);

Notes

Link Numbers

Each prim that makes up an object has an address, a link number. To access a specific prim in the object, the prim's link number must be known. In addition to prims having link numbers, avatars seated upon the object do as well.

When an avatar sits on an object, it is added to the end of the link set and will have the largest link number. In addition to this, while an avatar is seated upon an object, the object is unable to link or unlink prims without unseating all avatars first.

Counting Prims & Avatars

There are two functions of interest when trying to find the number of prims and avatars on an object.

integer GetPrimCount() { //always returns only the number of prims
    if(llGetAttached())//Is it attached?
        return llGetNumberOfPrims();//returns avatars and prims but attachments can't be sat on.
    return llGetObjectPrimCount(llGetKey());//returns only prims but won't work on attachments.
}

See llGetNumberOfPrims for more about counting prims and avatars.

Errata

If a script located in a child prim erroneously attempts to access link 0, it will get or set the property of the linkset's root prim. This bug (BUG-5049) is preserved for broken legacy scripts.

Texture animation is a property of the prim (i.e., you can remove the script that started the animation, and the prim will remember the settings anyway.)

See also

Functions

Articles

Deep notes

Issues

History

Footnotes

  1. LINK_ROOT does not work on single prim objects. Unless there is an avatar sitting on the object.
  2. Though if rate is negative and the REVERSE flag is used, they cancel each other out.