• Bug with your version of BoneComponent

Hi,

I posted this as a comment on gitHub too:

There is a bug with the current BoneComponent, when using colliders and fliping the skeleton.
As the bone gameobject is only rotating on the Z-axis, when the skeleton is flipped on the X axis, the collider attached to this gameObject is upside down. In my example, it makes the collider not correctly placed as you can see in these 2 screenshots:
-skeleton not flipped (collider position is correct): http://i1372.photobucket.com/albums/ag3 ... 85a0e6.jpg
skeleton flipped on the X-axis (collider is upside down and thus positionned too low): http://i1372.photobucket.com/albums/ag3 ... e603ca.jpg

Best,
Vinnie

Related Discussions
...

Thanks! I'll do some testing and try to find where the problem is.

If you find something too, let me know.

The problem relies in the fact that the rotation of the game is done only on the Z-axis.
When the skeleton is flipped, a rotation should be applied around the Y-axis too, to avoid the gameObject/collider to be upside down, I guess...

Oh, and by the way, thank you very much for your big involvement in the development of the Spine runtimes on the Unity/TK2D side and your activity on the forum. You're always a big help for Spine/unity users.😉

I'm not able to replicate the bug.

Though I do recognize that the current version of BoneComponent doesn't flip the attached GameObject on its local axis so it would come out backwards if the skeleton was flipped. I'm going to fix this

But I think this is a different problem from what you have, unless you have some extra code.

What's your setup?

No extra code here. Maybe it is related to the way bones are attached on the skeleton. But I can't tell anything about it, as I'm only the unfortunate programmer, not the artist reponsible of the skeletal animations! :notme:

Though I do recognize that the current version of BoneComponent doesn't flip the attached GameObject on its local axis so it would come out backwards if the skeleton was flipped. I'm going to fix this

Let me know if you can work on something like that. I will test it with my Unity/Spine project if it can help. On my side, I'll see tomorrow if I can send you some package to clearly indentify the bug.

Unfortunately it's not working either.

But I found a workaround:

  • Dont use followFlips.
  • Instead, when flipping the skeleton, just set to the transform.localScale.x of the gameObject which the BoneComponent script is attached to a value of -1.
    I don't use flipY, but I guess it should work the same...

So I ended up adding this code to your previous version of BoneComponent.cs:

float scaleX = (skeleton.flipX) ? -1f : 1f;
float scaleY = (skeleton.flipY) ? -1f : 1f;
cachedTransform.localScale = new Vector3(scaleX, scaleY, 1f);

That's really odd. I'm really not seeing the problem on my end.
I wish I could see your setup.

I made a lighter version of my project I intented to send you, but I realized it's working perfectly with your latest update of the BoneComponent. I dont' get it! 😐

I don't know why I still have an issue with my full project. I'm gonna investigate my scripts... I feel so sorry for the hassle. Thanks anyway for your time. You helped me a lot.

Best

Vinnie

Well, the Spine runtime is open sourced so that users can freely change the code based on more specific setups so I guess this is fine.

Glad to hear both versions are working somehow.

I guess I should have removed the BoneComponent and reassign it again with each new update you made, because now it's working fine with your newest version. So my issue is fixed.

Thanks again for your help, mate. Now I can fully focus on my game development! 🙂

Oh, by the way: what kind of game are you doing with Unit/Spine?