Rotate camera 360 degrees?

Hi,

In my game, you should be able to look around 360 degrees. Now this seems to be a bit of a problem, because Unity won't let me change the camera's Upvector. I tried this for my player:

`

transform.Translate(new Vector3(Input.GetAxis("Horizontal") * Time.deltaTime * 5, 0, Input.GetAxis("Vertical") * Time.deltaTime * 5));

transform.eulerAngles += new Vector3(0, Input.GetAxis("Mouse X") * Time.deltaTime * 500, 0);

transform.LookAt(transform.position + transform.forward, transform.up);

`

Aand then this for my camera:

`

transform.eulerAngles = new Vector3(transform.eulerAngles.x, target.transform.eulerAngles.y, target.transform.eulerAngles.z);

transform.eulerAngles += new Vector3(-Input.GetAxis("Mouse Y") * Time.deltaTime * 500, 0, 0);

transform.LookAt(transform.position + transform.forward, transform.up);

`

But, when my player is standing on the ceiling or some other place where he's turned around, the camera completely freaks out. So I tried this for my player:

`

transform.rotation *= Quaternion.Euler(new Vector3(0, Input.GetAxis("Mouse X") * Time.deltaTime * 500, 0));

`

And this for my camera:

`

transform.rotation *= Quaternion.Euler(new Vector3(-Input.GetAxis("Mouse Y") * Time.deltaTime * 500, Input.GetAxis("Mouse X") * Time.deltaTime * 500, 0));

`

This is actually a lot better, but not perfect. I can now turn left and right, up and down correctly, even if my character and thus the camera is upside down. But when I'm watching upward and then try to look left or right, my camera acts as if it is falling over. Now I know this is happening because of the axis over which the camera rotates, but how can I fix it?

I though you would get an error on this one: "transform.eulerAngles += ", because transform.eulerAngles returns a copy euler angles, so it doesn't get set back. Can you try this:

Vector3 rot = transoform.eulerAngles;
rot += ...
transform.eulerAngles = rot;

Why do you need to do this:

transform.LookAt(transform.position + transform.forward, transform.up);

I don't see how it changes your transform.