Answers for "how to clamp transform.rotation"

C#
1

how to clamp transform.rotation

headRotation = Input.GetAxis("Mouse Y") * speed;
 transform.Rotate(0, 0, -headRotation, Space.Self);
 transform.eulerAngles.y = Mathf.Clamp(transform.eulerAngles.y, -90, 90);
Posted by: Guest on January-06-2020

C# Answers by Framework

Browse Popular Code Answers by Language