2
0

class_navigation.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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/Navigation.xml.
  6. .. _class_Navigation:
  7. Navigation
  8. ==========
  9. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Mesh-based navigation and pathfinding node.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. *Deprecated.* **Navigation** node and :ref:`get_simple_path<class_Navigation_method_get_simple_path>` are deprecated and will be removed in a future version. Use :ref:`NavigationServer.map_get_path<class_NavigationServer_method_map_get_path>` instead.
  15. Provides navigation and pathfinding within a collection of :ref:`NavigationMesh<class_NavigationMesh>`\ es. By default, these will be automatically collected from child :ref:`NavigationMeshInstance<class_NavigationMeshInstance>` nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `3D Navmesh Demo <https://godotengine.org/asset-library/asset/124>`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  26. | :ref:`float<class_float>` | :ref:`cell_height<class_Navigation_property_cell_height>` | ``0.25`` |
  27. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  28. | :ref:`float<class_float>` | :ref:`cell_size<class_Navigation_property_cell_size>` | ``0.25`` |
  29. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  30. | :ref:`float<class_float>` | :ref:`edge_connection_margin<class_Navigation_property_edge_connection_margin>` | ``0.25`` |
  31. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  32. | :ref:`int<class_int>` | :ref:`navigation_layers<class_Navigation_property_navigation_layers>` | ``1`` |
  33. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  34. | :ref:`Vector3<class_Vector3>` | :ref:`up_vector<class_Navigation_property_up_vector>` | ``Vector3( 0, 1, 0 )`` |
  35. +-------------------------------+---------------------------------------------------------------------------------+------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point<class_Navigation_method_get_closest_point>` **(** :ref:`Vector3<class_Vector3>` to_point **)** |const| |
  43. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point_normal<class_Navigation_method_get_closest_point_normal>` **(** :ref:`Vector3<class_Vector3>` to_point **)** |const| |
  45. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`RID<class_RID>` | :ref:`get_closest_point_owner<class_Navigation_method_get_closest_point_owner>` **(** :ref:`Vector3<class_Vector3>` to_point **)** |const| |
  47. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector3<class_Vector3>` | :ref:`get_closest_point_to_segment<class_Navigation_method_get_closest_point_to_segment>` **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** |const| |
  49. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`RID<class_RID>` | :ref:`get_rid<class_Navigation_method_get_rid>` **(** **)** |const| |
  51. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`PoolVector3Array<class_PoolVector3Array>` | :ref:`get_simple_path<class_Navigation_method_get_simple_path>` **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` optimize=true **)** |const| |
  53. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. .. rst-class:: classref-section-separator
  55. ----
  56. .. rst-class:: classref-descriptions-group
  57. Signals
  58. -------
  59. .. _class_Navigation_signal_map_changed:
  60. .. rst-class:: classref-signal
  61. **map_changed** **(** :ref:`RID<class_RID>` map **)**
  62. Emitted when a navigation map is updated, when a region moves or is modified.
  63. .. rst-class:: classref-section-separator
  64. ----
  65. .. rst-class:: classref-descriptions-group
  66. Property Descriptions
  67. ---------------------
  68. .. _class_Navigation_property_cell_height:
  69. .. rst-class:: classref-property
  70. :ref:`float<class_float>` **cell_height** = ``0.25``
  71. .. rst-class:: classref-property-setget
  72. - void **set_cell_height** **(** :ref:`float<class_float>` value **)**
  73. - :ref:`float<class_float>` **get_cell_height** **(** **)**
  74. The cell height to use for fields.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_Navigation_property_cell_size:
  78. .. rst-class:: classref-property
  79. :ref:`float<class_float>` **cell_size** = ``0.25``
  80. .. rst-class:: classref-property-setget
  81. - void **set_cell_size** **(** :ref:`float<class_float>` value **)**
  82. - :ref:`float<class_float>` **get_cell_size** **(** **)**
  83. The XZ plane cell size to use for fields.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_Navigation_property_edge_connection_margin:
  87. .. rst-class:: classref-property
  88. :ref:`float<class_float>` **edge_connection_margin** = ``0.25``
  89. .. rst-class:: classref-property-setget
  90. - void **set_edge_connection_margin** **(** :ref:`float<class_float>` value **)**
  91. - :ref:`float<class_float>` **get_edge_connection_margin** **(** **)**
  92. This value is used to detect the near edges to connect compatible regions.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_Navigation_property_navigation_layers:
  96. .. rst-class:: classref-property
  97. :ref:`int<class_int>` **navigation_layers** = ``1``
  98. .. rst-class:: classref-property-setget
  99. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  100. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  101. A bitfield determining all navigation map layers the navigation can use on a :ref:`get_simple_path<class_Navigation_method_get_simple_path>` path query.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_Navigation_property_up_vector:
  105. .. rst-class:: classref-property
  106. :ref:`Vector3<class_Vector3>` **up_vector** = ``Vector3( 0, 1, 0 )``
  107. .. rst-class:: classref-property-setget
  108. - void **set_up_vector** **(** :ref:`Vector3<class_Vector3>` value **)**
  109. - :ref:`Vector3<class_Vector3>` **get_up_vector** **(** **)**
  110. Defines which direction is up. By default, this is ``(0, 1, 0)``, which is the world's "up" direction.
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Method Descriptions
  115. -------------------
  116. .. _class_Navigation_method_get_closest_point:
  117. .. rst-class:: classref-method
  118. :ref:`Vector3<class_Vector3>` **get_closest_point** **(** :ref:`Vector3<class_Vector3>` to_point **)** |const|
  119. Returns the navigation point closest to the point given. Points are in local coordinate space.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_Navigation_method_get_closest_point_normal:
  123. .. rst-class:: classref-method
  124. :ref:`Vector3<class_Vector3>` **get_closest_point_normal** **(** :ref:`Vector3<class_Vector3>` to_point **)** |const|
  125. Returns the surface normal at the navigation point closest to the point given. Useful for rotating a navigation agent according to the navigation mesh it moves on.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_Navigation_method_get_closest_point_owner:
  129. .. rst-class:: classref-method
  130. :ref:`RID<class_RID>` **get_closest_point_owner** **(** :ref:`Vector3<class_Vector3>` to_point **)** |const|
  131. Returns the owner of the :ref:`NavigationMesh<class_NavigationMesh>` which contains the navigation point closest to the point given. This is usually a :ref:`NavigationMeshInstance<class_NavigationMeshInstance>`.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_Navigation_method_get_closest_point_to_segment:
  135. .. rst-class:: classref-method
  136. :ref:`Vector3<class_Vector3>` **get_closest_point_to_segment** **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** |const|
  137. Returns the navigation point closest to the given line segment. When enabling ``use_collision``, only considers intersection points between segment and navigation meshes. If multiple intersection points are found, the one closest to the segment start point is returned.
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _class_Navigation_method_get_rid:
  141. .. rst-class:: classref-method
  142. :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
  143. Returns the :ref:`RID<class_RID>` of the navigation map on the :ref:`NavigationServer<class_NavigationServer>`.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_Navigation_method_get_simple_path:
  147. .. rst-class:: classref-method
  148. :ref:`PoolVector3Array<class_PoolVector3Array>` **get_simple_path** **(** :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` optimize=true **)** |const|
  149. *Deprecated.* **Navigation** node and :ref:`get_simple_path<class_Navigation_method_get_simple_path>` are deprecated and will be removed in a future version. Use :ref:`NavigationServer.map_get_path<class_NavigationServer_method_map_get_path>` instead.
  150. Returns the path between two given points. Points are in local coordinate space. If ``optimize`` is ``true`` (the default), the agent properties associated with each :ref:`NavigationMesh<class_NavigationMesh>` (radius, height, etc.) are considered in the path calculation, otherwise they are ignored.
  151. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  152. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  153. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  154. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`