|
Hawk Mendicant
www.hawkuk.com
Join date: 6 Jun 2005
Posts: 30
|
05-21-2006 07:50
Hopefully someone can help me out here.
I've got a texture I want to animate but i'd like it to only loop a few times and then stop on a specified frame. I've tried:
1. Specifying the length on llSetTextureAnim to be higher than the total number of frames. But it seems to outsmart me and not bother looping.
2. Starting the animation on a continuous loop and then using llGetTextureOffset to work out what frame it's on so i can stop it at the right point after a while. Unfortunately gettextureoffset doesnt seem to report the correct value while the animation is running.
Does anyone else have an idea how to do this?
Thanks, Hawk.
|
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
05-21-2006 09:08
Well, since llSetTextureAnim() is a client-side function, and all the timing functions in LSL are not client side functions, I don't think you'll ever be able to do this perfectly as things stand now. I've done this with a for loop and an llSleep(), but in high-server-lag areas, the timing is probably going to get a bit munged. This is what I did, at least (for reference, it's a 6x6 tiled animation texture, 36 frames total): // Number of full repeats of the anim to run. integer repeats = 2 ;
default { state_entry() { integer i ; for( i = 0; i < repeats; i++ ) { // Start one full animation, at 12 frames per second. llSetTextureAnim( ANIM_ON, ALL_SIDES, 6, 6, 0, 0, 12.0 ) ; // Wait for the animation to finish its run. llSleep( 2.0 ) ; // Stop the animation on the last frame (otherwise it 'freezes'). llSetTextureAnim( ANIM_ON, ALL_SIDES, 6, 6, 35, 1, 0 ) ; } // Play the animation to the 12th frame, and stop there. llSetTextureAnim( ANIM_ON, ALL_SIDES, 6, 6, 0, 12, 12.0 ) ; } }
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|