I am trying to play an animation reversed (from the end to the begining) from Unity.
I'm pretty sure it is possible, as I read this part of the doc:
However, so far I have been using the animation state, with setAnimation() and addAnimation() and I never worried about updating the time and calling apply() and updateWorldTransform(). Is it something that is required? Why does it seems to work without it?http://esotericsoftware.com/spine-using-runtimes#Applying-animations
Applying animations
Animation apply overwrites the current pose of a Skeleton with the pose from the animation at a specific time:Skeleton skeleton = new Skeleton(skeletonData);In this example, the animationTime is incremented by the delta time since the last render. Next, apply is called which changes the bones and slots that have keyframes in the animation. If bones are changed, only the local SRT is changed. Next, updateWorldTransform is called to compute the world SRT for each bone. Lastly, the skeleton can now be rendered, which uses the world SRT for each bone.
Animation walkAnimation = skeletonData.findAnimation("walk");
float animationTime = 0;
...
function render (float delta) {
animationTime += delta;
walkAnimation.apply(skeleton, animationTime, true); * true is for loop
skeleton.updateWorldTransform();
renderSkeleton(skeleton);
}
The time passed to the apply method controls the speed of the animation. It can be decremented to play the animation backward. An animation is complete when the time is greater than the animation duration.
Because the animation time is not stored inside the animation, the animation is stateless and can be used for any number of skeleton instances.