Camera Inverted?

Hello, I’m currently learning JS (I was going to learn Boo but not enough resources to learn from.) And I’ve started to create my own “Mouse Look” script as I’m going to be creating a simple level editor however I can’t seem to make it as good as what the unity examples are, for example when you move you mouse in diagonally, the camera goes inverted and I have no idea on how to fix this?

This is my code:

	var horizontalSpeed : float = 2.0;
	var verticalSpeed : float = 2.0;
	function Update () {
		var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");
		var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
		transform.Rotate (v, h, 0);

Any help would be great! I’d also like to note is I’m using a PPC (Powerpc) Mac so I’m running 2.6.1f3

gee how helpful :stuck_out_tongue: how about an answer for this problem seems like a quite a common one.

Usually with mouse look you don’t want the camera to rotate past vertical, either up or down. The way you have this written there isn’t anything to stop the camera from flipping over upside down.