class_navigationregion3d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A traversable 3D region that :ref:`NavigationAgent3D<class_NavigationAgent3D>`\ s can use for pathfinding.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A traversable 3D region based on a :ref:`NavigationMesh<class_NavigationMesh>` that :ref:`NavigationAgent3D<class_NavigationAgent3D>`\ s can use for pathfinding.
  15. 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>`.
  16. \ **Note:** Overlapping two regions' navigation meshes is not enough for connecting two regions. They must share a similar edge.
  17. The cost of entering this region from another region can be controlled with the :ref:`enter_cost<class_NavigationRegion3D_property_enter_cost>` value.
  18. \ **Note:** This value is not added to the path cost when the start position is already inside this region.
  19. The cost of traveling distances inside this region can be controlled with the :ref:`travel_cost<class_NavigationRegion3D_property_travel_cost>` multiplier.
  20. \ **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.
  21. .. rst-class:: classref-introduction-group
  22. Tutorials
  23. ---------
  24. - :doc:`Using NavigationRegions <../tutorials/navigation/navigation_using_navigationregions>`
  25. .. rst-class:: classref-reftable-group
  26. Properties
  27. ----------
  28. .. table::
  29. :widths: auto
  30. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  31. | :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationRegion3D_property_enabled>` | ``true`` |
  32. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  33. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationRegion3D_property_enter_cost>` | ``0.0`` |
  34. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  35. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationRegion3D_property_navigation_layers>` | ``1`` |
  36. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  37. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`navigation_mesh<class_NavigationRegion3D_property_navigation_mesh>` | |
  38. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  39. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationRegion3D_property_travel_cost>` | ``1.0`` |
  40. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  41. | :ref:`bool<class_bool>` | :ref:`use_edge_connections<class_NavigationRegion3D_property_use_edge_connections>` | ``true`` |
  42. +---------------------------------------------+-------------------------------------------------------------------------------------+----------+
  43. .. rst-class:: classref-reftable-group
  44. Methods
  45. -------
  46. .. table::
  47. :widths: auto
  48. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`bake_navigation_mesh<class_NavigationRegion3D_method_bake_navigation_mesh>` **(** :ref:`bool<class_bool>` on_thread=true **)** |
  50. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationRegion3D_method_get_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  52. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationRegion3D_method_get_navigation_map>` **(** **)** |const| |
  54. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`RID<class_RID>` | :ref:`get_region_rid<class_NavigationRegion3D_method_get_region_rid>` **(** **)** |const| |
  56. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`set_navigation_layer_value<class_NavigationRegion3D_method_set_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  58. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`set_navigation_map<class_NavigationRegion3D_method_set_navigation_map>` **(** :ref:`RID<class_RID>` navigation_map **)** |
  60. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. .. rst-class:: classref-section-separator
  62. ----
  63. .. rst-class:: classref-descriptions-group
  64. Signals
  65. -------
  66. .. _class_NavigationRegion3D_signal_bake_finished:
  67. .. rst-class:: classref-signal
  68. **bake_finished** **(** **)**
  69. Notifies when the navigation mesh bake operation is completed.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_NavigationRegion3D_signal_navigation_mesh_changed:
  73. .. rst-class:: classref-signal
  74. **navigation_mesh_changed** **(** **)**
  75. Notifies when the :ref:`NavigationMesh<class_NavigationMesh>` has changed.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_NavigationRegion3D_property_enabled:
  82. .. rst-class:: classref-property
  83. :ref:`bool<class_bool>` **enabled** = ``true``
  84. .. rst-class:: classref-property-setget
  85. - void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
  86. - :ref:`bool<class_bool>` **is_enabled** **(** **)**
  87. Determines if the **NavigationRegion3D** is enabled or disabled.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_NavigationRegion3D_property_enter_cost:
  91. .. rst-class:: classref-property
  92. :ref:`float<class_float>` **enter_cost** = ``0.0``
  93. .. rst-class:: classref-property-setget
  94. - void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
  95. - :ref:`float<class_float>` **get_enter_cost** **(** **)**
  96. 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.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_NavigationRegion3D_property_navigation_layers:
  100. .. rst-class:: classref-property
  101. :ref:`int<class_int>` **navigation_layers** = ``1``
  102. .. rst-class:: classref-property-setget
  103. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  104. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  105. 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>`.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_NavigationRegion3D_property_navigation_mesh:
  109. .. rst-class:: classref-property
  110. :ref:`NavigationMesh<class_NavigationMesh>` **navigation_mesh**
  111. .. rst-class:: classref-property-setget
  112. - void **set_navigation_mesh** **(** :ref:`NavigationMesh<class_NavigationMesh>` value **)**
  113. - :ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh** **(** **)**
  114. The :ref:`NavigationMesh<class_NavigationMesh>` resource to use.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_NavigationRegion3D_property_travel_cost:
  118. .. rst-class:: classref-property
  119. :ref:`float<class_float>` **travel_cost** = ``1.0``
  120. .. rst-class:: classref-property-setget
  121. - void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
  122. - :ref:`float<class_float>` **get_travel_cost** **(** **)**
  123. 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.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_NavigationRegion3D_property_use_edge_connections:
  127. .. rst-class:: classref-property
  128. :ref:`bool<class_bool>` **use_edge_connections** = ``true``
  129. .. rst-class:: classref-property-setget
  130. - void **set_use_edge_connections** **(** :ref:`bool<class_bool>` value **)**
  131. - :ref:`bool<class_bool>` **get_use_edge_connections** **(** **)**
  132. If enabled the navigation region will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  133. .. rst-class:: classref-section-separator
  134. ----
  135. .. rst-class:: classref-descriptions-group
  136. Method Descriptions
  137. -------------------
  138. .. _class_NavigationRegion3D_method_bake_navigation_mesh:
  139. .. rst-class:: classref-method
  140. void **bake_navigation_mesh** **(** :ref:`bool<class_bool>` on_thread=true **)**
  141. 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).
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_NavigationRegion3D_method_get_navigation_layer_value:
  145. .. rst-class:: classref-method
  146. :ref:`bool<class_bool>` **get_navigation_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  147. 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.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_NavigationRegion3D_method_get_navigation_map:
  151. .. rst-class:: classref-method
  152. :ref:`RID<class_RID>` **get_navigation_map** **(** **)** |const|
  153. Returns the current navigation map :ref:`RID<class_RID>` used by this region.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_NavigationRegion3D_method_get_region_rid:
  157. .. rst-class:: classref-method
  158. :ref:`RID<class_RID>` **get_region_rid** **(** **)** |const|
  159. 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.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_NavigationRegion3D_method_set_navigation_layer_value:
  163. .. rst-class:: classref-method
  164. void **set_navigation_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  165. 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.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_NavigationRegion3D_method_set_navigation_map:
  169. .. rst-class:: classref-method
  170. void **set_navigation_map** **(** :ref:`RID<class_RID>` navigation_map **)**
  171. 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.
  172. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  173. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  174. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  175. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  176. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  177. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  178. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`