public float speed = 3f;
public float resetTimer = 1f;
public float maxRot = 0f;
Vector3 direction = Vector3.forward;
public void Start()
{
}
public void Update()
{
float timer = Random.Range(0, 3000);
Vector3 drift = transform.position;
drift += direction * speed * Time.deltaTime;
transform.position = drift;
transform.Rotate(maxRot, 0, 0);
if (timer > 0)
{
timer -= Time.deltaTime;
}
else
{
Debug.Log("turn");
timer = resetTimer;
if (direction == Vector3.forward)
{
direction = Vector3.back;
}
else
{
direction = Vector3.forward;
}
}
}
}