Predefined AI Pathfinding

Hello All!

I am currently building an Vehicle AI system for my project and am currently stuck on one little thing. I have used the “Find Path To Location Synchronously” node to get an Array of locations to move to. Its all good at this point however, using a For Each Loop, it will only move to the last Location in the array. How can I make it go though each one individually then move to the next one.

Thanks for any help!

Not sure which built-in MoveTo node you’re using, but anyway they just set the AI’s target, and the AI will take over and navigate until it gets there. So if you call it in a loop, all you’re doing is overwriting the target each time, so you end up with the last one in the list. If you want to apply them sequentially, you’d need to bind an event to ReceiveMoveCompleted to start the next movement command.

Do you have a reason for wanting to break up the path like this anyway? The path points are just a series of straight line segments along the nav mesh, if you just pass your OwnerLocation directly to a single call to one of the MoveTo nodes then it will follow each segment in sequence until it gets to the end.