Navigation Mesh

From Valve Developer Community
< Dota 2 Workshop Tools‎ | Level Design
Revision as of 10:27, 19 August 2014 by F1rstDan (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
简体中文
A navigation mesh needs to be present to allow units to move around in a new map. This should be generated every time there are changes to the map that would change navigation data. The navigation mesh controls all movement in Dota 2 and defines where units can or cannot move to.

The navigation mesh in Dota 2 is a 2D plane generated from the top down. This implies certain limitations such as overhangs and bridges that cannot be traversed beneath. The mesh consists of a grid of 64x64 units that encompass the entire map. In order to generate a navigation mesh a material must be present on a surface in a custom map that is walkable. All of the "blend" materials have this attribute. Custom materials should specify a "User Material Attribute" of "dota.nav.walkable 1" to allow the navigation mesh to generate on top of it.

Note:Props such as rocks or signs do not have collision in Dota. Most of the time this is preferred; however, if a rock of a certain size is placed, it may be desirable to clip that space off to prevent units from moving through it.

Hammer Navigation Preview

Navmesh button preview.png
Preview of the navigation grid inside of Hammer.

It is possible to preview the navigation mesh before seeing it in game. This can be accomplished via the navigation preview button in the top tool bar. This will dynamically draw the navigation grid on any valid surface. In game it is possible to preview the grid by typing "dota_gridnav_show 1" in the console.

Preview Color Definitions

  • Green: Open - Any unit can move here.
  • Red: Blocked - Cannot move here. Large height deltas between grid squares or clip meshes can cause an area to be blocked. Flying units can still pass through these locations.
  • Purple (Hammer Only): Blocked Dynamic - ent_dota_tree will show up as these inside of Hammer.
  • Blue: Hero Clip - Hero units cannot enter this space.
  • Yellow: Creature Clip - Creature AI controlled units cannot enter this space. This does not apply to AI controlled heroes as those would follow the hero clip rules.

Creating a Navigation Mesh

The navigation mesh is created automatically when the map is compiled.

  • Click the Run Map button on the upper tool bar or press F9
  • Build Physics must be checked
  • Build Grid Nav must be checked

Clipping

Example of clipping an area off from units.

Unlike other Source games where clipping can affect the collision of a model against a surface, in Dota 2 a clip mesh only affects the navigation grid square it contacts. Texturing a mesh in one of the clip textures will cause it to influence navigation grid it contacts. Clip materials applied to meshes are invisible and will not render.

Once a navigation mesh has been generated for a map it will be made up of a large grid of squares. Each one of these squares contains clipping data for any unit trying to pass through that location. Player controlled heroes are still units.

Types of Clip Materials

Materials can be applied to mesh surfaces to provide data to the navigation mesh when compiled to affect navigation through the world. To learn about mesh construction and material application to mesh faces, see the basic construction tutorials.


Below are the types of clip materials that can be applied to meshes:

Skip
Used to mark an area blocked for walking units. Flying units can still move through this space as if it were unblocked to them.
Clip
The most basic variation that units can traverse on top of but are treated similar to terrain in that ramps, stairs, and other shapes can be created and the navigation grid will still generate on top of them. A bridge over a river is a good usage case of a clip brush.
Hero Clip
Heroes cannot traverse this space. Affects both walking and flying units.
Creature Clip
Similar to Player Clip but blocks AI controlled units instead.


Tip:As the navigation grid is made up of 64x64 unit squares it is often easier to create a small 32x32 column in Hammer, place it in the middle of the 64x64 grid square and duplicate using arrow keys rather than encompassing an area with a large single brush. This is useful for very accurate clip placements but not recommended for large swaths of area to mark off.

Console Commands

dota_gridnav_show
  • "0" - Off
  • "1" - Basic Clip
  • "2" - Hero Clip
  • "3" - Creature Clip