12

Navigation Meshes and Agents

Unity provides navigation meshes (NavMeshes) and artificial intelligence (AI) agents that can plan pathways and move objects along those calculated paths. Pathfinding is a classic AI task, and Unity has provided game developers with fast and efficient pathfinding components that work out of the box.

Having objects that can automatically plot and follow paths from their current location to the desired destination point (or reoriented to a moving target object) provides the components for many different kinds of interactive game characters and mechanics. For example, we can create point-and-click games by clicking on a location or object toward which we wish one or more characters to travel. Or, we can have enemies ...

Get Unity Cookbook - Fifth 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.