How can I start different animation take with the Viewer API


(Pierre Savoie) #1

I did a big workaround with my Christmas project by looping certain part of a big timeline.

It would be much easier to organize and would cause less bugs if I could call different animation take instead.
I don't know where to start, any help would be appreciated.


You should be able to use getAnimations to get the list of takes and then setCurrentAnimationByUID to choose one of them to play?

(Shaderbytes) #3

of coarse you can only use the viewer api in external embeds, there is no way to script your scene on the sketchfab domain.


The question title does say "with the Viewer API" :confused:

(Shaderbytes) #5

it is also not possible to have any animated object not currently being animated on any frame but the first. it is also not possible to get decent feedback when the animation finishes :wink:

(Shaderbytes) #6

yeah i know but experience has taught me half the time people are just looking for extended functionality on their model uploaded to the sketchfab domain. The other half know it is not possible , i was just making sure i covered the first 50% :wink:

(Pierre Savoie) #7

What do you mean by that?
That everything in my scene need to have at least a keyframe on the first frame?

(Shaderbytes) #8

no meaning when you are done animating an object it will return to frame one when you move to another object, it wont remain on the current frame you left it in.

(Pierre Savoie) #9

Ah, okay I understand now, thanks :wink:
I will start testing it out with what James gave me, see what I can do.

(Shaderbytes) #10

I have mentioned this to the dev team before that they need to look at the structure of animations(clip) in Unity. Animations or clips have properties and further they belong to a component controlling them like animator or animation component. This controller also has properties. So you can tell each animation to loop or not, not the controller.

Currently on sketchfab such properties are only on the controller. Loop means loop the list of animations. There is no individual animation control. Also you cant change the list (add remove clips ) you will have to construct your own list for that. calllng getAnimations will just return a list of all available animations.

(Shaderbytes) #11

lastly you cant play multiple animations on top of each other( at the same time ) since you only have one controller. good luck with you scene post your result here if you win