class_navigation2d.rst 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Navigation2D.xml.
  6. .. _class_Navigation2D:
  7. Navigation2D
  8. ============
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. 2D navigation and pathfinding node.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. *Deprecated.* **Navigation2D** node and :ref:`get_simple_path<class_Navigation2D_method_get_simple_path>` are deprecated and will be removed in a future version. Use :ref:`Navigation2DServer.map_get_path<class_Navigation2DServer_method_map_get_path>` instead.
  15. Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of :ref:`NavigationPolygon<class_NavigationPolygon>` resources. By default, these are automatically collected from child :ref:`NavigationPolygonInstance<class_NavigationPolygonInstance>` nodes.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `2D Navigation Demo <https://godotengine.org/asset-library/asset/117>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +---------------------------+-----------------------------------------------------------------------------------+---------+
  26. | :ref:`float<class_float>` | :ref:`cell_size<class_Navigation2D_property_cell_size>` | ``1.0`` |
  27. +---------------------------+-----------------------------------------------------------------------------------+---------+
  28. | :ref:`float<class_float>` | :ref:`edge_connection_margin<class_Navigation2D_property_edge_connection_margin>` | ``1.0`` |
  29. +---------------------------+-----------------------------------------------------------------------------------+---------+
  30. | :ref:`int<class_int>` | :ref:`navigation_layers<class_Navigation2D_property_navigation_layers>` | ``1`` |
  31. +---------------------------+-----------------------------------------------------------------------------------+---------+
  32. .. rst-class:: classref-reftable-group
  33. Methods
  34. -------
  35. .. table::
  36. :widths: auto
  37. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Vector2<class_Vector2>` | :ref:`get_closest_point<class_Navigation2D_method_get_closest_point>` **(** :ref:`Vector2<class_Vector2>` to_point **)** |const| |
  39. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`RID<class_RID>` | :ref:`get_closest_point_owner<class_Navigation2D_method_get_closest_point_owner>` **(** :ref:`Vector2<class_Vector2>` to_point **)** |const| |
  41. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`RID<class_RID>` | :ref:`get_rid<class_Navigation2D_method_get_rid>` **(** **)** |const| |
  43. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`PoolVector2Array<class_PoolVector2Array>` | :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| |
  45. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Property Descriptions
  50. ---------------------
  51. .. _class_Navigation2D_property_cell_size:
  52. .. rst-class:: classref-property
  53. :ref:`float<class_float>` **cell_size** = ``1.0``
  54. .. rst-class:: classref-property-setget
  55. - void **set_cell_size** **(** :ref:`float<class_float>` value **)**
  56. - :ref:`float<class_float>` **get_cell_size** **(** **)**
  57. The XY plane cell size to use for fields.
  58. .. rst-class:: classref-item-separator
  59. ----
  60. .. _class_Navigation2D_property_edge_connection_margin:
  61. .. rst-class:: classref-property
  62. :ref:`float<class_float>` **edge_connection_margin** = ``1.0``
  63. .. rst-class:: classref-property-setget
  64. - void **set_edge_connection_margin** **(** :ref:`float<class_float>` value **)**
  65. - :ref:`float<class_float>` **get_edge_connection_margin** **(** **)**
  66. This value is used to detect the near edges to connect compatible regions.
  67. .. rst-class:: classref-item-separator
  68. ----
  69. .. _class_Navigation2D_property_navigation_layers:
  70. .. rst-class:: classref-property
  71. :ref:`int<class_int>` **navigation_layers** = ``1``
  72. .. rst-class:: classref-property-setget
  73. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  74. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  75. A bitfield determining all navigation map layers the navigation can use on a :ref:`get_simple_path<class_Navigation2D_method_get_simple_path>` path query.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Method Descriptions
  80. -------------------
  81. .. _class_Navigation2D_method_get_closest_point:
  82. .. rst-class:: classref-method
  83. :ref:`Vector2<class_Vector2>` **get_closest_point** **(** :ref:`Vector2<class_Vector2>` to_point **)** |const|
  84. Returns the navigation point closest to the point given. Points are in local coordinate space.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _class_Navigation2D_method_get_closest_point_owner:
  88. .. rst-class:: classref-method
  89. :ref:`RID<class_RID>` **get_closest_point_owner** **(** :ref:`Vector2<class_Vector2>` to_point **)** |const|
  90. Returns the owner of the :ref:`NavigationPolygon<class_NavigationPolygon>` which contains the navigation point closest to the point given. This is usually a :ref:`NavigationPolygonInstance<class_NavigationPolygonInstance>`.
  91. .. rst-class:: classref-item-separator
  92. ----
  93. .. _class_Navigation2D_method_get_rid:
  94. .. rst-class:: classref-method
  95. :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
  96. Returns the object's :ref:`RID<class_RID>`.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_Navigation2D_method_get_simple_path:
  100. .. rst-class:: classref-method
  101. :ref:`PoolVector2Array<class_PoolVector2Array>` **get_simple_path** **(** :ref:`Vector2<class_Vector2>` start, :ref:`Vector2<class_Vector2>` end, :ref:`bool<class_bool>` optimize=true **)** |const|
  102. *Deprecated.* **Navigation2D** node and :ref:`get_simple_path<class_Navigation2D_method_get_simple_path>` are deprecated and will be removed in a future version. Use :ref:`Navigation2DServer.map_get_path<class_Navigation2DServer_method_map_get_path>` instead.
  103. 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.
  104. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  105. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  106. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  107. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`