How to play animations in loop

I am trying to call multiple animations from a GLTF file based on the animation name and play them in a loop. In below playground, it plays the last animation found first and if there are some frames left in first animation, it catches up and stops.

I am trying to play “pockets” and “wave” animation one after the other in a loop. How do I do that?

https://playground.babylonjs.com/#D99WNM#1

Hello and welcome!

Here is just an example of possible solution with onAnimationGroupEndObservable - https://playground.babylonjs.com/#D99WNM#3
(you’ll need to make the second observer to make a loop)

1 Like

Thanks, @labris.

I took it further and looped through 3 animations and stop. Was able to do that here - https://playground.babylonjs.com/#D99WNM#6

Then made it to loop 5 times through all 3 animations and then stop here - https://playground.babylonjs.com/#D99WNM#7

Now I am wondering how to go about this -

Import Mesh A and play the only animationGroup available in A
replace Mesh A with Mesh B and play the only animationGroup available in B

2 Likes

Hello @sagar_86 just checking in, was your question answered?

Yes. I had a follow up but my original question has been marked as answered

2 Likes