AnimationGroup stop very slow if there are a lot of Animatables


I want to stop some AnimationGroup-Items at the same time.
I have some animated characters with a lot of animations which are going on at the same time. At some point I want to stop the animations of them.
This is very slow and my scene is frozen for some seconds.
There are ~100k - 200k animatables (scene._activeAnimatables.length) in my scene.

I have checked the code:

and this:

Turns out that calling this._scene._activeAnimatables.splice(index, 1); on every single instance of Animatable is very slow and causing the issue.

So my question:
Is there a better way of stopping animation groups without having such a freeze of the whole scene?

Thank you :slight_smile:

Thanks for the report, there should definitely be…

Can you share a repro so that I ll fix it ASAP ?

+1 on the repro, but as a general suggestion, if you don’t need blending, there’s Baked Animations which are way faster :smiley: Baked Texture Animations | Babylon.js Documentation (

Thank you. I will provide you a Playground link as soon as I can.

1 Like

Here is a simple playground:

There are some characters loaded with a lot of animations (the animations are starting after loading).
It took 800ms on my system to stop the animations.
There is a little “gui” where you can see everything.

You can change the amount of items to add some more but it will take a while to load.
But I guess 10 items are enough for visualization :slight_smile:

1 Like

Thanks for the repro! @sebavan will you take a look?

Here is the fix:)
Improve how we delete massive group of animatables from animationgroup by deltakosh · Pull Request #13641 · BabylonJS/Babylon.js (

moving from 659 to 39ms on my computer ;D


Cool! Thank you! :slight_smile: