Creating a path using multiple points

Hi,
I’m trying to make my AI walk along a series of points. This way I can be specific about the route the character takes. In this circumstance it’s a scripted walk through some trees so I’d rather him follow the correct path.

Using setdestination works fine but he slow’s down at every point. Can I pass a bunch of transform positions and then create a path for the character to walk doing that?

Right now I have a parent object called ‘Path1’ and inside there is a bunch of child objects that I want him to follow.

    IEnumerator Complete_Entire_Path(Transform _Parent_Path_Obj)
    {

        List<Transform> Walking_Points = new List<Transform>();
        Walking_Points.Clear();
        gameObject.GetComponent<AIPath>().slowdownDistance = 0;

        //get list of points
        foreach (Transform child in _Parent_Path_Obj)
        {
            Walking_Points.Add(child.transform);

        }
        var point = 0;
        while (point < Walking_Points.Count)
        {
            StartCoroutine(Move_To_Point(Walking_Points[point]));
            yield return new WaitForSecondsRealtime(0.1f);
            yield return new WaitUntil(() => ai.reachedEndOfPath && !ai.pathPending && seeker.IsDone());
            point++;

        }

  


        yield return new WaitForSecondsRealtime(1);


Thanks

Hi

You can configure the agent to not slow down when nearing the end of its path. Then if you change the destination once the agent gets close you will have essentially the behavior that you want. It will also be more performant as it avoids calculating a path longer than it needs to.

Hi, what is the best way to do this?
I can make the stopping distance 0 but the character kind of snaps when he reaches that position.
How can I smoothly make him move to the next point a frame or so before he reaches the point?