limit vertical camera rotation
can you please help me make a limit to my vertical camera rotation heres the code (sorry for bad english): using System.Collections; using System.Collections.Generic; using UnityEngine;
[RequireComponent(typeof(PlayerMoto))] public class PlayerController : MonoBehaviour {
public float speed = 5, sensetivity;
 private PlayerMoto motor;
 public GameObject hands;
 public camera cam;
 // Start is called before the first frame update
 void Start()
 {
     motor = GetComponent<PlayerMoto>();
     cam = GetComponent<camera>();
 }
 // Update is called once per frame
 void Update()
 {
     //cam.transform.localEulerAngles = new Vector3(cam.transform.localEulerAngles.x, 0, 0);
     float _xmove = Input.GetAxis("Horizontal");
     float _zmove = Input.GetAxis("Vertical");
         
     Vector3 _moveHorizontal = transform.right * _xmove;
     Vector3 _movVertical = transform.forward * _zmove;
     Vector3 _velocity = (_moveHorizontal + _movVertical) * speed;
     motor.Move(_velocity);
     float _yRot = Input.GetAxis("Mouse X");
     Vector3 _rotation = new Vector3(0f, _yRot, 0f) * sensetivity;
     motor.Rotate(_rotation);
     float _xRot = Input.GetAxis("Mouse Y");
     Vector3 _cameraRotation = new Vector3(_xRot, 0f, 0f) * sensetivity;
     motor.RotateCamera(_cameraRotation);
    
     if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.W)) {
         for (; speed <= 15; speed++)
         {
             speed = 15;
         }
     }
     else
     {
         speed = 10;
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to make an object go the direction it is facing? 0 Answers
How do I make a scrollbar for the camera? 0 Answers
Top Down Camera View Problem 1 Answer
What this error? 0 Answers
"Lookat" only working in one case 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                