I have a game level that is just a plane with the camera above the player looking down. The player can go to the edge of the level but I don’t want the camera seeing past the edge. If you have every played miniGORE for the iPhone, I’m trying to set the camera up like that.
What is the best way of doing this?
The attached photo shows the camera not moving past a certain point and the character not moving past a “box collider”.
The min and max positions would be the borders of your level, for example in my Breakout clone game, I figured out the borders by moving the paddle as far as I want to go to the left:
You can see in the Transform “x” position I know I’m going to clamp my paddle from moving no further to the left @ -12, which will be the minimum amount in the clamp, then you just move your object all the way to the right you want to go, and that will be the maximum value in the clamp. Just use the positions in the Transform and you will be able to find your limits. Oh, and yes you would use this script on your camera.