:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Navigation2D.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Navigation2D: Navigation2D ============ **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` 2D navigation and pathfinding node. Description ----------- Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of :ref:`NavigationPolygon` resources. These are automatically collected from child :ref:`NavigationRegion2D` nodes. Properties ---------- +---------------------------+-----------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`cell_size` | ``10.0`` | +---------------------------+-----------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`edge_connection_margin` | ``100.0`` | +---------------------------+-----------------------------------------------------------------------------------+-----------+ Methods ------- +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_closest_point` **(** :ref:`Vector2` to_point **)** const | +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_closest_point_owner` **(** :ref:`Vector2` to_point **)** const | +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_rid` **(** **)** const | +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedVector2Array` | :ref:`get_simple_path` **(** :ref:`Vector2` start, :ref:`Vector2` end, :ref:`bool` optimize=true **)** const | +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Property Descriptions --------------------- .. _class_Navigation2D_property_cell_size: - :ref:`float` **cell_size** +-----------+----------------------+ | *Default* | ``10.0`` | +-----------+----------------------+ | *Setter* | set_cell_size(value) | +-----------+----------------------+ | *Getter* | get_cell_size() | +-----------+----------------------+ ---- .. _class_Navigation2D_property_edge_connection_margin: - :ref:`float` **edge_connection_margin** +-----------+-----------------------------------+ | *Default* | ``100.0`` | +-----------+-----------------------------------+ | *Setter* | set_edge_connection_margin(value) | +-----------+-----------------------------------+ | *Getter* | get_edge_connection_margin() | +-----------+-----------------------------------+ Method Descriptions ------------------- .. _class_Navigation2D_method_get_closest_point: - :ref:`Vector2` **get_closest_point** **(** :ref:`Vector2` to_point **)** const Returns the point closest to the provided ``to_point`` on the navigation mesh surface. ---- .. _class_Navigation2D_method_get_closest_point_owner: - :ref:`RID` **get_closest_point_owner** **(** :ref:`Vector2` to_point **)** const Returns the owner region RID for the point returned by :ref:`get_closest_point`. ---- .. _class_Navigation2D_method_get_rid: - :ref:`RID` **get_rid** **(** **)** const ---- .. _class_Navigation2D_method_get_simple_path: - :ref:`PackedVector2Array` **get_simple_path** **(** :ref:`Vector2` start, :ref:`Vector2` end, :ref:`bool` optimize=true **)** const Returns the path between two given points. Points are in local coordinate space. If ``optimize`` is ``true`` (the default), the path is smoothed by merging path segments where possible.