Binding dances together in a loop
|
|
Ace Arizona
Disasterpiece
Join date: 23 Feb 2006
Posts: 64
|
02-27-2006 11:29
I've noticed some of the dance animations sold are only two seconds long, yet some people have multi-minute dances. How do i string many of them together with little interuption, and loop them?
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
02-28-2006 06:24
Manage all animations and each time by lsits. For example, list AnimationList = ["Anim_A", "Anim_B", "Anim_C"]; list TimeLengthList = [2.0, 2.0, 6.5]; Then, loop them by timer... like llSetTimerEvent(0.1); // It should be fast as much as possible but the timer will delay during sleeping. timer() { ANIMATION = llList2String(AnimationList, n); // "ANIMATION" is a global string variable and "n" is a global integer variable. llStartAnimation(ANIMATION); // Starting a new animation. llSleep(llList2Float(TimeLengthList, n)); llStopAnimation(ANIMATION); // Stoping the current animation. n = n + 1; if(n == 3) n = 0; }
_____________________
 Seagel Neville 
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-28-2006 08:03
Incidentally, is there any way to get the exact play time of an animation? I couldn't see it in the properties menu.
I've just starting doing custom animations for my objects so I admit that I'm a bit new to them.
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
02-28-2006 08:14
Although it depens on how rate you're using when you create your custom animations, generally, it is 30FPS. It takes one second to play 30 frames. You can time your animation by the frame numbers.
_____________________
 Seagel Neville 
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-28-2006 08:18
I'd just use the timer myself, not have a timer and a sleep (for a start the sleep will knock off everything else in the script). Would have thought that something like this: list gAnimationList = ["Anim_A", "Anim_B", "Anim_C"]; list gTimeLengthList = [2.0, 2.0, 6.5]; integer gAnim = 0;
play_anim() { llStartAnimation(llList2String(gAnimationList, gAnim)); llSetTimerEvent(llList2Integer(gTimeLengthList, gAnim)); }
default { state_entry() { // Record the length of the list so we don't have to keep counting gAnimCount = llGetListLength(gAnimationList); // Play first animation play_anim(); }
timer() { // Stop current animation llStopAnimation(llList2String(gAnimationList, gAnim)); // Increment counter // If we've gone off the end of the list, loop if (++gAnim == gAnimCount) gAnim = 0; // Play the next one play_anim(); } } would be better.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
02-28-2006 08:21
From: Seagel Neville Although it depens on how rate you're using when you create your custom animations, generally, it is 30FPS. It takes one second to play 30 frames. You can time your animation by the frame numbers. Hmm, I've been making 30 frame animations that were coming out at 0.67s according to the upload tool... but I think that's a bit dubious. I'll have to check. Is there any way of actually determining the number of frames from the animation file itself though, or does one just have to keep good records or open up the source again?
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
02-28-2006 08:46
You have to keep records and/or open the source.
Although it's 30fps officially, remember the first frame's a reference - so a 31 frame anim should give you 1s. 30 should be 0.96666 if my maths is up to speed today.
In practise, even when I've had that, I tend to time the anim in SL, the numbers don't always translate quite as well as I'd like. I don't know enough about the various formats to speculate as to why that might be though.
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
02-28-2006 08:55
From: Ordinal Malaprop I'd just use the timer myself, not have a timer and a sleep (for a start the sleep will knock off everything else in the script). Yes, it will knock off everything but animation.  But your script makes sense much more than mine. Thank you. And speaking of FPS, I also need to look through it much more.
_____________________
 Seagel Neville 
|
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
03-01-2006 04:52
From: Eloise Pasteur Although it's 30fps officially, remember the first frame's a reference - so a 31 frame anim should give you 1s. 30 should be 0.96666 if my maths is up to speed today. Yes, the first frame is just a reference and it doesn't appear in the animation. That explanation makes sense. But I made sure that it was included in the time line. So the 30 frames of 30fps had just 1.00 second which was showed in the upper side of the uploading window. And if I created 31 frames, it turned out to be 1.03 seconds. Incidentally, if it was 30 frames of 15fps, it was 2.00 seconds.
_____________________
 Seagel Neville 
|