07 February 2012

Restarting a looped animation

I have a vehicle where the avatar does a looping animation that's in sync with some of the prim animations... When I cross sim boundaries they fall out of sync.

I thought that restarting both when the vehicle crosses a sim boundary would put them both in sync. It turns out that stopping and restarting a looping animation is more difficult that it sounds.

I tried llStopAnimation(A) followed by llStartAnimation(A). The animation continued looping like I'd done nothing. I tried adding a short llSleep() between the stop and start. No effect. I tried briefly starting and stopping a different animation between the stop and start. That interestingly did nothing as well.

What finally worked was a combination of the two.

llStopAnimation(A);
llStartAnimation(B);
llSleep( 0.1 );
llStopAnimation(B);
llStartAnimation(A);


I suspect it's related to a change intended to prevent griefing via bombing someone's viewer with animations.

No comments: