- Home /
Question by
programer717 · Apr 02, 2018 at 08:23 PM ·
c#camerarotationcamera rotate
maximum angle for camera
hi, i have been working on this forever and i could not figure out how to set a max angle this is what i have so far public float minrotation; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (transform.eulerAngles.x <= minrotation) { if (Input.GetKey ("w")) { transform.Rotate (-1, 0, 0); } } } }
this is one script, the next one is for looking in the opposite direction public float maxrotation; // Use this for initialization void Start () { }
// Update is called once per frame
void Update () {
if (transform.eulerAngles.x <= maxrotation) {
if (Input.GetKey ("s")) {
transform.Rotate (1, 0, 0);
}
}
}
}
i am trying to get the camera to be able to turn to somthing like 50 degrees and then turn to somthing like - 50 degrees, using W and S. Any ideas?
Comment
thanks to any one who answers please @programer717 so i am notified