Navmeshing and AI — Making the NPCs Move!
Navigation Meshes (Navmeshes) are tools that dictate what a character can move on, as well as the boundaries of their movement. This tool is used for any non-player characters (NPCs).
In order to get an NPC to follow movement commands from a NavMeshAgent component, first we need to create the actual playable field for the AI.
I created a small building and placed several waypoints around, shown here as purple cylinders. To show off this setup, the roof has been temporarily removed.
We can do this by going to Window>AI>Navigation.
Opening up the Navigation window, in the Object tab, we select all of our walkable floors and check the “Navigation Static” box, and ensure that the “Navigation Area” is set to Walkable.
This will set the basic navigational data to feed to the AI for pathfinding!