Generating the navigation mesh
The terrain is bumpy and features several hills, mountains, dips, and inclines. For an NPC character to navigate this terrain successfully, there are many complexities involved. For example, an NPC cannot necessarily travel in a straight line from point A to point B because doing so would cause the NPC to pass through solid objects and over terrain that should be impassable. The NPC needs to maneuver intelligently around, under, and over appropriate parts of the terrain. This illusion of intelligence is essential to create believable characters that inhabit a world. The computational processes involved in calculating a suitable path for an NPC is called pathfinding, and the method of making the character travel the calculated route is called navigation. Unity comes with built-in pathfinding and navigation features, making it easy for NPCs to calculate and travel paths.
To prepare our characters for navigation, a Navigation Mesh must be generated. This...