How do I play an animation on an avatar?


Kev asked me to make him a playing guitar animation which I think I did

I don’t know how to play it to test if it works, they use to go in attachments.
I see a json thing beside avatar settings but I don’t know how to use that
Anyone know how to run it?

MyAvatar.overrideAnimation(“”, 30, true, 1, 100);



:slight_smile: Thanks @Menithal @hyperlogic


They used to have a UI/UML component for it, but i do not know where that went

Scriptingwise however:

To play an animation:

MyAvatar.overrideAnimation(url, fps, boolean loop, boolean hold, startFrame, endFrame) in the script console.

  • hold true stops the animation and the end and it stays in the final frame.
  • loop true loops the animation

You can set these using the console without making a script

Then there is MyAvatar.stopAnimation() MyAvatar.restoreAnimation()

There also are the role animations but i wont get into those.
So someone probably could create a ui element to set those :slight_smile:


MyAvatar.startAnimation (, 30, true, false, 1, 100)
gives me an error
Sod it am not wasting a day of my holiday doin’ a favor
am not a scripter and shall never be lol

thanks anyways


it gives you an error because the url is not a string, try

MyAvatar.startAnimation(“”, 30, true, false, 1, 100)


edit: its overrideAnimation not startAnimation


TypeError: Result of expression ‘MyAvatar.startAnimation’ [undefined] is not a function


because a box which says animation url is 2 much to ask lol


I’m not sure what happened to the boxes, but the animation system is designed to work the avatar rig and roles most of the time now.
The rig has states like idle and fly, and the idea is you can override those, so you could set the guitar playing animation to always happen when idle instead of the standing.
You should be able to do it as a one-off event as well as Menithal describes but I’ve not tried that recently.
The benefit of a rig driven approach is you can stop the avatar doing things like flying and doing the animation at the same time.
Got some other things to look into, but I can try and cook something up with the file if you want later.


@KevinMThomas no I won’t make you a guitar animation Just do the show in second life :smiley:


I only remember play animation, and searched with that and got examples, but since I was typing everything with my phone I didnt check that they were assignment client scripts…

So instead, is seems like it is MyAvatar.overrideAnimation instead which isnt simply, but is logical, because its overriding the role animations. Id however prefer a simple playAnimation is much more direct, which is the same with Assignment Client scriptable avatar. I just wish they APIs were consistant. overrideAnimation needs to same playAnimation features for ignoring some bones.

Now that I am finally home I can finally test what I wrote:

@Judas my bad, Its actually. I tested them this time. I swear.

MyAvatar.overrideAnimation(“”, 30, true, false, 1, 100)



The reason for override instead of playAnimation is two fold: There is no blending of animations like in SL. instead thats what the Role animations are for: and the frames are there so that you can define multiple animations into a single fbx file and just use frames to define what part of the animation to play back and at what speed.


WOOHOO!!! Oh yea!!!


well I get pre post shenanigans and its not playing the animation
but its sorta right

thanks for the fix @Menithal

Judas returns to his never going near anything avatar related again policy .


Hey, It’s great to see folks experiment with avatar animations! Two quick points.

  1. The call should actually be MyAvatar.overrideAnimation(“”, 30, true, 1, 100); There is only one boolean, which is the loopFlag. It is documented in more detail here.
  2. Our animation system doesn’t currently support sparsely distributed keyframes. To get the best results you need to have a keyframe on every 1/30th of a second. This particular guitar playing animation does not. So, Although it plays back, it’s doesn’t look quite right. I could be wrong, but I think there are blender scripts available that will bake out the keyframes.

Hope this helps,


thanks @hyperlogic its playin gittar now lol
Still folds up but i think thats my obsolete rig pre post fixes it and it ends up in a odd location for me which is either related to my rig or my animation


I woulda spent longer on it but it took me an entire day to get to a point where I could play it in world to check if it worked at all
Not wasting my days off limping through code