i see nothing wrong with the code. What is at fault?
float rotateY = 0;
rotateY += -Input.GetAxis(“Mouse Y”) * s.XSens * Time.deltaTime;
rotateY = Mathf.Clamp(rotateY, -90, 90);
transform.eulerAngles += new Vector3(rotateY, 0, 0);
i see nothing wrong with the code. What is at fault?
float rotateY = 0;
rotateY += -Input.GetAxis(“Mouse Y”) * s.XSens * Time.deltaTime;
rotateY = Mathf.Clamp(rotateY, -90, 90);
transform.eulerAngles += new Vector3(rotateY, 0, 0);
You probably wanted to do
transform.eulerAngles = new Vector3(rotateY, 0, 0);
instead of
transform.eulerAngles += new Vector3(rotateY, 0, 0);
Otherwise your Mathf.Clamp call will only limit the rate of change and hot the absolute angle, if that’s actually what you wanted to do. You haven’t mentioned what you want to do so we can not tell if your code is wrong.