Search Unity

2D Parallax background object help

Discussion in '2D' started by JuiceBox, Jul 10, 2015.

  1. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I'm trying to make it so certain objects parallax in the background of my 2D sidescroller. I'm using a perspective camera and an orthographic camera. The orthographic renders everything but the layer that I put my background object (In this case it's called "Jebidiah") in, and the perspective camera only renders the Jebidiah layer. Only problem is, well, this.


    You can probably see the problem. The big statue thing, well that's Jebidiah. As you can see, it's rendering above everything else. Of course, I don't want that to happen. So how can I fix this? Here's some images of the camera settings.



    Just for the heck of it, here's the Jebidiah object.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just use one perspective camera. There's no particular reason to use orthographic for this that I can see.

    --Eric
     
  3. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    I guess that is possible, but it'd take a whole lot more time and I'd have to rely entirely on the layer sorting for sorting objects.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I'm not sure why it would take more time, or why sorting would be any different.

    --Eric
     
  5. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    Actually, there seems to be this problem that happens
    Sorting would be different due to the Z axis. I've been sorting certain objects with it. And it will take up time to make everything's Z axis to 0, and setting up everything to work with 2d sorting layers. There's also this problem where objects go behind other objects at random times, even though their Z axis is the same.Here's an example:
     
  6. JuiceBox

    JuiceBox

    Joined:
    Jan 24, 2015
    Posts:
    41
    (Nevermind, I fixed it. It was a sorting layer problem)