Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture Animations

Jade Self
Registered User
Join date: 17 Mar 2008
Posts: 6
04-04-2009 06:19
Hi there, I wonder if anyone can help please.

I have an object that has a texture on one face with 16 animation frames in it. Each frame is a different state off the object for instance the image frame 0 indicates the object is off, frame 1 it is initialising, frame 3 its ready awaiting user interaction etc.

Using the following script in its simplest form I set the particular frame to be shown at different times.

//Animate frames
integer iSide = 3;
float FRAME_OFF = 0.0;
float FRAME_INIT = 1.0;
float FRAME_THINK = 2.0;
float FRAME_READY = 3.0;


default
{
state_entry()
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_INIT,1,1);

//do something

llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_READY,1,1);
}

on_rez(integer start_param)
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_INIT,1,1);
llResetScript();
}

touch_start(integer total_number)
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_THINK,1,1);

//do something

llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_READY,1,1);
llOwnerSay("Clicked";);

}
}


All works great initially, the correct frames are shown, however if I leave the object for a while, or right click to bring the wheel menu up the animation screws up showing the texture with all 16 frames in one go. Touching the object again, even though it has the animation command in makes no difference. The only way I can seem to get out of this is resetting the script.

Any advice would be greatly appreciated.

ty
Jade
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-04-2009 09:03
considering texture animation works at a specific rate, and you're tying it to an event I'm surprised it works at all.

you might have better luck with llOffsetTexture http://wiki.secondlife.com/wiki/LlOffsetTexture
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jade Self
Registered User
Join date: 17 Mar 2008
Posts: 6
04-04-2009 11:06
ty Void, worked a treat.