Z Weirdness

I have a main character and a bush, both planes with textures applied to them. The camera is orthographic. Now, the character goes behind the bush, his Z notably less than the bush’s Z. But instead of showing up behind it, he shows up in front of it, in both scene and game view. What on earth is the problem?

Its the way Unity draws geometry. The trick is to use two cameras if you can.One for backround elements, one for foreground. Use a third one if you also need stuff in front of your actor. Its all to do with what order things are drawn in, Im pretty sure this has come up before and Aras has given full descriptions…the quick fix is what I just said.

Its similar to the issue of z-fighting.

Hope that helps you move ahead…
AC

Edit>It could be that your bush needs to have the lower z value rather than actor.

Hm, I don’t understand how to get two cameras rendering at once.

I made a second camera with a different depth and only one would show.

You shouldn’t need different cameras; it sounds to me like the Z order is reversed. You want higher Z values for objects farther back, so objects with lower Z values appear in front. Just like in 3D (assuming the camera is pointing forward along the Z axis and not backward, of course).

As far as cameras go, in order for one to not completely block another, the clear flag has to be set to depth only. But only use multiple cameras if you really need to, since there’s a performance penalty for more than one (probably quite small depending on the hardware), not to mention making things more complicated with layers and so on.

–Eric

EDIT>
Erics right , I might have mislead you there, try reordering in z depth with on cam>>>Orig post>

"Try this. Ignore my naming conventions in the pic, Ive used layers that will work in your project anyway. you need to specify which layers the camera is rendering in its cullig mask, and then put objects into layers at the top of inspector.

HTH"
AC

45651–1659–$moldorma01unitypackage_387.zip (44.5 KB)