Ortho camera viewport setup?

Everything I've found on this seems either way more complicated than what I am looking for, or specifically for a scrolling/moving camera, which also isn't what I need.

I am trying to set up a plane and camera. I want the viewport of the camera to give me a 960x640 view.

Right now I have a plane GameObject set up like this: Pos: 480, 0, 320 Rot: 0, 0, 0 Scale: 96, 0, 64

and a MainCamera set up like this: Pos: 480, 320, 320 Rot: 90, 0, 0 Scale: 1, 1, 1 Projection: Orthographic Size: 572 Normalized View Port Rect: X=0, Y=0, W=1, H=1

What I would like to have is a view of the plane, with the camera rendering a 960x640 view. I'd like to be able to place objects in this view at a 1:1 pixel ratio. It would be great if I could have it set up so that if I instantiate an object, I can place it at a position using the viewport's screen coordinates (I'd prefer bottom left being (0,0), but anything logical would work, really.

What settings should I be looking at to set the plane object and the camera object up to do this?

Many thanks in advance (and if anyone has pointers to any basic tutorials on things similar to this, I'd love to see them).

--Gray

This may help somewhat: http://unity3d.com/support/documentation/ScriptReference/Camera.ViewportToScreenPoint.html

also http://unity3d.com/support/documentation/ScriptReference/Camera-orthographicSize.html

Well, the orthographic camera's aspect ratio is adjusted by the actual resolution. I'm a bit confused, do you want to work on the x-z-plane or why does your camera looks "downwards"? ... Anyway, just follow these steps:

  1. Set your project resolution to 960x640 in the project settings.
  2. Set your camera's orthographicSize to 320 (half height)
  3. If you want to work on the x-z-plane with the origin (0,y,0) at the bottom left just move your camera and your plane to 480,y,320
  4. Make sure the plane have a lower y value than the camera.
  5. Actually that's it. In the editor you should select the project resolution (affects the aspect ratio) in the drop-down-field at the top left of your game-view.

If you set it up that way x==0 z==0 is at the bottom left of the screen and x==960 z==640 is at the top right.

ps. The plane (unity default plane) is set up like you've done above but y-scale = 1. localScale == 96, 1, 64 (don't set a scale to 0 if it doesn't matter keep the 1 ;))

You could also parent your camera to the plane, that way the camera sits at 0,dist,0 where dist is the distance from your plane which should be positive.

As for why the camera looks "downwards"... I'm really new to this, and ...well... it just ended up that way, heh. I'm not married to that, but it seems kind of a pain to change everything.

I went back and fiddled about, using your advice above, and even went so far as to create a brand new scene, with a camera, lightsource, and newly-created plane. I have a simple script attached to the plane that when you click on the plane, it uses Debug.Log to spit out the coords that you clicked on.

Using this, what seems to be happening both in the new scene, and in the old scene is that while I would expect clicking in the bottom left of the screen would generate something like (0, 0, 0), while clicking on the top right would produce (960, 640, 0). What I am actually seeing is that the bottom left does give (0, 0, 0), but the top right is giving (1116.0, 744.5, 0). And I really am at my wits end to figure out why.

I also have some "tiles" that are placed in the scene. These tiles are simply Cube GameObjects, Scaled (100, 1, 100) with a 100x100 texture on them. The idea is to build a set of these on the right side, the user clicks one, then clicks somewhere in the viewport and if there isn't already a tile there, it moves it there. I can place them along the right side fine, but they all seem to be 115x115 now, which I am sure is another symptom of whatever I am seeing/not understanding, above.

--Gray