Files
godot-docs/classes/class_navigationmesh.rst
2025-07-05 03:33:35 +00:00

825 lines
41 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NavigationMesh.xml.
.. _class_NavigationMesh:
NavigationMesh
==============
**Experimental:** This class may be changed or removed in future versions.
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
A navigation mesh that defines traversable areas and obstacles.
.. rst-class:: classref-introduction-group
Description
-----------
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.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Using NavigationMeshes <../tutorials/navigation/navigation_using_navigationmeshes>`
- `3D Navigation Demo <https://godotengine.org/asset-library/asset/2743>`__
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`agent_height<class_NavigationMesh_property_agent_height>` | ``1.5`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`agent_max_climb<class_NavigationMesh_property_agent_max_climb>` | ``0.25`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`agent_max_slope<class_NavigationMesh_property_agent_max_slope>` | ``45.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`agent_radius<class_NavigationMesh_property_agent_radius>` | ``0.5`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`border_size<class_NavigationMesh_property_border_size>` | ``0.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`cell_height<class_NavigationMesh_property_cell_height>` | ``0.25`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`cell_size<class_NavigationMesh_property_cell_size>` | ``0.25`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`detail_sample_distance<class_NavigationMesh_property_detail_sample_distance>` | ``6.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`detail_sample_max_error<class_NavigationMesh_property_detail_sample_max_error>` | ``1.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`edge_max_error<class_NavigationMesh_property_edge_max_error>` | ``1.3`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`edge_max_length<class_NavigationMesh_property_edge_max_length>` | ``0.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`AABB<class_AABB>` | :ref:`filter_baking_aabb<class_NavigationMesh_property_filter_baking_aabb>` | ``AABB(0, 0, 0, 0, 0, 0)`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`filter_baking_aabb_offset<class_NavigationMesh_property_filter_baking_aabb_offset>` | ``Vector3(0, 0, 0)`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`bool<class_bool>` | :ref:`filter_ledge_spans<class_NavigationMesh_property_filter_ledge_spans>` | ``false`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`bool<class_bool>` | :ref:`filter_low_hanging_obstacles<class_NavigationMesh_property_filter_low_hanging_obstacles>` | ``false`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`bool<class_bool>` | :ref:`filter_walkable_low_height_spans<class_NavigationMesh_property_filter_walkable_low_height_spans>` | ``false`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`int<class_int>` | :ref:`geometry_collision_mask<class_NavigationMesh_property_geometry_collision_mask>` | ``4294967295`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` | :ref:`geometry_parsed_geometry_type<class_NavigationMesh_property_geometry_parsed_geometry_type>` | ``2`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` | :ref:`geometry_source_geometry_mode<class_NavigationMesh_property_geometry_source_geometry_mode>` | ``0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`geometry_source_group_name<class_NavigationMesh_property_geometry_source_group_name>` | ``&"navigation_mesh_source_group"`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`region_merge_size<class_NavigationMesh_property_region_merge_size>` | ``20.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`region_min_size<class_NavigationMesh_property_region_min_size>` | ``2.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` | :ref:`sample_partition_type<class_NavigationMesh_property_sample_partition_type>` | ``0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
| :ref:`float<class_float>` | :ref:`vertices_per_polygon<class_NavigationMesh_property_vertices_per_polygon>` | ``6.0`` |
+---------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------+-------------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_polygon<class_NavigationMesh_method_add_polygon>`\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear<class_NavigationMesh_method_clear>`\ (\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_polygons<class_NavigationMesh_method_clear_polygons>`\ (\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`create_from_mesh<class_NavigationMesh_method_create_from_mesh>`\ (\ mesh\: :ref:`Mesh<class_Mesh>`\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_collision_mask_value<class_NavigationMesh_method_get_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_polygon<class_NavigationMesh_method_get_polygon>`\ (\ idx\: :ref:`int<class_int>`\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_polygon_count<class_NavigationMesh_method_get_polygon_count>`\ (\ ) |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_vertices<class_NavigationMesh_method_get_vertices>`\ (\ ) |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_collision_mask_value<class_NavigationMesh_method_set_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_vertices<class_NavigationMesh_method_set_vertices>`\ (\ vertices\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ ) |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_NavigationMesh_SamplePartitionType:
.. rst-class:: classref-enumeration
enum **SamplePartitionType**: :ref:`🔗<enum_NavigationMesh_SamplePartitionType>`
.. _class_NavigationMesh_constant_SAMPLE_PARTITION_WATERSHED:
.. rst-class:: classref-enumeration-constant
:ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **SAMPLE_PARTITION_WATERSHED** = ``0``
Watershed partitioning. Generally the best choice if you precompute the navigation mesh, use this if you have large open areas.
.. _class_NavigationMesh_constant_SAMPLE_PARTITION_MONOTONE:
.. rst-class:: classref-enumeration-constant
:ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **SAMPLE_PARTITION_MONOTONE** = ``1``
Monotone partitioning. Use this if you want fast navigation mesh generation.
.. _class_NavigationMesh_constant_SAMPLE_PARTITION_LAYERS:
.. rst-class:: classref-enumeration-constant
:ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **SAMPLE_PARTITION_LAYERS** = ``2``
Layer partitioning. Good choice to use for tiled navigation mesh with medium and small sized tiles.
.. _class_NavigationMesh_constant_SAMPLE_PARTITION_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **SAMPLE_PARTITION_MAX** = ``3``
Represents the size of the :ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` enum.
.. rst-class:: classref-item-separator
----
.. _enum_NavigationMesh_ParsedGeometryType:
.. rst-class:: classref-enumeration
enum **ParsedGeometryType**: :ref:`🔗<enum_NavigationMesh_ParsedGeometryType>`
.. _class_NavigationMesh_constant_PARSED_GEOMETRY_MESH_INSTANCES:
.. rst-class:: classref-enumeration-constant
:ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **PARSED_GEOMETRY_MESH_INSTANCES** = ``0``
Parses mesh instances as geometry. This includes :ref:`MeshInstance3D<class_MeshInstance3D>`, :ref:`CSGShape3D<class_CSGShape3D>`, and :ref:`GridMap<class_GridMap>` nodes.
.. _class_NavigationMesh_constant_PARSED_GEOMETRY_STATIC_COLLIDERS:
.. rst-class:: classref-enumeration-constant
:ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **PARSED_GEOMETRY_STATIC_COLLIDERS** = ``1``
Parses :ref:`StaticBody3D<class_StaticBody3D>` colliders as geometry. The collider should be in any of the layers specified by :ref:`geometry_collision_mask<class_NavigationMesh_property_geometry_collision_mask>`.
.. _class_NavigationMesh_constant_PARSED_GEOMETRY_BOTH:
.. rst-class:: classref-enumeration-constant
:ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **PARSED_GEOMETRY_BOTH** = ``2``
Both :ref:`PARSED_GEOMETRY_MESH_INSTANCES<class_NavigationMesh_constant_PARSED_GEOMETRY_MESH_INSTANCES>` and :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationMesh_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>`.
.. _class_NavigationMesh_constant_PARSED_GEOMETRY_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **PARSED_GEOMETRY_MAX** = ``3``
Represents the size of the :ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` enum.
.. rst-class:: classref-item-separator
----
.. _enum_NavigationMesh_SourceGeometryMode:
.. rst-class:: classref-enumeration
enum **SourceGeometryMode**: :ref:`🔗<enum_NavigationMesh_SourceGeometryMode>`
.. _class_NavigationMesh_constant_SOURCE_GEOMETRY_ROOT_NODE_CHILDREN:
.. rst-class:: classref-enumeration-constant
:ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **SOURCE_GEOMETRY_ROOT_NODE_CHILDREN** = ``0``
Scans the child nodes of the root node recursively for geometry.
.. _class_NavigationMesh_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN:
.. rst-class:: classref-enumeration-constant
:ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN** = ``1``
Scans nodes in a group and their child nodes recursively for geometry. The group is specified by :ref:`geometry_source_group_name<class_NavigationMesh_property_geometry_source_group_name>`.
.. _class_NavigationMesh_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT:
.. rst-class:: classref-enumeration-constant
:ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_EXPLICIT** = ``2``
Uses nodes in a group for geometry. The group is specified by :ref:`geometry_source_group_name<class_NavigationMesh_property_geometry_source_group_name>`.
.. _class_NavigationMesh_constant_SOURCE_GEOMETRY_MAX:
.. rst-class:: classref-enumeration-constant
:ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **SOURCE_GEOMETRY_MAX** = ``3``
Represents the size of the :ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` enum.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_NavigationMesh_property_agent_height:
.. rst-class:: classref-property
:ref:`float<class_float>` **agent_height** = ``1.5`` :ref:`🔗<class_NavigationMesh_property_agent_height>`
.. rst-class:: classref-property-setget
- |void| **set_agent_height**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_agent_height**\ (\ )
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 :ref:`cell_height<class_NavigationMesh_property_cell_height>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_agent_max_climb:
.. rst-class:: classref-property
:ref:`float<class_float>` **agent_max_climb** = ``0.25`` :ref:`🔗<class_NavigationMesh_property_agent_max_climb>`
.. rst-class:: classref-property-setget
- |void| **set_agent_max_climb**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_agent_max_climb**\ (\ )
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 :ref:`cell_height<class_NavigationMesh_property_cell_height>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_agent_max_slope:
.. rst-class:: classref-property
:ref:`float<class_float>` **agent_max_slope** = ``45.0`` :ref:`🔗<class_NavigationMesh_property_agent_max_slope>`
.. rst-class:: classref-property-setget
- |void| **set_agent_max_slope**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_agent_max_slope**\ (\ )
The maximum slope that is considered walkable, in degrees.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_agent_radius:
.. rst-class:: classref-property
:ref:`float<class_float>` **agent_radius** = ``0.5`` :ref:`🔗<class_NavigationMesh_property_agent_radius>`
.. rst-class:: classref-property-setget
- |void| **set_agent_radius**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_agent_radius**\ (\ )
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 :ref:`cell_size<class_NavigationMesh_property_cell_size>`.
\ **Note:** The radius must be equal or higher than ``0.0``. If the radius is ``0.0``, it won't be possible to fix invalid outline overlaps and other precision errors during the baking process. As a result, some obstacles may be excluded incorrectly from the final navigation mesh, or may delete the navigation mesh's polygons.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_border_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **border_size** = ``0.0`` :ref:`🔗<class_NavigationMesh_property_border_size>`
.. rst-class:: classref-property-setget
- |void| **set_border_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_border_size**\ (\ )
The size of the non-navigable border around the bake bounding area.
In conjunction with the :ref:`filter_baking_aabb<class_NavigationMesh_property_filter_baking_aabb>` and a :ref:`edge_max_error<class_NavigationMesh_property_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 :ref:`agent_radius<class_NavigationMesh_property_agent_radius>`.
\ **Note:** If this value is not ``0.0``, it will be rounded up to the nearest multiple of :ref:`cell_size<class_NavigationMesh_property_cell_size>` during baking.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_cell_height:
.. rst-class:: classref-property
:ref:`float<class_float>` **cell_height** = ``0.25`` :ref:`🔗<class_NavigationMesh_property_cell_height>`
.. rst-class:: classref-property-setget
- |void| **set_cell_height**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_cell_height**\ (\ )
The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_cell_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **cell_size** = ``0.25`` :ref:`🔗<class_NavigationMesh_property_cell_size>`
.. rst-class:: classref-property-setget
- |void| **set_cell_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_cell_size**\ (\ )
The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_detail_sample_distance:
.. rst-class:: classref-property
:ref:`float<class_float>` **detail_sample_distance** = ``6.0`` :ref:`🔗<class_NavigationMesh_property_detail_sample_distance>`
.. rst-class:: classref-property-setget
- |void| **set_detail_sample_distance**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_detail_sample_distance**\ (\ )
The sampling distance to use when generating the detail mesh, in cell unit.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_detail_sample_max_error:
.. rst-class:: classref-property
:ref:`float<class_float>` **detail_sample_max_error** = ``1.0`` :ref:`🔗<class_NavigationMesh_property_detail_sample_max_error>`
.. rst-class:: classref-property-setget
- |void| **set_detail_sample_max_error**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_detail_sample_max_error**\ (\ )
The maximum distance the detail mesh surface should deviate from heightfield, in cell unit.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_edge_max_error:
.. rst-class:: classref-property
:ref:`float<class_float>` **edge_max_error** = ``1.3`` :ref:`🔗<class_NavigationMesh_property_edge_max_error>`
.. rst-class:: classref-property-setget
- |void| **set_edge_max_error**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_edge_max_error**\ (\ )
The maximum distance a simplified contour's border edges should deviate the original raw contour.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_edge_max_length:
.. rst-class:: classref-property
:ref:`float<class_float>` **edge_max_length** = ``0.0`` :ref:`🔗<class_NavigationMesh_property_edge_max_length>`
.. rst-class:: classref-property-setget
- |void| **set_edge_max_length**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_edge_max_length**\ (\ )
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 :ref:`cell_size<class_NavigationMesh_property_cell_size>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_filter_baking_aabb:
.. rst-class:: classref-property
:ref:`AABB<class_AABB>` **filter_baking_aabb** = ``AABB(0, 0, 0, 0, 0, 0)`` :ref:`🔗<class_NavigationMesh_property_filter_baking_aabb>`
.. rst-class:: classref-property-setget
- |void| **set_filter_baking_aabb**\ (\ value\: :ref:`AABB<class_AABB>`\ )
- :ref:`AABB<class_AABB>` **get_filter_baking_aabb**\ (\ )
If the baking :ref:`AABB<class_AABB>` has a volume the navigation mesh baking will be restricted to its enclosing area.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_filter_baking_aabb_offset:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **filter_baking_aabb_offset** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationMesh_property_filter_baking_aabb_offset>`
.. rst-class:: classref-property-setget
- |void| **set_filter_baking_aabb_offset**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
- :ref:`Vector3<class_Vector3>` **get_filter_baking_aabb_offset**\ (\ )
The position offset applied to the :ref:`filter_baking_aabb<class_NavigationMesh_property_filter_baking_aabb>` :ref:`AABB<class_AABB>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_filter_ledge_spans:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **filter_ledge_spans** = ``false`` :ref:`🔗<class_NavigationMesh_property_filter_ledge_spans>`
.. rst-class:: classref-property-setget
- |void| **set_filter_ledge_spans**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_filter_ledge_spans**\ (\ )
If ``true``, marks spans that are ledges as non-walkable.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_filter_low_hanging_obstacles:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **filter_low_hanging_obstacles** = ``false`` :ref:`🔗<class_NavigationMesh_property_filter_low_hanging_obstacles>`
.. rst-class:: classref-property-setget
- |void| **set_filter_low_hanging_obstacles**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_filter_low_hanging_obstacles**\ (\ )
If ``true``, marks non-walkable spans as walkable if their maximum is within :ref:`agent_max_climb<class_NavigationMesh_property_agent_max_climb>` of a walkable neighbor.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_filter_walkable_low_height_spans:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **filter_walkable_low_height_spans** = ``false`` :ref:`🔗<class_NavigationMesh_property_filter_walkable_low_height_spans>`
.. rst-class:: classref-property-setget
- |void| **set_filter_walkable_low_height_spans**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_filter_walkable_low_height_spans**\ (\ )
If ``true``, marks walkable spans as not walkable if the clearance above the span is less than :ref:`agent_height<class_NavigationMesh_property_agent_height>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_geometry_collision_mask:
.. rst-class:: classref-property
:ref:`int<class_int>` **geometry_collision_mask** = ``4294967295`` :ref:`🔗<class_NavigationMesh_property_geometry_collision_mask>`
.. rst-class:: classref-property-setget
- |void| **set_collision_mask**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_collision_mask**\ (\ )
The physics layers to scan for static colliders.
Only used when :ref:`geometry_parsed_geometry_type<class_NavigationMesh_property_geometry_parsed_geometry_type>` is :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationMesh_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>` or :ref:`PARSED_GEOMETRY_BOTH<class_NavigationMesh_constant_PARSED_GEOMETRY_BOTH>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_geometry_parsed_geometry_type:
.. rst-class:: classref-property
:ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **geometry_parsed_geometry_type** = ``2`` :ref:`🔗<class_NavigationMesh_property_geometry_parsed_geometry_type>`
.. rst-class:: classref-property-setget
- |void| **set_parsed_geometry_type**\ (\ value\: :ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>`\ )
- :ref:`ParsedGeometryType<enum_NavigationMesh_ParsedGeometryType>` **get_parsed_geometry_type**\ (\ )
Determines which type of nodes will be parsed as geometry.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_geometry_source_geometry_mode:
.. rst-class:: classref-property
:ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **geometry_source_geometry_mode** = ``0`` :ref:`🔗<class_NavigationMesh_property_geometry_source_geometry_mode>`
.. rst-class:: classref-property-setget
- |void| **set_source_geometry_mode**\ (\ value\: :ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>`\ )
- :ref:`SourceGeometryMode<enum_NavigationMesh_SourceGeometryMode>` **get_source_geometry_mode**\ (\ )
The source of the geometry used when baking.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_geometry_source_group_name:
.. rst-class:: classref-property
:ref:`StringName<class_StringName>` **geometry_source_group_name** = ``&"navigation_mesh_source_group"`` :ref:`🔗<class_NavigationMesh_property_geometry_source_group_name>`
.. rst-class:: classref-property-setget
- |void| **set_source_group_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
- :ref:`StringName<class_StringName>` **get_source_group_name**\ (\ )
The name of the group to scan for geometry.
Only used when :ref:`geometry_source_geometry_mode<class_NavigationMesh_property_geometry_source_geometry_mode>` is :ref:`SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN<class_NavigationMesh_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN>` or :ref:`SOURCE_GEOMETRY_GROUPS_EXPLICIT<class_NavigationMesh_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_region_merge_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **region_merge_size** = ``20.0`` :ref:`🔗<class_NavigationMesh_property_region_merge_size>`
.. rst-class:: classref-property-setget
- |void| **set_region_merge_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_region_merge_size**\ (\ )
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.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_region_min_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **region_min_size** = ``2.0`` :ref:`🔗<class_NavigationMesh_property_region_min_size>`
.. rst-class:: classref-property-setget
- |void| **set_region_min_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_region_min_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.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_sample_partition_type:
.. rst-class:: classref-property
:ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **sample_partition_type** = ``0`` :ref:`🔗<class_NavigationMesh_property_sample_partition_type>`
.. rst-class:: classref-property-setget
- |void| **set_sample_partition_type**\ (\ value\: :ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>`\ )
- :ref:`SamplePartitionType<enum_NavigationMesh_SamplePartitionType>` **get_sample_partition_type**\ (\ )
Partitioning algorithm for creating the navigation mesh polys.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_property_vertices_per_polygon:
.. rst-class:: classref-property
:ref:`float<class_float>` **vertices_per_polygon** = ``6.0`` :ref:`🔗<class_NavigationMesh_property_vertices_per_polygon>`
.. rst-class:: classref-property-setget
- |void| **set_vertices_per_polygon**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_vertices_per_polygon**\ (\ )
The maximum number of vertices allowed for polygons generated during the contour to polygon conversion process.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_NavigationMesh_method_add_polygon:
.. rst-class:: classref-method
|void| **add_polygon**\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) :ref:`🔗<class_NavigationMesh_method_add_polygon>`
Adds a polygon using the indices of the vertices you get when calling :ref:`get_vertices()<class_NavigationMesh_method_get_vertices>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_clear:
.. rst-class:: classref-method
|void| **clear**\ (\ ) :ref:`🔗<class_NavigationMesh_method_clear>`
Clears the internal arrays for vertices and polygon indices.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_clear_polygons:
.. rst-class:: classref-method
|void| **clear_polygons**\ (\ ) :ref:`🔗<class_NavigationMesh_method_clear_polygons>`
Clears the array of polygons, but it doesn't clear the array of vertices.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_create_from_mesh:
.. rst-class:: classref-method
|void| **create_from_mesh**\ (\ mesh\: :ref:`Mesh<class_Mesh>`\ ) :ref:`🔗<class_NavigationMesh_method_create_from_mesh>`
Initializes the navigation mesh by setting the vertices and indices according to a :ref:`Mesh<class_Mesh>`.
\ **Note:** The given ``mesh`` must be of type :ref:`Mesh.PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>` and have an index array.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_get_collision_mask_value:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationMesh_method_get_collision_mask_value>`
Returns whether or not the specified layer of the :ref:`geometry_collision_mask<class_NavigationMesh_property_geometry_collision_mask>` is enabled, given a ``layer_number`` between 1 and 32.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_get_polygon:
.. rst-class:: classref-method
:ref:`PackedInt32Array<class_PackedInt32Array>` **get_polygon**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationMesh_method_get_polygon>`
Returns a :ref:`PackedInt32Array<class_PackedInt32Array>` containing the indices of the vertices of a created polygon.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_get_polygon_count:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_polygon_count**\ (\ ) |const| :ref:`🔗<class_NavigationMesh_method_get_polygon_count>`
Returns the number of polygons in the navigation mesh.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_get_vertices:
.. rst-class:: classref-method
:ref:`PackedVector3Array<class_PackedVector3Array>` **get_vertices**\ (\ ) |const| :ref:`🔗<class_NavigationMesh_method_get_vertices>`
Returns a :ref:`PackedVector3Array<class_PackedVector3Array>` containing all the vertices being used to create the polygons.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_set_collision_mask_value:
.. rst-class:: classref-method
|void| **set_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationMesh_method_set_collision_mask_value>`
Based on ``value``, enables or disables the specified layer in the :ref:`geometry_collision_mask<class_NavigationMesh_property_geometry_collision_mask>`, given a ``layer_number`` between 1 and 32.
.. rst-class:: classref-item-separator
----
.. _class_NavigationMesh_method_set_vertices:
.. rst-class:: classref-method
|void| **set_vertices**\ (\ vertices\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ ) :ref:`🔗<class_NavigationMesh_method_set_vertices>`
Sets the vertices that can be then indexed to create polygons with the :ref:`add_polygon()<class_NavigationMesh_method_add_polygon>` method.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`