Repeated AnimationGroup.onAnimationLoopObservable triggered when speedRatio < 0

Hi all, I’ve found a bug with the onAnimationLoopObservable when I play my animation backwards (negative speedRatio)

Here’s a simple repro: https://playground.babylonjs.com/#CBGEQX#648

Open devtools and see the flood of message “Animation loop completed” after you click the “Reverse” button I added.

Note there also appears to be some other weirdness with the animation - I would expect negating the speedRatio to simply run the animation backwards in a loop, however it seems like all kinds of other things are happening?

1 Like

The amazing Babylon daddy @Deltakosh will have it fixed in the next nightly :slight_smile:

In the meantime you could do this instead https://playground.babylonjs.com/#CBGEQX#650

You will anyway need to call play again after changing the ratio.

1 Like

I fixed fully so actually the current code will work (I thought I did it some times ago but apparently no)

2 Likes

We figured the fix is only addressing the event triggering too often but not the actual animation weirdness.

@Deltakosh will fix it tomorrow, you can follow the issue here: Animation group negative speed ratio is not working. · Issue #11225 · BabylonJS/Babylon.js · GitHub

1 Like

Thanks both for the speedy responses :+1: