AnimationGroup documentation issue

Hi there !

I found an issue in the AnimationGroup documentation.
https://doc.babylonjs.com/typedoc/classes/BABYLON.AnimationGroup

Take a look at this playground.

Click pause while the box is moving. The box stops moving. The method used is pause.
Now click play and you’ll see the box resume its animation from where it stopped. The method used is restart.

The restart of AnimationGroup documentation states :

Restart animations from key 0

But it seems it’s not the case. The play method documentation also states :

Play all animations to initial state This function will start() the animations if they were not started or will restart() them if they were paused

Which I think suggests the current behavior is the correct one.


In this playground, an animation group is used to move the cube left then up using two animations that start at the same time, but end at different times.

Now change the restart method used in the button to the play method.

If you pause the animation while the cube is going up and click play, the animation will restart entirely because the first animation making the cube move to the left ended. This makes the play method quite confusing to me and I think it’s possibly behaving wrong.

I hope i’ve been clear enough. and thanks in advance for looking at this.

1 Like

That’s a good catch. Actually 2 good catches.

You are right, the documentation of restart is incorrect. This will be corrected soon.

And you are right, the play method should behave just like restart in the case you are referring to. I can see why it doesn’t, but we will have to understand what is the best way to solve this.

1 Like

Do you have an issue board (like Linear.app/Trello) that you record issues like this so we can track them?

Yep, GitHub :slight_smile:

But we deal with bugs instantly, so you will not find an issue for this one. The following PR is waiting for review from the team:

AnimationGroup start should restart if an animatable is available by RaananW · Pull Request #15267 · BabylonJS/Babylon.js (github.com)

4 Likes

Nice, thank you for fix !