# Isometric game camera limits

I'm trying to set the limits for the camera of an isometric game I'm trying to make. The problem I'm having right now is that my world objects are placed with 0 rotation made to fit on whole number coordinates on the world, but the camera is rotated 45 to get the classic "sim city" view.

The thing is that I'm checking the limits with a simple 3 component clamp on max and min 3D values, which means that the world "walls" are oblique to the camera view, i.e., the camera can move on a rhombus, not a straight rectangle... is there a way to be able to set up the limits so they work relative to the camera's rotation?

edit: I made this simple diagram:

the red square are the limits, they go from -10,-10 to 20,20 in (x,z), but the camera view is oblique, it looks at it diagonally, like a standard sims-like view. I need my world limits to be not the square that goes from -10,-10 to 20,20 in world coordinates, but the one that goes from -10,-10 to 20,20, in a 45 rotated world, so the camera behaves like this:

where the brown is the floor, and the red is the camera limits

is this clearer?

If the camera is rotated at n odd angle and shifting by transform throws it off, make it the child of an empty GameObject aligned to your constraining rectangle and use that as a handle to move it. You can also cheat the constraints by placing it in an offscreen volume and using collision detection to stop it from moving out of bounds if the constraints are an irregular shape. ;)

The way you move the camera are not supposed to be affected by the camera rotation, so the clamp approach should work keeping the camera on a squared limit. The unique difference is that your limit square is not the same as your stage, you need to offset it based on your camera angle and distance from the floor.

Lets say your objects are placed from 0,0 to 100,100. Your camera will be limited by (f.e.) 25,25 to 125,125. The 25 offset is just a guess, the value will depend on your camera's angle and floor distance.

you could use the camera's transform.

transform.position += transform.right * Time.deltaTime;

That would move it to its right based on it's rotation.

Can you draw a picture of what you're talking about and post it on imgur.com and paste a link. I would think you'd want the camera to only look at the rhombus, which it sounds like you have. I don't know what you mean by a 'straight rectangle'. Straight with respect to the forward direction of the camera? Wouldn't that allow you to view things that are out of bounds?