- 已编辑
( Cocos2d-x ) spine animation problem
Hi All,
I am facing a problem while animating characters Spine 2.1.01 Professional. When I export the JSON file (imported on Cocos-2d-x), some images are getting displayed when they are not supposed to...and some others are disappearing when they should be visible (on animation).
I wonder why this is happening? Can anyone help? Thanks in advance :-)
Any ideas/suggestions would be really appreciated. I'm totally stuck!
Thanks
Sounds to me like you're using 'Slot' animation. When you switch animations at runtime it will use the previously visible 'Attachment' if it has been keyed.
You can use 'setSlotsToSetupPose' to force it to use the Setup pose attachments before switching animations or make sure you set keys for the slots.
See http://esotericsoftware.com/spine-using ... s#Skeleton for more details.
Hi Shiu Thanks for the reply.
But I am not able to make it work. My problem extactly is, I have a character with a Sword, and it has several animations like KICK, and PUNCH in which the Sword in hidden, and it has an action in which it attack with the Sword. Now what happens is, initially when the Sword is visible, and the character attacks, it shows correct animation, but as soon as it fires another actions which doesn't have sword, the next time the sword animation doesn't show the sword, however it shows/hide other elements in switching between the animations.
Can you please help, what could it be?
Thanks.
Which other elements does it show?
let's assume the following:
Animation 1, your sword is visible.
Animation 2, your sword is hidden
1, First you load Animation 1 and it shows the sword.
2, You then load up Animation 2 which does not show the sword.
3, Now you load up Animation 1 again but since a key was set to hide the sword in Animation 2, the sword is no longer visible.
To fix this you need to set a key on Animation 1 to show the sword or use setSlotsToSetupPose
to force it to use the slots from the setup pose.
You wrote "however it shows/hide other elements in switching between the animations.". Can you please elaborate on this?
Hi thanks for the reply,
So I need to use
setSlotsToSetupPose
to solve the problem, can you tell me how to use this from the software, I can't find any option to do this.
And regarding the following line
"however it shows/hide other elements in switching between the animations."
I meant I have other animations in which I am hiding and showing elements, that works fine. Like I have added shine when character swipes the Sword, that is visible while swiping the Sword, though sword is not visible.
See http://esotericsoftware.com/spine-using ... s#Skeleton it's used at runtime not inside Spine.