Animation group blending with glb file

Hi, I am trying to get smooth blending transitions between two animation groups here:

Can anyone help or tell me what Im doing wrong?

FYI I am very new to coding and babylon so I’m going off the great babylon documentation. I would also be interested in some paid mentorship or training if its available?

1 Like

Hello there! @PatrickRyan will be the perfect person to answer this :slight_smile:

@Aleebster, when I was looking at your scene, I noticed some strangeness with the animation property overrides. We are looking into it to either update the engine or the docs, but there is something missing. In the meantime, if you use the overrides at the scene level, they will work for you. I made a couple small changes to your playground to set overrides at the scene level and to add a function to handle the change of the active animation group playing. This way you can easily pass the correct group to switch to and not have to remember what animation group sits at which point of the animation groups array.

Hopefully this unblocks you for today and when I can circle up with the team about the overrides, I will ping back.


Thank you Patrick! You are a gentleman and a scholar :grin:
I have spent way too much time trying to fix this!

1 Like

This is great! I am trying to do something like this too, but I want it so it can push just once and not loop.

I almost have it working, but after several repeated pushes, the blending back to the idle seems to loose it’s smoothness and “snap back”.

Is there any way to fix this?

@vx9, I reworked the scene a bit to make it easier to manage clips and how they loop or path to the next animation. You can see in the reworked playground that I revised the changeAnimation function. Some of the issue you were running into were that the variable you declared named “done” was undefined, and was causing some issues when testing the value.

You also are adding an observable every time you click the button. The observable list was growing with each click. Using addOnce takes care of this since you want to abstract the call to play a new animation without bloating the observable list. Using addOnce will add the observable and once it gets used, it is removed from the list.

Some of the issues you were having stemmed from managing clips that had different needs for looping and for pathing to another animation. To help organize this data and remove some of the management of the changeAnimation function from managing what clips have what parameters, I set up objects for each animation. This helps you by keeping all the pertinent parameters for each animation clip together in one place. The object holds the animation group to play, the value for loop, and the next animation - if any - to play. Additionally, the next animation parameter holds an array of objects so you could randomly choose between different idle animations for example. And if the next animation array is empty, it will not add the observable and will just continue to loop.

Lastly, calling the changeAnimation function again in the onAnimationEndObservable rather than using allows more flexibility as you can then path many animations in sequence. Since the group that is playing has it’s own information about the next group to play, each one can path to a new group meaning it will work for a sequence of any size.

I hope this helps unblock you, but ping back with any additional questions.


Thank you! This is amazing.