12-19-2009 16:38
I noticed a nice thing about llSetTextureAnim when you use it to ROTATE a texture: If you change the rotation rate, the texture picks up where it last was and there is no discontinuity as it speeds up and slows down. I use this to make wind turbines spin faster and slower as the wind speed changes:

llSetTextureAnim( ANIM_ON | ROTATE |SMOOTH | LOOP, ALL_SIDES, 1, 1, 0.0,TWO_PI,wnd*TWO_PI/4.0);

(Where wnd is the magnitude of the wind vector).

HOWEVER, the same nice thing does not happen if I change the frame rate of a frame-by-frame texture animation. (Like for the crank on a windmill). Every time I call llSetTextureAnim, I have to tell it which frame to start in. Can I tell it to start with the “last one displayed”? Can I find out what that frame number is? (Yeah, yeah, this is done client side, I know the answer will be HECK NO!) I tried giving it an illegal start parameter in the hopes that it would pick up where it left off but this does not seem to work:

llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 2, 2, 99, 4, wnd);

I can live with the animation starting over again every time the wind changes by setting the time between updates to a whole multiple of the animation cycle time. This doesn't always work perfectly but it is OK.

The thing that is really killing me is that sometimes the whole texture map displays for a single frame, with all my sub-frames showing. I assume this happens when I call llSetTextureAnim to change the rate. It sometimes doesn't happen for hours, and other times happens once every few seconds. I'd really like to make it more reliable. Is there a way to prevent this texture popping?