Load GLB with Animation HELP

Hi, is it possible to choose which animation to play from the animation track in the viewer? I need to play the 4th animation track instead of the first one. I’m using loadGLB.js to play the GLB container. thank you in advance

Project: PlayCanvas | HTML5 Game Engine

Viewer: PlayCanvas glTF Viewer

I need to play the key.002 from the viewer track

Are you talking about the BabyElephant_GLB.glb or the other ones?

You can play which track is selected in the drop down here:

the GLB2.glb file, I can play them all in the Viewer, but how can I play it in the editor?

I have made an example to load and play any of the animations in the GLB file:

I am naming the animations, “Animation 0” … “Animation N”, but you can use your own naming convention, in the load-glb file, line 22 is how I play the animation

renderRootEntity.anim.baseLayer.transition("Animation 0");

it works, thank you, lastly, is it possible to join 2 animations? for example animation 0 and animation 3 to play at the same time?

Yes it is possible, see

sorry, I’m a bit new to this loadGLB script. can it be on the script? thank you so much

renderRootEntity.anim.baseLayer.transition(“Animation 0” + “Animation 3”);

Hi, its a bit more complex than that, you can look at this example to blend two animations:

We don’t yet have a tutorial for this but you can have multiple layers in the anim state graph, one for the main body and the other for the face I assume?

Then you can then transition to different animations on a per layer level. Layer masks can be used to filter out what should be animating on each layer: Anim Layer Masks | Learn PlayCanvas

is it possible to use anim layer mask also when loading the animation from GLB container?

This is the example that should help you with this I think

1 Like