Table of Contents

Class NavigationMesh

A navigation mesh that defines traversable areas and obstacles.

Inheritance
NavigationMesh

A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces.

See Also

Properties

The minimum floor to ceiling height that will still allow the floor area to be considered walkable.

Note: While baking, this value will be rounded up to the nearest multiple of cell_height.

var agent_height : float = 1.5

Property Value

float
  • void set_agent_height(float value)
  • float get_agent_height

The minimum ledge height that is considered to still be traversable.

Note: While baking, this value will be rounded down to the nearest multiple of cell_height.

var agent_max_climb : float = 0.25

Property Value

float
  • void set_agent_max_climb(float value)
  • float get_agent_max_climb

The maximum slope that is considered walkable, in degrees.

var agent_max_slope : float = 45.0

Property Value

float
  • void set_agent_max_slope(float value)
  • float get_agent_max_slope

The distance to erode/shrink the walkable area of the heightfield away from obstructions.

Note: While baking, this value will be rounded up to the nearest multiple of cell_size.

var agent_radius : float = 0.5

Property Value

float
  • void set_agent_radius(float value)
  • float get_agent_radius

The size of the non-navigable border around the bake bounding area.

In conjunction with the filter_baking_aabb and a edge_max_error value at 1.0 or below the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by agent_radius.

Note: While baking and not zero, this value will be rounded up to the nearest multiple of cell_size.

var border_size : float = 0.0

Property Value

float
  • void set_border_size(float value)
  • float get_border_size

The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.

var cell_height : float = 0.25

Property Value

float
  • void set_cell_height(float value)
  • float get_cell_height

The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.

var cell_size : float = 0.25

Property Value

float
  • void set_cell_size(float value)
  • float get_cell_size

The sampling distance to use when generating the detail mesh, in cell unit.

var detail_sample_distance : float = 6.0

Property Value

float
  • void set_detail_sample_distance(float value)
  • float get_detail_sample_distance

The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.

var detail_sample_max_error : float = 1.0

Property Value

float
  • void set_detail_sample_max_error(float value)
  • float get_detail_sample_max_error

The maximum distance a simplified contour's border edges should deviate the original raw contour.

var edge_max_error : float = 1.3

Property Value

float
  • void set_edge_max_error(float value)
  • float get_edge_max_error

The maximum allowed length for contour edges along the border of the mesh. A value of 0.0 disables this feature.

Note: While baking, this value will be rounded up to the nearest multiple of cell_size.

var edge_max_length : float = 0.0

Property Value

float
  • void set_edge_max_length(float value)
  • float get_edge_max_length

If the baking AABB has a volume the navigation mesh baking will be restricted to its enclosing area.

var filter_baking_aabb : AABB = AABB(0, 0, 0, 0, 0, 0)

Property Value

AABB
  • void set_filter_baking_aabb(AABB value)
  • AABB get_filter_baking_aabb

The position offset applied to the filter_baking_aabb AABB.

var filter_baking_aabb_offset : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3
  • void set_filter_baking_aabb_offset(Vector3 value)
  • Vector3 get_filter_baking_aabb_offset

If true, marks spans that are ledges as non-walkable.

var filter_ledge_spans : bool = false

Property Value

bool
  • void set_filter_ledge_spans(bool value)
  • bool get_filter_ledge_spans

If true, marks non-walkable spans as walkable if their maximum is within agent_max_climb of a walkable neighbor.

var filter_low_hanging_obstacles : bool = false

Property Value

bool
  • void set_filter_low_hanging_obstacles(bool value)
  • bool get_filter_low_hanging_obstacles

If true, marks walkable spans as not walkable if the clearance above the span is less than agent_height.

var filter_walkable_low_height_spans : bool = false

Property Value

bool
  • void set_filter_walkable_low_height_spans(bool value)
  • bool get_filter_walkable_low_height_spans

The physics layers to scan for static colliders.

Only used when geometry_parsed_geometry_type is NavigationMesh.PARSED_GEOMETRY_STATIC_COLLIDERS or NavigationMesh.PARSED_GEOMETRY_BOTH.

var geometry_collision_mask : int = 4294967295

Property Value

int
  • void set_collision_mask(int value)
  • int get_collision_mask

Determines which type of nodes will be parsed as geometry. See ParsedGeometryType for possible values.

var geometry_parsed_geometry_type : int = 2

Property Value

int
  • void set_parsed_geometry_type(int value)
  • int get_parsed_geometry_type

The source of the geometry used when baking. See SourceGeometryMode for possible values.

var geometry_source_geometry_mode : int = 0

Property Value

int
  • void set_source_geometry_mode(int value)
  • int get_source_geometry_mode

The name of the group to scan for geometry.

Only used when geometry_source_geometry_mode is NavigationMesh.SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN or NavigationMesh.SOURCE_GEOMETRY_GROUPS_EXPLICIT.

var geometry_source_group_name : StringName = &"navigation_mesh_source_group"

Property Value

StringName

Any regions with a size smaller than this will be merged with larger regions if possible.

Note: This value will be squared to calculate the number of cells. For example, a value of 20 will set the number of cells to 400.

var region_merge_size : float = 20.0

Property Value

float
  • void set_region_merge_size(float value)
  • float get_region_merge_size

The minimum size of a region for it to be created.

Note: This value will be squared to calculate the minimum number of cells allowed to form isolated island areas. For example, a value of 8 will set the number of cells to 64.

var region_min_size : float = 2.0

Property Value

float
  • void set_region_min_size(float value)
  • float get_region_min_size

Partitioning algorithm for creating the navigation mesh polys. See SamplePartitionType for possible values.

var sample_partition_type : int = 0

Property Value

int
  • void set_sample_partition_type(int value)
  • int get_sample_partition_type

The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.

var vertices_per_polygon : float = 6.0

Property Value

float
  • void set_vertices_per_polygon(float value)
  • float get_vertices_per_polygon

Methods

Adds a polygon using the indices of the vertices you get when calling get_vertices.

void add_polygon(PackedInt32Array polygon)

Parameters

polygon PackedInt32Array

Clears the internal arrays for vertices and polygon indices.

void clear

Clears the array of polygons, but it doesn't clear the array of vertices.

void clear_polygons

Initializes the navigation mesh by setting the vertices and indices according to a Mesh.

Note: The given mesh must be of type Mesh.PRIMITIVE_TRIANGLES and have an index array.

void create_from_mesh(Mesh mesh)

Parameters

mesh Mesh

Qualifiers: const

Returns whether or not the specified layer of the geometry_collision_mask is enabled, given a layer_number between 1 and 32.

bool get_collision_mask_value(int layer_number)

Parameters

layer_number int

Returns a PackedInt32Array containing the indices of the vertices of a created polygon.

PackedInt32Array get_polygon(int idx)

Parameters

idx int

Qualifiers: const

Returns the number of polygons in the navigation mesh.

int get_polygon_count

Qualifiers: const

Returns a PackedVector3Array containing all the vertices being used to create the polygons.

PackedVector3Array get_vertices

Based on value, enables or disables the specified layer in the geometry_collision_mask, given a layer_number between 1 and 32.

void set_collision_mask_value(int layer_number, bool value)

Parameters

layer_number int
value bool

Sets the vertices that can be then indexed to create polygons with the NavigationMesh.add_polygon method.

void set_vertices(PackedVector3Array vertices)

Parameters

vertices PackedVector3Array