The Invisible Map Under an NPC’s Feet

By QuizThicket Editorial•Published December 3, 2026•6 min read
The Invisible Map Under an NPC’s Feet

An NPC can see a doorway in the rendered image and still have no idea that it is a doorway. To navigation code, beautiful stone, painted trim, and a welcome mat are not instructions. The character needs a separate representation of where its body may stand and how those places connect. In many games, that representation is a navigation mesh.

A game level overlaid with connected navigation-mesh polygons
A game level overlaid with connected navigation-mesh polygons

The level becomes polygons

A navmesh is a surface built over walkable parts of a scene. Unity's navigation documentation describes connected convex polygons: inside a convex polygon, a route between two points is unobstructed by the polygon's own boundary, and neighbor information links the surface into a searchable network.

Building, or "baking," the mesh examines geometry using agent rules. Maximum slope rejects a roof. Step height permits a curb but rejects a wall. Agent radius erodes space around obstacles so a route fits the character. Height clearance removes low passages.

The result is intentionally less detailed than the rendered floor. A tiled corridor may become a few large polygons. That simplification makes global searches practical and gives designers a surface they can inspect.

A path is a corridor, not footsteps

When asked to reach a destination, a system first maps the start and goal to the mesh. It searches neighboring polygons—Unity uses A*—and returns a corridor through the network. The route can then be reduced to corners that the agent steers toward.

That solves "which connected region leads there?" It does not solve the performance. Locomotion chooses speed and acceleration. Animation selects starts, stops, turns, and gait. Local avoidance handles nearby agents. Physics prevents penetration. Gameplay decides whether the NPC may open the door.

Confusing those layers creates familiar failures. An NPC may have a valid route but rotate in place because animation cannot make the corner. It may slide sideways because steering and root motion disagree. It may stop at an unlocked door because pathfinding reached a polygon while interaction logic never triggered.

Agent size changes the map

The phrase "the navmesh" can mislead. A small creature can use a vent that a broad character cannot. A wheeled robot may reject stairs a person can climb. Games can bake separate meshes, use different agent settings, or annotate costs and permissions.

Costs let the search prefer without absolutely forbidding. A road might be cheap, mud expensive, and shallow water acceptable only when the detour is long. The shortest geometric route is not always the most believable route.

Designers must resist using cost as a cure for everything. If agents repeatedly choose a dangerous shortcut, the problem may be missing gameplay knowledge rather than an imperfect number. A mesh knows space and configured costs; it does not understand that a visible bridge is about to collapse unless another system tells it.

Moving obstacles need two scales of response

A baked surface is easiest when walls do not move. Games do. Doors close, crates shift, vehicles stop, and crowds gather.

Local avoidance handles immediate motion by adjusting velocity around nearby agents or obstacles. It is responsive and relatively cheap, but it does not reason far ahead. Unity's documentation notes that a local method can fail when an obstacle fully blocks a path or forms a trap.

For a stationary object that truly changes connectivity, a system can carve a hole or rebuild affected navigation data, then request a new global path. Unity's NavMesh Obstacle guidance distinguishes a moving obstruction, handled with avoidance, from a stationary carved obstacle that can cause agents to plan another route. Recalculation has a cost and may not become available until a later update.

A door illustrates the choice. Treat every swinging door as a constantly moving carved hole and routes may churn. Ignore a locked door and agents queue against it forever. A robust design changes navigation state when the door meaningfully becomes open, closed, or reserved.

Off-mesh links describe special verbs

Some valid routes are not continuous walking surfaces. A character may jump a gap, climb a ladder, vault a rail, drop from a ledge, ride an elevator, or squeeze through a hatch. A link connects two points or regions and says, in effect, "an eligible agent can traverse from here to there using a special action."

The link still needs gameplay. At its entrance, the NPC may align to an animation, reserve the ladder, wait for the elevator, disable ordinary steering, execute the motion, and reattach to navigation at the other end. Bidirectionality and cost matter: dropping down may be allowed when climbing back is not.

Counterexample: a flying drone does not need every gap represented as a jump link. A three-dimensional volume, waypoint graph, or custom steering system may fit better. Navmeshes are excellent for movement constrained to surfaces, not a universal model for all motion.

Failure modes are often visible in the bake

Thin disconnected islands can strand agents. A tiny seam between modular floor pieces can break connectivity. Overgenerous step settings can bake a route over decorative geometry. A destination may sit just outside the surface, causing a character to approach but never arrive. Dynamic carving can split a narrow corridor beneath an agent.

Debug views expose polygons, boundaries, links, and paths. Teams test doors, moving platforms, partial paths, edge destinations, and crowds. They retest after art changes.

The mesh cannot make a character intelligent

A navmesh answers a constrained spatial question: where can this kind of body travel, and how are those places connected? It does not choose a sensible goal, notice a threat, coordinate a squad, or decide that walking through the royal banquet is socially inappropriate.

Those behaviors come from higher-level systems, and believable motion comes from lower-level ones. The mesh sits between them, quietly translating intention into geography. When it works, the NPC crosses the room. When it fails, the invisible floor suddenly becomes the most noticeable object in the game.

Sources & Further Reading