Hi, I am new to PlayCanvas, it seems a great work !
I am now trying to play with the animation component and have trouble with it.
How can I know if an animation play to the end if its loop is enabled ?
What I need is something like this:
Hi, there are no events like that on the animation component unfortunately, we do plan to improve this component in general.
For now you can get the duration of the animation from entity.animation.duration and then have your own timer to count how many seconds have passed since the animation started. You could also do a setTimeout( functionToExecuteAfterEnd, this.entity.animation.duration * 1000) although you’ll find that setTimeout is not as accurate.
I did this in the past by keeping track of the previous frames current animation time and compare it to the current frame. If the current is lower than the previous, than it has looped.