mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
103 lines
5.6 KiB
ReStructuredText
103 lines
5.6 KiB
ReStructuredText
: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/<name>/doc_classes.
|
|
|
|
.. _class_Navigation2D:
|
|
|
|
Navigation2D
|
|
============
|
|
|
|
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
2D navigation and pathfinding node.
|
|
|
|
Description
|
|
-----------
|
|
|
|
Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of :ref:`NavigationPolygon<class_NavigationPolygon>` resources. These are automatically collected from child :ref:`NavigationRegion2D<class_NavigationRegion2D>` nodes.
|
|
|
|
Properties
|
|
----------
|
|
|
|
+---------------------------+-----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`float<class_float>` | :ref:`cell_size<class_Navigation2D_property_cell_size>` | ``10.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------------+-----------+
|
|
| :ref:`float<class_float>` | :ref:`edge_connection_margin<class_Navigation2D_property_edge_connection_margin>` | ``100.0`` |
|
|
+---------------------------+-----------------------------------------------------------------------------------+-----------+
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>` **(** :ref:`Vector2<class_Vector2>` to_point **)** const |
|
|
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_closest_point_owner<class_Navigation2D_method_get_closest_point_owner>` **(** :ref:`Vector2<class_Vector2>` to_point **)** const |
|
|
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_rid<class_Navigation2D_method_get_rid>` **(** **)** const |
|
|
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_simple_path<class_Navigation2D_method_get_simple_path>` **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_bool>` optimize=true **)** const |
|
|
+-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_Navigation2D_property_cell_size:
|
|
|
|
- :ref:`float<class_float>` **cell_size**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``10.0`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_cell_size(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_cell_size() |
|
|
+-----------+----------------------+
|
|
|
|
----
|
|
|
|
.. _class_Navigation2D_property_edge_connection_margin:
|
|
|
|
- :ref:`float<class_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<class_Vector2>` **get_closest_point** **(** :ref:`Vector2<class_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<class_RID>` **get_closest_point_owner** **(** :ref:`Vector2<class_Vector2>` to_point **)** const
|
|
|
|
Returns the owner region RID for the point returned by :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>`.
|
|
|
|
----
|
|
|
|
.. _class_Navigation2D_method_get_rid:
|
|
|
|
- :ref:`RID<class_RID>` **get_rid** **(** **)** const
|
|
|
|
----
|
|
|
|
.. _class_Navigation2D_method_get_simple_path:
|
|
|
|
- :ref:`PackedVector2Array<class_PackedVector2Array>` **get_simple_path** **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_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.
|
|
|