Navmeshing and AI — Making the NPCs Move!

Jack Leavey
Aug 7, 2022

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.

Different areas are set to walkable or not walkable, depending on what we want the AI to do.

This will set the basic navigational data to feed to the AI for pathfinding!

--

--

Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!