How do I keep an Ortho camera in a specific range when the ortho changes?

I have an Othrographic camera which is set to something like 260. As the user gestures ( this is on the iPhone ) the ortho size of the camera changes to provide a zoom in/zoom out affect. Not only can the user zoom in and out but they can also move the camera around ( like when zoomed in for instance ). What I am trying to do is not all the camera to move when at the max ortho ( 260 ) but as they zoom in, the user can move the camera but only within the bounds of the world provided.

In thinking about this, I really couldn't come up with a way seeing how the rect of the camera is always 0,0,1,1.

I am hoping someone can provide some insight! Thanks in advance.

you can use normal cameras and move them to zoom in and out. if you want to have something always in your view, you can use the OnBecameInvisible function and move back the camera to it's previous position. but if you want to have some points always in view you can check their screen space position.

Similar to what Ashkan suggested you can use Camera.ScreenToWorldPoint to test that your screen corners would be within your viewable world space when the user attempts to move the camera.

This means you have to somehow define the bounds of your world, whether by finding the min and max location of all objects in your scene or by manually storing them.

Personally I would manually create an invisible box in each scene that encompasses the viewable world space and test against it.

Can you give more info on how the camera movement is (FPS, Free form, etc)? I assume you want the camera to always look at the center of the world and when the user moves left of right the camera would rotate around the world y-axis. is that rite?

Also you dont need to change the Ortho size to zoom in and out..