AdamGMain

In a small project I am working on, I have a character that I want to patrol around the screen a little. It chooses a random target to the left or right and heads there, waits some random amount of time, and then repeats. When the unit moves left on the screen, I am setting SkeletonAnimation.skeleton.ScaleX to -1, which is successfully flipping the sprite and animation. The problem is it seems to be flipping it on some arbitrary point some distance to the left rather than flipping it at the location of the root bone.

I've opened the project back up in Spine itself and confirmed that when I scale the root bone to -1 on the X, the flip works like you would expect.

I don't know if I am missing something simple in Spine itself, or if the problem is coming from Unity. For what its worth, the Gameobject in Unity is not parented to anything, so it's not a parent/child transform problem that I can see.

I've attached a few screenshots to try and convey what I am seeing. Any insight is appreciated.

NotFlipped.png


FlippedX.png


SpineFlip.png


---

Ok, for anyone wondering, this was just a stupid mistake on my part in Spine. For a reason I can't recall, I had moved the sprite off the world origin in Spine. You can see this clearly if you look at my last screenshot and notice the Translate is wildly huge. Zeroing this back out fixed the issue.
You do not have the required permissions to view the files attached to this post.
AdamGMain
  • Posts: 1

Misaki

We’re glad to hear you've figured it out! If you have any further questions, please do not hesitate to post them on this forum.
User avatar
Misaki

Misaki
  • Posts: 842


Return to Unity