Time-based animation


We would like to make our animations time-based rather frame-based, to avoid slowing them down on slow-computers.

Is it acceptable performance-wise to use the currentTime() function from pc.AnimationComponent in a custom loop of ours to set the current frame?

Best regards,

The performance of setting currentTime on animation components really depends on the number of bones and the number of animated characters in a scene. Internally the function setCurrentTime on pc.Skeleton is called which you can see here https://github.com/playcanvas/engine/blob/master/src/anim/skeleton.js#L216.

Setting the currentTime of an animation has been used in some projects e.g. to synchronize audio and animation like this http://playcanv.as/p/klyMJ4h8 .

So I suggest trying it out in your project and see if it works out well for you :slight_smile: