I want to make it to where destination is points[0]. if transform.position == points[1], then destination = points[2]. if the object is at the same position as destination, destination is set to the next point in the points array. How would i do this since the amount of points can varry?
int p = points.Length;
if (go && p > 2)
{
float step = speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, destination.position, step);
if (transform.position == destination.position)
{
//var cPoint = points[0];
destination = points[1];
}
}