1
\$\begingroup\$

I'm following this tutorial from Ryan Miller on how to create a rig of sorts from a sprite atlas sheet.

My intention was to put the panda behind a bamboo, but this is what happened:

enter image description here

The bamboo's Z-position has been set to 2, whilst the Panda's has been set to 6.

Here's a 3D look at the problem:

enter image description hereenter image description here

How do I fix this?

\$\endgroup\$
  • 1
    \$\begingroup\$ The issue must be from local Z position of FP_PandaArms, FP_PandaFoots, FP_Panda relative to Parent's world Z position. You shared only parent's world position, which is 6 in Z. Also use an Orthographic camera if you are not already. Share or check body parts' position in inspector as you did for SmallPandaRig. \$\endgroup\$ – Sourav Paul Aug 14 '16 at 20:00
  • \$\begingroup\$ @SP, your quite right. I can't think of any other way this would happen, and although we can not see the children transforms, its fair to say that they contain an offset that pushes them in front. Perhaps you should explain it better, in an answer? I interpret that asker is new to the transform concept (whether specific to Unity or not). It might be good to also point out that Unity does not like creating new objects at a default location, i.e. if you click "add new gameobject", it will spawn it at some ridiculous transform as opposed to the expected '(0, 0, 0)'. \$\endgroup\$ – Gnemlock Aug 15 '16 at 1:15
  • 1
    \$\begingroup\$ @SP, They are all the children are set to zero, with proper Order In Layer values so that the body is behind the head, etc - I found out that setting the Order In Layer to anything greater than zero causes this. I fixed it by adding sorting layers and putting the bamboo on it's own layer, but I'm not sure if that's an actual fix. \$\endgroup\$ – zack_falcon Aug 15 '16 at 3:52
  • \$\begingroup\$ Great solution!! Just be careful with UI layer. Share your solution as answer so that people can see if stuck as you did. \$\endgroup\$ – Sourav Paul Aug 15 '16 at 4:52
1
\$\begingroup\$

Because modifying the Z-position of the children of the Panda GameObject, I decided to mess with the Sorting Layers, as they were all set to default.

I decided to leave the Panda as is, and created a new Sorting Layer for the bamboo by selecting Add Sorting Layer from the list, and creating my own. It seemed to have solved the issue.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.