# How to align the corner of the camera with x= 0, y=0?

I need put Main Camera's bottom left corner at starting position 0, 0 (x, y) so all of its coordinates will be positive coordinates. I thought to put the pivot at the bottom left corner but I don't know if it is possible. I thought to adjust it manually, but it displays non-positive, non-integers. I chose the aspect ratio 16:9 but if I choose the 4:3 proportions, it becomes right: So, what is the best way to align/put the camera at position 0, 0 at bottom left corner?

If you want the camera to be at 0,0, you set its position to be 0,0. If you want to align the bottom left corner of the camera with 0,0, you need a little math.

It's not required to be an integer coordinate. It can easily be a decimal, depending on the field of view or the size of the projection, and the aspect ratio of the view. For your first image, using 16:9 aspect ratio, the x value would indeed be 8.88 and the y value would be 5.0. With a orthographic size of 5, and an aspect ratio of 16:9. Since the Y dimension is smaller, it'll always equal the orthographic size. The X value is calculated using the aspect ratio:

X=(16/9)*5 = 8.88
Y=5


Ideally, you'd calculate this in a script that automatically positions the camera. in the Start() method.

I suspect you're trying to use Unity in a way that might be standard with other engines, which is why you're finding this to be strange or difficult. Consider your approach and how it fits with how Unity is typically used.

The position shown there is the position of the pivot, which is, as you can see in the image, where the camera's gizmos are - in your case the "scale" gizmos which come out of the camera itself. not where your circle is.

The reason you are seeing these numbers is because of the camera's "size" parameter. This parameter (used for orthogonal cameras) says how many unity units will be from the middle of the screen to the top of the screen (and of course from the middle to the bottom). In your first image, the size is set to 5. Notice how there are five horizontal lines between the y = 0 horizontal line and the camera object. This is also why the camera's y position is 5. You aligned the bottom edge with y = 0, and the screen middle is 5 units above that, therefore it's at y = 5. The reason it's 5.01 and not 5 exactly, is because you didn't align it 100% correctly, the corner you circled is actually at (0, 0.01).

On your second image, the size parameter is set to 6. You aligned the bottom edge with the y = 0 horizontal line, meaning the screen's middle (and thus position) will be at y = 6.

The reason the first image doesn't translate to a clean integer is because of the aspect ratio. 16/9 = X/Y, here you know that the middle of the screen is (in the first case) 5 units above the y = 0 horizontal line (because of the size parameter). 16/9 = X/5 => solve for X => X = 8.88888...

In the second case though, you selected 6 as your camera's size, and so 4/3 = X/Y => 4/3 = X/6 => solve for X => X = 8. That's why it's a clean integer.

In Unity, by default, the constant axis for orthogonal cameras is the vertical axis. This means that if you change the aspect ratio, the width of your camera's view will change, but the height will remain constant. Knowing this, you can do what you want to. It will however require a small script. You can technically stick this on any GameObject, but you may as well stick it in a script on your camera.

void Start(){
float aspectRatio = Camera.main.aspect; //(width divided by height)
float camSize = Camera.main.orthographicSize; //The size value mentioned earlier
float correctPositionX = aspectRatio * camSize;
Camera.main.transform.position = new Vector3(correctPositionX, camSize, 0);
}

• Nice answer with the included code. +1 – MichaelHouse Mar 22 '16 at 22:41