Spine Rendering Issue

Spine Rendering Issue
0

#1

Hi all,

I set the node’s active to true and then setAnimation of its Spine component, and I expect to see, that the first frame of rendering is the first frame of that exact animation, but the result is, that I see the skeleton bones in their default position for one frame and only after that the animation starts to be rendered. Is there any way to fix that glitch? Or why setAnimation function called after .node.active = true is not affecting the rendering immediately?

@jare


#2

The issue here is that when you start playing the animation, it doesn’t actually call update on the animation until the next cocos2d update call. I had this happen in my game, so to get around this, I needed to call update on the animation right after setting the animation.

For example (this is in C++, so you’ll have to adapt it):

skeletonAnimation->setAnimation(0, “MyAnimation”, true);
skeletonAnimation->update(0); // Force an update to make sure it renders it in the current frame


#3

Yes , this works and is a nice workaround, but I think better to put this line of code inside the engine. I wonder why its not implemented like that.


#4

If by engine you mean Cocos2d-x, it’s not their issue or responsibility. It’s in the code that is provided by Esoteric Software, who created the runtime for Cocos2d-x.

It may not be a good idea to change the runtime behavior to force the update call inside the setAnimation(), since you may want to call other methods on the skeletal animation before the update occurs. The current behavior of the code may actually be correct, and it lets the developer decide if and when there is a need to call update() after the setAnimation().


#5

I will ask Owen to read this thread. He is currently on holiday and can get back to you tomorrow.