Not following exact path

I’m struggling with the exact issue on this Unity Answers post http://answers.unity3d.com/questions/262156/confusion-with-aron-granbergs-a-pathfinding.html

The odd thing is, on one of my actors I can decrease the next waypoint distance to 0.1 and it works as intended. On the others, it will not move unless above 4.

Hi

The way to make it follow the path EXACTLY is to interpolate along it.

float distance = 0;
float speed = 1;

public void Update () {
    List<Vector3> points = ...;
    distance += Time.deltaTime * speed;
    float accum = 0;
    for ( int i = 0; i < points.Count-1; i++ ) {
        float d = (points[i+1] - points[i]).magnitude;
        if ( accum + d >= distance ) {
            transform.position = Vector3.Lerp ( points[i], points[i+1], (distance - accum)/d);
            return;
        }
    }
    // We have reached the end of the path if we get to this point
}

The above code will move with a speed of [speed] along the specified list of points until it reaches the end of it.

Thanks for the help! Any tips for making it move smoothly along the path? Right now it slows to a stop on each waypoint.

Oh. Forgot one thing. As the last statement in the for loop, do:

accum += d;

Perfect.