Following a path

A path is a sequence of points in the game, connecting a point, A, to another point, B. There are many ways to build a path. Usually, a path is automatically generated by other game systems, such as pathfinding (see the next chapter); however, in our example, we, use a very basic system: we will construct the path by hand by using waypoints. We will write a script called Path.cs and store all the waypoint positions in a Vector3 array. Then, from the editor, we will enter those positions manually. It's a bit of a tedious process right now, but we don't want to make things too complicated. Fortunately, since the number of waypoints that we are creating here is not that substantial, the operation should not take too much time: ...

Get Unity Artificial Intelligence Programming - Fourth 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.