I have this object who walks forward, when it gets to a certain x position it should stop, turn 1980 degrees and walk back, then when it gets to the position it started at it turns 180 degrees and walk forward again.
this is how i am trying to get him to walk and turn
public float Speed = 1f;
public float TurnSpeed = 1f;
void Start () {
transform.position = new Vector3(-10, 0, -79);
}
void Update () {
transform.Translate(new Vector3(0, 0, 1) * Speed * Time.deltaTime);
if (transform.position.x < -1)
{
transform.Translate(new Vector3(0, 0, 0));
transform.Rotate(0, 180 * Time.deltaTime, 0);
}
}
he will keep moving and not stop not sure why any help?