Hey,
Sorry for the probably easy fix question but how do you add restriction on how far a object can rotate?
My code is at follows, its simple cause this is the first time I’ve tried Unity but I do have experience using Java.
public class rotate : MonoBehaviour
{
public float speed = 0.01f;
void Update()
{
if (Input.GetKey(KeyCode.RightArrow))
{
transform.Rotate(0f,0f,speed*-1);
}
if (Input.GetKey(KeyCode.LeftArrow))
{
transform.Rotate(0f, 0f, speed);
}
}
}