IT lexicon › Programming › Navmesh carving

Navmesh carving

Programming På svenska → Updated: 2026-10-27

Cutting a hole in the navigation mesh at runtime wherever a moving obstacle sits, so pathfinding routes around it instead of straight into it.

A navmesh is normally baked once from static geometry. Then someone tips a car across the road, and the mesh still insists you can walk there. Local avoidance handles small obstacles, but a barricade blocking a whole corridor has to go into the graph itself — otherwise agents just stand there pushing against it.

Carving fixes this by rebuilding only the part of the mesh the obstacle covers. Recast/Detour does it with its tile cache: the mesh is split into tiles and only the ones under the obstacle are regenerated. Unity exposes the same idea as a checkbox on NavMeshObstacle. It is not cheap, so the usual rule is to wait until the obstacle has stopped moving before carving — something that is constantly on the move should be avoided locally, not cut out every frame.

← Back to the lexicon