- Home /
Camera setup question
Hello.
I'm trying to set up Unity for 2D+ development similar to how I set up OpenGL -- ortho camera and planes/rects with textures. Sounds easy enough.
I need a solution which guarantees that a bitmap that's (for example) 30x60 in Photoshop shows up EXACTLY as 30x60 within Unity screen space. How do I compute Camera parameters to ensure that result? There's probably some known formulaic approach, but I'm not sure how to apply it to the given parameters.
The Camera parameters I can play with appear to be "Scale" (which I left at 1,1,1) and "Size" (which I don't understand and the documentation doesn't explain very much). Through trial & error (try a number, run program, screen capture, measure, repeat) I've arrived at a "magic" value of 30 which seems close to correct, but I'd much prefer a more definitive approach.
Thanks, BT
Answer by Jeston · May 12, 2011 at 08:43 PM
- Orthographic size = Screen.Height/2
- Set camera.position to 0,0,0 or if you don't want the item.position(0,0,0) to be the upper left, then offset the camera.position by ( -w/2, -h/2, )
In my case that'd be 768/2 = 384. The number I've been using for Size is 30 and the larger Size gets, the smaller my object appears. Anything over around 150 and I can't see it at all.
Other parameters on my main camera are:
Position=Rotation=(0,0,0) Scale=(1,1,1) Clipping=1,1000 View Port Rect = XY(0,0), WH(1,1) Depth=-1
Parameters on my object are:
Position=(0,0,500) Rotation=(270,0,0) Scale=(1,1,1)
Thanks, BT
Your answer
Follow this Question
Related Questions
Finding the right ortho size to fill the screen with an object 1 Answer
Polygons clipping at edge of screen 1 Answer
2D Game. Screen, Camera and coordinates. 0 Answers
How to letterbox the screen and have pixel perfection in a 2d game 0 Answers
Top-Down 2D game:How to make the camera move on hitting the sides of the screen? 2 Answers