• Runtimes
  • issue FlipX with cocos2d-x

Dear!
When i flipX, the CCSkeletonAnimation is wrong animation position.

My code here:

charac->_skeletonNode = CCSkeletonAnimation::createWithFile(Constant::pathResourceChar(pathJson.c_str()), Constant::pathResourceChar(pathAtlas.c_str()),0.4f);
charac->_skeletonNode->setAnchorPoint(ccp(0, 0));
charac->_skeletonNode->setPosition(ccp(0, 0));
charac->_skeletonNode->skeleton->flipX=charac->isEnemy;
charac->_skeletonNode->isPause =false;
charac->_skeletonNode->updateWorldTransform();
charac->_skeletonNode->setAnimation("Chay", true);
charac->_skeletonNode->updateWorldTransform();
charac->_skeletonNode->timeScale=1+this->stats->getMoveSpeed();
charac->updateBoundingBox();

My files here:
https://www.dropbox.com/sh/mvmgs29j2gym ... ofPCJVkzoa

Video for issue:
https://www.youtube.com/watch?v=Y87molQ ... e=youtu.be

Please help!

Related Discussions
...

Can you share the Spine .project file and the images at contact@esotericsoftware.com and include a link to this thread in the email then I'll take a look at it.

i sent you email. Please check it. Thanks

I've just taken a look at your project.
Your root bone is not placed at 0 which is probably what causes the flip issue.
In some cases it's best to not do any animation on the root bone. You can just insert another bone and move the animation from root to the new bone, then in setup mode set the translate values of your root bone to 0,0

I hope it helps! 🙂

Thank Shiu. I found that issue yesterday, root bone not at (0,0).
Thanks a lot.