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