• Runtimes
  • [Cocos2d-X v3.2]

Hello Guys,

I want buy Spine but before that i want make a few questions to realize if Spine can solve my problems.

I'm developing a 2d platform scrollable game with Cocos2d-x and Box2D. At the moment i'm using the physic engine only to detect collisions because i'm doing the movements of the characters and obstacles using the Cocos2d-x functions (MoveTo, JumpTo etc) and after that, in every update of the scene i'm firstly sync bodys with Sprite positions , after that make the world step and after that manage the contacts in the box2d contact listener.

Because of this approach when i stop the game after a collision my game object positions always look like they have stopped in the next frame and not in the frame where the collision occurs (due to sync physics with cocos2d-x animation).

If i use Spine animations how works the sync of the sprite/animation with box2d?

Regards

Related Discussions
...

You can stop updating your animation or switch to a different animation once a collision is detected in Spine. Due to the way Spine interpolates between bone positions as opposed to jumping between spritesheet frames, the jump to the next frame wouldn't be very noticeable, maybe not even noticeable at all. You have full control of each bone at runtime so you can do pretty much what you want with them to suit your needs.

Hello Shiu,

Thank you for your answer. My question i think that is another. Imagine that i have a bird that can fly over my scene, and i make an animation in Spine of this bird shaking his winds and i want that this animation runs always that i have a bird in scene. How can i make the sync between sprites of the bird and his physics body? Spine do this in runtime or should i update the bird physic body position with the bird position in every frame update?

Regards

So you want the wings to flap depending on if the bird is flying up or down? I'm not entirely sure what it is you're looking for.

Hello Shiu,

Basically what im trying to say is: at the moment um using functions from cocos2d-x to made the animations in my game and im facing some problems on syncing sprites with box2d bodies. My question is: how to Spine manage the support of animations to a physic engine like box2d? Its possible to do this?

You can manipulate the bones of a Spine skeleton at runtime whichever way you want, you can even have the bones controlled by physics so the short answer to that is "yes" you can do that.