How to get the actual time of an animation that is playing?

Hello,
I’m importing a baked animation, and I’m using it as animationGroups[0].
https://playground.babylonjs.com/#IQPBS4#3
I should do some stuff when the animation is, for example, at 50% of the lenght.
How can I know the actual time of an animation that is playing?
I’ve looked in the docs of the " AnimationGroup" Class

but I can’t see any property of method for it.
Many thanks!

1 Like

IDK if there’s a better or easier way, but you can for example drill down to one of the RuntimeAnimation objects and see what frame it’s at, then divide by the number of frames to get a progress value.

Note, this is based on the assumption that all animations in the group are normalized to have the same number of frames and that they start at frame 0. This is already true in this case for the your PG, but animationGroup.normalize could be used if it wasn’t.

Here I logged this progress value every 50 ms for example. :slightly_smiling_face: :beers:
https://playground.babylonjs.com/#IQPBS4#14

3 Likes