class_navigationregion3d.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NavigationRegion3D.xml.
  6. .. _class_NavigationRegion3D:
  7. NavigationRegion3D
  8. ==================
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. A traversable 3D region that :ref:`NavigationAgent3D<class_NavigationAgent3D>`\ s can use for pathfinding.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. A traversable 3D region based on a :ref:`NavigationMesh<class_NavigationMesh>` that :ref:`NavigationAgent3D<class_NavigationAgent3D>`\ s can use for pathfinding.
  16. Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using :ref:`NavigationServer3D.map_set_edge_connection_margin<class_NavigationServer3D_method_map_set_edge_connection_margin>`.
  17. \ **Note:** Overlapping two regions' navigation meshes is not enough for connecting two regions. They must share a similar edge.
  18. The cost of entering this region from another region can be controlled with the :ref:`enter_cost<class_NavigationRegion3D_property_enter_cost>` value.
  19. \ **Note:** This value is not added to the path cost when the start position is already inside this region.
  20. The cost of traveling distances inside this region can be controlled with the :ref:`travel_cost<class_NavigationRegion3D_property_travel_cost>` multiplier.
  21. \ **Note:** This node caches changes to its properties, so if you make changes to the underlying region :ref:`RID<class_RID>` in :ref:`NavigationServer3D<class_NavigationServer3D>`, they will not be reflected in this node's properties.
  22. .. rst-class:: classref-introduction-group
  23. Tutorials
  24. ---------
  25. - :doc:`Using NavigationRegions <../tutorials/navigation/navigation_using_navigationregions>`
  26. .. rst-class:: classref-reftable-group
  27. Properties
  28. ----------
  29. .. table::
  30. :widths: auto
  31. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  32. | :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationRegion3D_property_enabled>` | ``true`` |
  33. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  34. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationRegion3D_property_enter_cost>` | ``0.0`` |
  35. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  36. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationRegion3D_property_navigation_layers>` | ``1`` |
  37. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  38. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`navigation_mesh<class_NavigationRegion3D_property_navigation_mesh>` | |
  39. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  40. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationRegion3D_property_travel_cost>` | ``1.0`` |
  41. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  42. | :ref:`bool<class_bool>` | :ref:`use_edge_connections<class_NavigationRegion3D_property_use_edge_connections>` | ``true`` |
  43. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  44. .. rst-class:: classref-reftable-group
  45. Methods
  46. -------
  47. .. table::
  48. :widths: auto
  49. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | |void| | :ref:`bake_navigation_mesh<class_NavigationRegion3D_method_bake_navigation_mesh>`\ (\ on_thread\: :ref:`bool<class_bool>` = true\ ) |
  51. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationRegion3D_method_get_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  53. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationRegion3D_method_get_navigation_map>`\ (\ ) |const| |
  55. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`RID<class_RID>` | :ref:`get_region_rid<class_NavigationRegion3D_method_get_region_rid>`\ (\ ) |const| |
  57. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationRegion3D_method_get_rid>`\ (\ ) |const| |
  59. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`is_baking<class_NavigationRegion3D_method_is_baking>`\ (\ ) |const| |
  61. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | |void| | :ref:`set_navigation_layer_value<class_NavigationRegion3D_method_set_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  63. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | |void| | :ref:`set_navigation_map<class_NavigationRegion3D_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
  65. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. .. rst-class:: classref-section-separator
  67. ----
  68. .. rst-class:: classref-descriptions-group
  69. Signals
  70. -------
  71. .. _class_NavigationRegion3D_signal_bake_finished:
  72. .. rst-class:: classref-signal
  73. **bake_finished**\ (\ ) :ref:`🔗<class_NavigationRegion3D_signal_bake_finished>`
  74. Notifies when the navigation mesh bake operation is completed.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_NavigationRegion3D_signal_navigation_mesh_changed:
  78. .. rst-class:: classref-signal
  79. **navigation_mesh_changed**\ (\ ) :ref:`🔗<class_NavigationRegion3D_signal_navigation_mesh_changed>`
  80. Notifies when the :ref:`NavigationMesh<class_NavigationMesh>` has changed.
  81. .. rst-class:: classref-section-separator
  82. ----
  83. .. rst-class:: classref-descriptions-group
  84. Property Descriptions
  85. ---------------------
  86. .. _class_NavigationRegion3D_property_enabled:
  87. .. rst-class:: classref-property
  88. :ref:`bool<class_bool>` **enabled** = ``true`` :ref:`🔗<class_NavigationRegion3D_property_enabled>`
  89. .. rst-class:: classref-property-setget
  90. - |void| **set_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  91. - :ref:`bool<class_bool>` **is_enabled**\ (\ )
  92. Determines if the **NavigationRegion3D** is enabled or disabled.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_NavigationRegion3D_property_enter_cost:
  96. .. rst-class:: classref-property
  97. :ref:`float<class_float>` **enter_cost** = ``0.0`` :ref:`🔗<class_NavigationRegion3D_property_enter_cost>`
  98. .. rst-class:: classref-property-setget
  99. - |void| **set_enter_cost**\ (\ value\: :ref:`float<class_float>`\ )
  100. - :ref:`float<class_float>` **get_enter_cost**\ (\ )
  101. When pathfinding enters this region's navigation mesh from another regions navigation mesh the :ref:`enter_cost<class_NavigationRegion3D_property_enter_cost>` value is added to the path distance for determining the shortest path.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_NavigationRegion3D_property_navigation_layers:
  105. .. rst-class:: classref-property
  106. :ref:`int<class_int>` **navigation_layers** = ``1`` :ref:`🔗<class_NavigationRegion3D_property_navigation_layers>`
  107. .. rst-class:: classref-property-setget
  108. - |void| **set_navigation_layers**\ (\ value\: :ref:`int<class_int>`\ )
  109. - :ref:`int<class_int>` **get_navigation_layers**\ (\ )
  110. A bitfield determining all navigation layers the region belongs to. These navigation layers can be checked upon when requesting a path with :ref:`NavigationServer3D.map_get_path<class_NavigationServer3D_method_map_get_path>`.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_NavigationRegion3D_property_navigation_mesh:
  114. .. rst-class:: classref-property
  115. :ref:`NavigationMesh<class_NavigationMesh>` **navigation_mesh** :ref:`🔗<class_NavigationRegion3D_property_navigation_mesh>`
  116. .. rst-class:: classref-property-setget
  117. - |void| **set_navigation_mesh**\ (\ value\: :ref:`NavigationMesh<class_NavigationMesh>`\ )
  118. - :ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh**\ (\ )
  119. The :ref:`NavigationMesh<class_NavigationMesh>` resource to use.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_NavigationRegion3D_property_travel_cost:
  123. .. rst-class:: classref-property
  124. :ref:`float<class_float>` **travel_cost** = ``1.0`` :ref:`🔗<class_NavigationRegion3D_property_travel_cost>`
  125. .. rst-class:: classref-property-setget
  126. - |void| **set_travel_cost**\ (\ value\: :ref:`float<class_float>`\ )
  127. - :ref:`float<class_float>` **get_travel_cost**\ (\ )
  128. When pathfinding moves inside this region's navigation mesh the traveled distances are multiplied with :ref:`travel_cost<class_NavigationRegion3D_property_travel_cost>` for determining the shortest path.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_NavigationRegion3D_property_use_edge_connections:
  132. .. rst-class:: classref-property
  133. :ref:`bool<class_bool>` **use_edge_connections** = ``true`` :ref:`🔗<class_NavigationRegion3D_property_use_edge_connections>`
  134. .. rst-class:: classref-property-setget
  135. - |void| **set_use_edge_connections**\ (\ value\: :ref:`bool<class_bool>`\ )
  136. - :ref:`bool<class_bool>` **get_use_edge_connections**\ (\ )
  137. If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  138. .. rst-class:: classref-section-separator
  139. ----
  140. .. rst-class:: classref-descriptions-group
  141. Method Descriptions
  142. -------------------
  143. .. _class_NavigationRegion3D_method_bake_navigation_mesh:
  144. .. rst-class:: classref-method
  145. |void| **bake_navigation_mesh**\ (\ on_thread\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_NavigationRegion3D_method_bake_navigation_mesh>`
  146. Bakes the :ref:`NavigationMesh<class_NavigationMesh>`. If ``on_thread`` is set to ``true`` (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new :ref:`NavigationMesh<class_NavigationMesh>`. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as Web with threads disabled).
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_NavigationRegion3D_method_get_navigation_layer_value:
  150. .. rst-class:: classref-method
  151. :ref:`bool<class_bool>` **get_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationRegion3D_method_get_navigation_layer_value>`
  152. Returns whether or not the specified layer of the :ref:`navigation_layers<class_NavigationRegion3D_property_navigation_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_NavigationRegion3D_method_get_navigation_map:
  156. .. rst-class:: classref-method
  157. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_NavigationRegion3D_method_get_navigation_map>`
  158. Returns the current navigation map :ref:`RID<class_RID>` used by this region.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_NavigationRegion3D_method_get_region_rid:
  162. .. rst-class:: classref-method
  163. :ref:`RID<class_RID>` **get_region_rid**\ (\ ) |const| :ref:`🔗<class_NavigationRegion3D_method_get_region_rid>`
  164. **Deprecated:** Use :ref:`get_rid<class_NavigationRegion3D_method_get_rid>` instead.
  165. Returns the :ref:`RID<class_RID>` of this region on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_NavigationRegion3D_method_get_rid:
  169. .. rst-class:: classref-method
  170. :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_NavigationRegion3D_method_get_rid>`
  171. Returns the :ref:`RID<class_RID>` of this region on the :ref:`NavigationServer3D<class_NavigationServer3D>`. Combined with :ref:`NavigationServer3D.map_get_closest_point_owner<class_NavigationServer3D_method_map_get_closest_point_owner>` can be used to identify the **NavigationRegion3D** closest to a point on the merged navigation map.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_NavigationRegion3D_method_is_baking:
  175. .. rst-class:: classref-method
  176. :ref:`bool<class_bool>` **is_baking**\ (\ ) |const| :ref:`🔗<class_NavigationRegion3D_method_is_baking>`
  177. Returns ``true`` when the :ref:`NavigationMesh<class_NavigationMesh>` is being baked on a background thread.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_NavigationRegion3D_method_set_navigation_layer_value:
  181. .. rst-class:: classref-method
  182. |void| **set_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationRegion3D_method_set_navigation_layer_value>`
  183. Based on ``value``, enables or disables the specified layer in the :ref:`navigation_layers<class_NavigationRegion3D_property_navigation_layers>` bitmask, given a ``layer_number`` between 1 and 32.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_NavigationRegion3D_method_set_navigation_map:
  187. .. rst-class:: classref-method
  188. |void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_NavigationRegion3D_method_set_navigation_map>`
  189. Sets the :ref:`RID<class_RID>` of the navigation map this region should use. By default the region will automatically join the :ref:`World3D<class_World3D>` default navigation map so this function is only required to override the default map.
  190. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  191. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  192. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  193. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  194. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  195. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  196. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  197. .. |void| replace:: :abbr:`void (No return value.)`