- Edited
unity bones positions flipping out
Hello,
We have just started out using spine for our unity game.
Upon importing the animations in unity we noticed that there is something strange going on with some animation transitions
Image removed due to the lack of support for HTTPS. | Show Anyway
As you can see, both the scarf and head dissapear and interpolate to the incorrect positions.
Here's an overview of our skeleton setup for the character. Image removed due to the lack of support for HTTPS. | Show Anyway
Since we're pretty new to spine, it could be that we are doing something wrong with the keyframed animations, since those seem to be effected.
However, here you can see that some of the bones are positioned incorrect (the sword )and that some attachments are incorrect (most noticeable on the feet)
Image removed due to the lack of support for HTTPS. | Show Anyway
I hope anyone can point us in the right direction.
Thanks in advance!
IK + FlipX/FlipY is broken all over the place. Beware if you're using Flip and IK at the same time (not just in Unity).
Other than that, are you sure you're resetting all your bones correctly with keyframes at the start of a given animation? Its not like the Spine Editor which uses ResetToSetupPose whenever you switch animations.
- Edited
Mitch wroteIK + FlipX/FlipY is broken all over the place. Beware if you're using Flip and IK at the same time (not just in Unity).
We are not using IK nor Flip. We were flipping the character by changing the scaleX. But even when we enable that the problem persists
Mitch wroteOther than that, are you sure you're resetting all your bones correctly with keyframes at the start of a given animation? Its not like the Spine Editor which uses ResetToSetupPose whenever you switch animations.
Yeah we're resetting them.
On the tech side I'm triggering an animation by calling
skeletonAnim.AnimationName = animation;
Should I be doing anything else?
Here's a demo scene where you can check out the problem, if it is of any help.
https://www.dropbox.com/s/eu88exnly4j39yq/Spine%20Problem.rar?dl=0
I had to mess up the textures, but it should still be clear haha.
The animation is triggered in a StateBehaviour btw, so you need to use unity 5 for this project I guess.
I'll take a look at it but it'll have to wait until Sunday at the earliest; got a big hackathon thing going on in SF tomorrow I gotta be at all day.
Can you try changing that to:
skeletonAnim.skeleton.SetBonesToSetupPose();
skeletonAnim.AnimationName = animation;
Mitch wroteI'll take a look at it but it'll have to wait until Sunday at the earliest; got a big hackathon thing going on in SF tomorrow I gotta be at all day.
Cool, thanks! Have fun at the hackaton
Xelnath wroteCan you try changing that to:
skeletonAnim.skeleton.SetBonesToSetupPose(); skeletonAnim.AnimationName = animation;
That doesn't seem to change anything unfortunately
Am home... won 1st place... goodnight lol.... zzzz
Congratulations! :party:
Proving once again that Spine-Unity is actually my dirty 2D side project, meanwhile everyone tries to make me do all these fancy AR/VR/3D things
if( skeletonAnim == null ) skeletonAnim = animator.gameObject.GetComponent<SkeletonAnimation>();
skeletonAnim.Skeleton.SetBonesToSetupPose();
skeletonAnim.AnimationName = animation;
adding skeletonAnim.Skeleton.SetBonesToSetupPose(); fixes your issue. your keyframes are wrong.
Mitch wrote
Proving once again that Spine-Unity is actually my dirty 2D side project, meanwhile everyone tries to make me do all these fancy AR/VR/3D things
if( skeletonAnim == null ) skeletonAnim = animator.gameObject.GetComponent<SkeletonAnimation>(); skeletonAnim.Skeleton.SetBonesToSetupPose(); skeletonAnim.AnimationName = animation;
adding skeletonAnim.Skeleton.SetBonesToSetupPose(); fixes your issue. your keyframes are wrong.
That looks great, really polished for a weekend project. And the sounds totally finish it haha.
I had already added that line of code after Xelnath had suggested it, it fixes some problems, but I the "FTZ_JumpMid" is somehow still messed up. And in the preview window everything seems to be even worse, but I can live with that I guess haha.
So you're suggesting our problem lies with the actual animations in the spine software? I hate to be that kid in class that just can't stop asking questions, but could you clarify what you mean with the keyframes? I'm not quite sure what I should relay to our animator now.
Edit: What might be related is that I have disabled "Bake Animations" and "Bake IK" in the skeleton, but when I run the scene the values are permanently enabled again, even when I stop playing the scene afterwards.
Edit2: I noticed that the animations seem fine when I disable mxing Image removed due to the lack of support for HTTPS. | Show Anyway
This is what it looks like with mixing; Image removed due to the lack of support for HTTPS. | Show Anyway
During a tutorial it was mentioned that meshes and using mixing doesn't play well together, perhaps that could be the source of our problems? Because we are indeed using meshes on some parts.
Thanks a bunch for all the help!
Maybe pharan was right and I should just delete baking :/
Baking has absolutely nothing to do with your project.
Send your .spine file (with some blacked out source images if you must) to unity@esotericsoftware.com if you would.
Mitch wroteMaybe pharan was right and I should just delete baking :/
Baking has absolutely nothing to do with your project.
Send your .spine file (with some blacked out source images if you must) to unity@esotericsoftware.com if you would.
Yeah I have no idea what it does to be honest haha, I just noticed the strange behavior of it toggling on.
I've send the e-mail, thanks for all the trouble again
Sorry for delay in reply, been crazy busy.
The easiest to reproduce transition fail is FTZ_JumpUp
FTZ_Run.
The bit that is wrong is that your JumpUp animation has a Scale key setting Y to -1, and not in Run, so when you transition from JumpUp to Run the Scale Y of the SCARF BONE is never reset. Similarly you're using a HEAD BONE and scaling it down in one animation or the other.