Following a path

Before diving into A*, which is a procedural approach to pathfinding, we'll implement a more rudimentary waypoint-based system. While more advanced techniques, such as the aforementioned A* method or Unity's NavMesh, will often be the preferred method for pathfinding, looking at a simpler, more pure version will help set the foundation for understanding more complex pathfinding approaches. Not only that, but there are many scenarios in which a waypoint-based system will be more than enough, and will allow more fine-tuned control over your AI agent's behavior.

In this example, we'll create a path, which is made up of individual waypoints. For our purposes, a waypoint is simply a point in space with an X, Y, and Z value; we ...

Get Unity 2017 Game AI Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.