Hello I have some 2d character in sprite I've rigged to use in Unity 2D.Something like this, with separate body parts.
Although I've used weights and geometry, these body parts are supposed to move independent of each other, so there is no stretching/blending (or whatever you call it) of the shapes/body parts. Now I've created the rig successfully, I realize that these body parts are no at the order I want, meaning some parts are overlapping others in the wrong order. How should I fix that?
2 Answers
It's really simple, but Unity changed the interface recently so most of the tutorials weren't helpful and I didn't know what keywords to look up.
So if you click on the sprite image in the asset folder, go to Sprite Editor in the Inspector, then click on skinning editor (at the top left corner), and then you double click on the image for the bones to show. And then click on a bone, and it allows you to edit the depth of each bone. So that's it.
you would want a seperate game object in the scene for each part. You can use the "order in layer" property on the sprite renderer, or the z value to determine what draws on top of what. You should build your character has a hierarchy of sprites, and use the parent/child relationship to make the objects pivot how you like. For example you can have
bodySprite
shoulderJoint
armSprite
In this case body sprite is the body, shoulder joint is located where you want the arm to connect, then the arm is a child of the shoulder joint, and you offset it down so the top of the arm connects with the shoulder. Now if you rotate the shoulder joint, the arm rotates around the shoulder.
-
\$\begingroup\$ maybe I didn't describe it clear enough and there are multiple ways of doing this, so this is not what I'm asking. But I've figured it out and am writing an answer right now. \$\endgroup\$ Apr 12, 2019 at 5:07
-
\$\begingroup\$ I provided a solution but it wasn't clear that you wanted it within the new 2D skinned sprite system. I was merely suggesting to use a different method since this system is new and might be harder to find support for. But if you found a solution for skinned sprite system then by all means you should use it. \$\endgroup\$– gjh33Apr 12, 2019 at 13:24
-