- Home /
How to make a square camera in 2D game?
I have problem. I want to do a square camera for my pixelart game and i can't do that. I don't know how to do it, someone help?
Answer by GlitchedVortex · Jan 22, 2018 at 08:52 PM
Don't know if you still need this, but I hope it helps any future users.
If you want to make your camera have a square view, you'll have to change its Viewport Rect component. The x, y, width, and height of the Camera's view are all set as values between 0 and 1. So, based on the dimensions of your camera, you can calculate how much to change the dimensions by to get a square view.
For instance, if your game has a resolution of 1024x768, you can realize that 768 is 3/4 of 1024. So, if you change the width dimension to .75, 1024 will become 768 and the view will be square. However, the view will now be off center. To fix this, change the x value to 0.125. Hope this helps!
Answer by · Aug 01, 2017 at 02:19 PM
I don't know what you mean when you say "Square Camera".
If you want an orthographic camera just change the Projection on your main camera from Perspective to Orthographic.
If you want to force an square image you will need to change the Viewport Rect based on the screen resolution.