Help with clamping down camera.

How do I limit the up and down motion of a camera that uses game object.rotate ?

I tried using Mathf.clamp. Which either did nothing or made the camera spin uncontrollably.

We need more info. how is your camera moving? what exactly are you trying to accomplish(Why do you need the camera clamped)…

the camera moves using gameObject.rotate, and I’m trying to keep the camera from turning a full 360 along the X-axis.

Also I played around with the Mathf.clamp a little more and now the camera is locked to the floor.

I gave up on the Mathf.clamp. I’m using if checks instead. my code looks like this:

		if (cameraPivot.rotation.x > .4  camRotation.y > 0)
		{
			
		}
		else if(cameraPivot.rotation.x < -.4  camRotation.y < 0)
		{
			
		}
		else
		{
			cameraPivot.Rotate( camRotation.y, 0, 0 );
		}

This seems to work fine.