AnimationGroup goToFrame bug when from and to frames reversed

Hello It’s me again :sweat_smile:

I found another problem with animations groups.
It’s kind of a merge of my 2 previous topics.

When you’re using goToFrame on an AnimationGroup where from and to frames are reversed, it doesn’t work as intended.
(I also tried with a negative speed ration and the result is the same)

Here is the same example that i put in my goToFrame topic but the from and to frames are reversed.

cc @Deltakosh

Unfortunately we are hitting the limit of the system here. The from and to are not supposed to be reversed AND then used to jump. This will imply a lot of check and work in the animation engine.

I would recommend in your case to have 2 animations (both from 0 to 30 but with key value inverted)

ok I may have another solution lol!

Here we are: Animation Examples | Babylon.js Playground

The idea is to stop all the animation to clear the caches and then play from the new key!

1 Like

I tried your solution, but it actually didn’t work.

Indeed, when you’re stopping the animation and clearing all animatables, the goToFrame does nothing:

So when you’re playing your animation after that, it will start at frame 0

What about the idea I shared earlier with 2 sets of animations?

Also this then:

This is similar to what i actually have in my project.
I declare an animation with my from 0 to 50% my real animation, and from 50% to 100% the reversed animation.
But this is linked to some UI sliders witch are listening to the current frame of the animation.
In my case I have some asymmetric animations and some symmetric animations.
and that’s why i’d wanted to have a reversed animation in termes of frame for my symmetrics one

This seems good like that, i’ll try it, thanks :slight_smile:

1 Like