Whats the purpose for writing what to clamp after Mathf.Clamp ???

trying to limit camera x rotation with a clamp.

why do you have to tell it, for example, to clamp transform.position.x when you already made the clamp equal to transform.position?

also, why isnt mine working?

transform.rotation = Mathf.Clamp (transform.rotation.x, -90, 90);

UPDATE:::

For some reason this is now moving y camera in horizontal circles? and shaky?

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {

	public int Sensitivity;
	private float MouseYSet;

	void Start () {
		MouseYSet = Input.mousePosition.y;
	}

	void Update () {
		transform.rotation = Quaternion.Euler (Mathf.Clamp (transform.rotation.x, -90, 90), 0, 0);

		if (Input.mousePosition.y > MouseYSet)
		{
			transform.Rotate (new Vector3 (-1, 0, 0) * (Input.mousePosition.y - MouseYSet) * Sensitivity * 10 * Time.deltaTime);
			MouseYSet = Input.mousePosition.y;
		}
		if (Input.mousePosition.y < MouseYSet)
		{
			transform.Rotate (new Vector3 (-1, 0, 0) * (Input.mousePosition.y - MouseYSet) * Sensitivity * 10 * Time.deltaTime);
			MouseYSet = Input.mousePosition.y;
		}
	}
}

Clamp is regular math, like +. A good solid math function takes inputs, doesn’t change them, computes an answer, and you get the answer with =.

Like a=Mathf.Sqrt(b);. Makes perfect sense that b is unchanged, and a gets the square root. Even a=b+1; is this way. If you want to change a, you need the a in both places: a=a+1;.

It’s good for things like float goodx=Mathf.Clamp(x,-2,2);. Where you want to keep x, but also have an in-bounds copy of it, made from clamp. Another way of looking at it is that Clamp doesn’t mean “clamp myself.” It means “find a clamped version of this guy, now who wants it?”

It’s a little confusing, since some functions change you, and some do math with you. V2=V1.normalized doesn’t change V1, but V1.Normalize() does.