-
declare a variable
float heading;
-
adjust it when conditions warrant:
if (conditionToTurn)
{
heading += AdjustmentWhateverYouWant;
}
- clamp it
heading = Mathf.Clamp( heading, minimum, maximum);
- drive the rotation to the camera transform:
cameraTransform.localRotation = Quaterion.Euler( 0, heading, 0);