Dear Forum,
Question: What’s the best approach to have a game object rotate to a certain direction and once it hits a position along the rotation line it rotates to the opposite direction. Here’s some unfinished code of what I’m attempting to achieve.
if (transform.eulerAngles.z >= 10 transform.eulerAngles.z <= 14) // rotate right
transform.Rotate(-Vector3.forward, Time.deltaTime * 10);
if (transform.eulerAngles.z >= 340 transform.eulerAngles.z <= 345 ) //rotate left
transform.Rotate(Vector3.forward, Time.deltaTime * 10);
Many Thanks in advance.