text: Perspective Camera on only one axis. - Unity Answers
  Question by Jonesy19 · Dec 22, 2016 at 04:47 PM · unity 2daxisorthographicperspectiveparallax
  Perspective Camera on only one axis.
  Hi everyone, I'm creating a 2D game with a parallax background. I am using a perspective camera to do this. I'm looking for an effect where ONLY the X-axis is effected by the perspective camera, and the Y-Axis is not.
  I know this can be done with an orthographic camera and scripts that manually move the objects, but it just makes things simpler to use a perspective camera. Anyways, is there a way to make a perspective camera perspective on the X-Axis and orthographic on the Y-Axis?
  destructivArts · Dec 22, 2016 at 08:15 PM 0
  Can you describe what you mean in more detail? ie. If I use the camera you are describing to render a cube, what does it look like, if I put the cube on the left edge of the screen? On the right? At the top? etc.
  Jonesy19 destructivArts · Dec 22, 2016 at 08:19 PM 0
  Sure, sorry - I probably could have been more descriptive...
  I have say 100 sprites in my scene (it's a Unity2D game). I have 5 layers, one main layer that pans with the camera (no parallax), 3 layers behind the main layer (these layers progressively go slower as they get further back), and one layer in front of the main layer, which moves faster than the main layer. Now, I want all the parallax effects that I am describing to happen when the camera moves left to right. What I don't want to happen, is any parallax effect to happen when the camera moves up and down. I want all of the layers to move up and down the same exact difference....
  Does that make more sense? I know I can create a script that does this, using an orthographic camera. 1) I am not sure of the performace hit this will take. 2) that seems like a more complicated approach.
  destructivArts Jonesy19 · Dec 22, 2016 at 08:38 PM 0
  What is the reason you want to use a perspective camera? I'd honestly do this with an orthographic camera, unless there's some effect you really want to have be in perspective.
  All you'd have to do to get parallaxing with a perspective camera is move the layers backward or forward in space. The perspectival nature of the camera will take care of the rest. Unfortunately, this comes with the added effect of working both horizontally and vertically. You could probably write some script to account for, and negate the visual effects of vertical camera movement, but this seems like an overly complex solution to your problem ( something along the lines of this ).
  However, the solution when using an orthographic camera is simply:
  transform.Translate ( cameraPositionChange.x * layerNumber, 0, 0 );
  Jonesy19 destructivArts · Dec 22, 2016 at 08:33 PM 0
  I actually just tested it and the orthographic scripts seem to hurt performance greatly, dropping FPS from 60 to nearly 30 when I move the camera. If I use a plain old perspective camera, the performance is hardly dropped when the camera moves.
  destructivArts Jonesy19 · Dec 22, 2016 at 08:39 PM 0
  Can you post the script you're using? This doesn't seem like something that should be performance intensive.