What is the Navigation (NavMesh) System in Unity 2021?

Credit: Youtube — Code Monkey — How to use Unity NavMesh Pathfinding! (Unity Tutorial) https://www.youtube.com/watch?v=atCOd4o7tG4

I’ve tried to create an overview reference for the Unity Navigation System or “NavMesh System” as it is sometimes commonly called.

According to Unity:

“The Navigation System allows you to create characters which can navigate the game world. It gives your characters the ability to understand that they need to take stairs to reach second floor, or to jump to get over a ditch.”

Essentially, the Navigation System is a performant means to give player characters and AI characters or NPCs a way to move around the game environment in a realistic manner.

How does an NPC know that slope is too steep to traverse?
How does the player’s character know that it can jump off that ledge or not?

*How* does the chicken cross the road?

Unity did the legwork and exposed this system to developers based on four main components:

NavMesh
“NavMesh (short for Navigation Mesh) is a data structure which describes the walkable surfaces of the game world and allows to find path from one walkable location to another in the game world.

The data structure is built, or baked, automatically from your level geometry.”

NavMesh Agent
“NavMesh Agent component help you to create characters which avoid each other while moving towards their goal.

Agents reason about the game world using the NavMesh and they know how to avoid each other as well as moving obstacles.”

“NavMeshAgent components help you to create characters which avoid each other while moving towards their goal.

Agents reason about the game world using the NavMesh and they know how to avoid each other as well as other moving obstacles.

Pathfinding and spatial reasoning are handled using the scripting API of the NavMesh Agent.”

Off-Mesh Link
“Off-Mesh Link component allows you to incorporate navigation shortcuts which cannot be represented using a walkable surface.

For example, jumping over a ditch or a fence, or opening a door before walking through it, can be all described as Off-mesh links.”

“OffMeshLink component allows you to incorporate navigation shortcuts which cannot be represented using a walkable surface.

For example, jumping over a ditch or a fence, or opening a door before walking through it, can all be described as Off-mesh links.”

NavMesh Obstacle

“NavMesh Obstacle component allows you to describe moving obstacles the agents should avoid while navigating the world.

A barrel or a crate controlled by the physics system is a good example of an obstacle.

While the obstacle is moving the agents do their best to avoid it, but once the obstacle becomes stationary it will carve a hole in the navmesh so that the agents can change their paths to steer around it, or if the stationary obstacle is blocking the path way, the agents can find a different route.”

“The Nav Mesh Obstacle component allows you to describe moving obstacles that Nav Mesh Agents should avoid while navigating the world (for example, barrels or crates controlled by the physics system).

While the obstacle is moving, the Nav Mesh Agents do their best to avoid it.

When the obstacle is stationary, it carves a hole in the NavMesh.

Nav Mesh Agents then change their paths to steer around it, or find a different route if the obstacle causes the pathway to be completely blocked.”

This article dives into the foundational concepts of what the problems are for AI navigation and how the Navigation System solves those problems.

In future articles we’ll put this knowledge of the Navigation System to practical use.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store