top down 3d camera rotation question

How do you control the max amount of rotation of an object ? and / or How to you fix an 'axis' of rotation ?

Here is the example :

I have a camera looking down onto a scene, smoothly following the player. The camera is at a fixed position and rotates. How do I stop the camera rotating after a cetain amount of rotation and/or not rotate on a specifc axis. i.e I want 'north' to remain 'north' for the player and for the camera to no show too much of 'offmap'.

thanks for any help on this.

simply check the ammount of rotation of your camera and if it's larger or smaller than what you want clamp it to max or min value. your rotation is arrount the y axis i think. also you can use clamp method when you want to rotate your object and don't allow it to have a value larger/smaller than what you want. use Transform.rotate to rotate your camera. if you use other's scripts for camera movement still you can check for out of range values and change them in camera's lateUpdate function in a script.

You can place the camera behind the FPC and give it the same movement script (=same speed) as the FPC. This way the camera will continue to 'follow' your character, but without the rotation at all. Do make sure that speed is equal and that the direction they're looking at is the same.

If you want to be able to 'look around' you can give the camera the MouseLook script, and I'd think you'd want to combine that with a script that says:

when "jump" is pressed, go to rotation (0, 0, 0) //=looking forward again. (For now I got:

function Update () {

if (Input.GetButtonDown("Jump"));

Transform.rotation; x = 0;

Transform.rotation; y = 0;

Transform.rotation; z = 0;

}</p>

but I do get an error: "BCE0020: An instance of type 'UnityEngine.Transform' is required to access non static member 'rotation'." I know I have to add something in the first line here, still puzzling :P)

I just tried it while the camera was looking just a bit different then the FPS and it caused them to go different ways, because 'forward' meant something different to my camera then my FPS. I'm not sure this is what you want completely, but let me know what you think of this and we'll work something out here :)

(ps: not that good at scripting yet, so therefor not rightly posted here, maybe I'll have a shot at it later today and see if I can fix it)