class_navigationobstacle3d.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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/NavigationObstacle3D.xml.
  6. .. _class_NavigationObstacle3D:
  7. NavigationObstacle3D
  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. 3D obstacle used to affect navigation mesh baking or constrain velocities of avoidance controlled agents.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. An obstacle needs a navigation map and outline :ref:`vertices<class_NavigationObstacle3D_property_vertices>` defined to work correctly. The outlines can not cross or overlap and are restricted to a plane projection. This means the y-axis of the vertices is ignored, instead the obstacle's global y-axis position is used for placement. The projected shape is extruded by the obstacles height along the y-axis.
  16. Obstacles can be included in the navigation mesh baking process when :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` is enabled. They do not add walkable geometry, instead their role is to discard other source geometry inside the shape. This can be used to prevent navigation mesh from appearing in unwanted places, e.g. inside "solid" geometry or on top of it. If :ref:`carve_navigation_mesh<class_NavigationObstacle3D_property_carve_navigation_mesh>` is enabled the baked shape will not be affected by offsets of the navigation mesh baking, e.g. the agent radius.
  17. With :ref:`avoidance_enabled<class_NavigationObstacle3D_property_avoidance_enabled>` the obstacle can constrain the avoidance velocities of avoidance using agents. If the obstacle's vertices are wound in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Obstacles using vertices and avoidance can warp to a new position but should not be moved every single frame as each change requires a rebuild of the avoidance map.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`Using NavigationObstacles <../tutorials/navigation/navigation_using_navigationobstacles>`
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` | ``false`` |
  29. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  30. | :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationObstacle3D_property_avoidance_enabled>` | ``true`` |
  31. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  32. | :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` | ``1`` |
  33. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`carve_navigation_mesh<class_NavigationObstacle3D_property_carve_navigation_mesh>` | ``false`` |
  35. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  36. | :ref:`float<class_float>` | :ref:`height<class_NavigationObstacle3D_property_height>` | ``1.0`` |
  37. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  38. | :ref:`float<class_float>` | :ref:`radius<class_NavigationObstacle3D_property_radius>` | ``0.0`` |
  39. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`use_3d_avoidance<class_NavigationObstacle3D_property_use_3d_avoidance>` | ``false`` |
  41. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  42. | :ref:`Vector3<class_Vector3>` | :ref:`velocity<class_NavigationObstacle3D_property_velocity>` | ``Vector3(0, 0, 0)`` |
  43. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  44. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`vertices<class_NavigationObstacle3D_property_vertices>` | ``PackedVector3Array()`` |
  45. +-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
  46. .. rst-class:: classref-reftable-group
  47. Methods
  48. -------
  49. .. table::
  50. :widths: auto
  51. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationObstacle3D_method_get_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  53. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationObstacle3D_method_get_navigation_map>`\ (\ ) |const| |
  55. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationObstacle3D_method_get_rid>`\ (\ ) |const| |
  57. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | |void| | :ref:`set_avoidance_layer_value<class_NavigationObstacle3D_method_set_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  59. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | |void| | :ref:`set_navigation_map<class_NavigationObstacle3D_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
  61. +-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Property Descriptions
  66. ---------------------
  67. .. _class_NavigationObstacle3D_property_affect_navigation_mesh:
  68. .. rst-class:: classref-property
  69. :ref:`bool<class_bool>` **affect_navigation_mesh** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_affect_navigation_mesh>`
  70. .. rst-class:: classref-property-setget
  71. - |void| **set_affect_navigation_mesh**\ (\ value\: :ref:`bool<class_bool>`\ )
  72. - :ref:`bool<class_bool>` **get_affect_navigation_mesh**\ (\ )
  73. If enabled and parsed in a navigation mesh baking process the obstacle will discard source geometry inside its :ref:`vertices<class_NavigationObstacle3D_property_vertices>` and :ref:`height<class_NavigationObstacle3D_property_height>` defined shape.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_NavigationObstacle3D_property_avoidance_enabled:
  77. .. rst-class:: classref-property
  78. :ref:`bool<class_bool>` **avoidance_enabled** = ``true`` :ref:`🔗<class_NavigationObstacle3D_property_avoidance_enabled>`
  79. .. rst-class:: classref-property-setget
  80. - |void| **set_avoidance_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  81. - :ref:`bool<class_bool>` **get_avoidance_enabled**\ (\ )
  82. If ``true`` the obstacle affects avoidance using agents.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_NavigationObstacle3D_property_avoidance_layers:
  86. .. rst-class:: classref-property
  87. :ref:`int<class_int>` **avoidance_layers** = ``1`` :ref:`🔗<class_NavigationObstacle3D_property_avoidance_layers>`
  88. .. rst-class:: classref-property-setget
  89. - |void| **set_avoidance_layers**\ (\ value\: :ref:`int<class_int>`\ )
  90. - :ref:`int<class_int>` **get_avoidance_layers**\ (\ )
  91. A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_NavigationObstacle3D_property_carve_navigation_mesh:
  95. .. rst-class:: classref-property
  96. :ref:`bool<class_bool>` **carve_navigation_mesh** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_carve_navigation_mesh>`
  97. .. rst-class:: classref-property-setget
  98. - |void| **set_carve_navigation_mesh**\ (\ value\: :ref:`bool<class_bool>`\ )
  99. - :ref:`bool<class_bool>` **get_carve_navigation_mesh**\ (\ )
  100. If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).
  101. It will still be affected by further postprocessing of the baking process, like edge and polygon simplification.
  102. Requires :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` to be enabled.
  103. .. rst-class:: classref-item-separator
  104. ----
  105. .. _class_NavigationObstacle3D_property_height:
  106. .. rst-class:: classref-property
  107. :ref:`float<class_float>` **height** = ``1.0`` :ref:`🔗<class_NavigationObstacle3D_property_height>`
  108. .. rst-class:: classref-property-setget
  109. - |void| **set_height**\ (\ value\: :ref:`float<class_float>`\ )
  110. - :ref:`float<class_float>` **get_height**\ (\ )
  111. Sets the obstacle height used in 2D avoidance. 2D avoidance using agent's ignore obstacles that are below or above them.
  112. .. rst-class:: classref-item-separator
  113. ----
  114. .. _class_NavigationObstacle3D_property_radius:
  115. .. rst-class:: classref-property
  116. :ref:`float<class_float>` **radius** = ``0.0`` :ref:`🔗<class_NavigationObstacle3D_property_radius>`
  117. .. rst-class:: classref-property-setget
  118. - |void| **set_radius**\ (\ value\: :ref:`float<class_float>`\ )
  119. - :ref:`float<class_float>` **get_radius**\ (\ )
  120. Sets the avoidance radius for the obstacle.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_NavigationObstacle3D_property_use_3d_avoidance:
  124. .. rst-class:: classref-property
  125. :ref:`bool<class_bool>` **use_3d_avoidance** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_use_3d_avoidance>`
  126. .. rst-class:: classref-property-setget
  127. - |void| **set_use_3d_avoidance**\ (\ value\: :ref:`bool<class_bool>`\ )
  128. - :ref:`bool<class_bool>` **get_use_3d_avoidance**\ (\ )
  129. If ``true`` the obstacle affects 3D avoidance using agent's with obstacle :ref:`radius<class_NavigationObstacle3D_property_radius>`.
  130. If ``false`` the obstacle affects 2D avoidance using agent's with both obstacle :ref:`vertices<class_NavigationObstacle3D_property_vertices>` as well as obstacle :ref:`radius<class_NavigationObstacle3D_property_radius>`.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_NavigationObstacle3D_property_velocity:
  134. .. rst-class:: classref-property
  135. :ref:`Vector3<class_Vector3>` **velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationObstacle3D_property_velocity>`
  136. .. rst-class:: classref-property-setget
  137. - |void| **set_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  138. - :ref:`Vector3<class_Vector3>` **get_velocity**\ (\ )
  139. Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles :ref:`radius<class_NavigationObstacle3D_property_radius>`. Does nothing for the obstacles static vertices.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_NavigationObstacle3D_property_vertices:
  143. .. rst-class:: classref-property
  144. :ref:`PackedVector3Array<class_PackedVector3Array>` **vertices** = ``PackedVector3Array()`` :ref:`🔗<class_NavigationObstacle3D_property_vertices>`
  145. .. rst-class:: classref-property-setget
  146. - |void| **set_vertices**\ (\ value\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ )
  147. - :ref:`PackedVector3Array<class_PackedVector3Array>` **get_vertices**\ (\ )
  148. The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle.
  149. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector3Array<class_PackedVector3Array>` for more details.
  150. .. rst-class:: classref-section-separator
  151. ----
  152. .. rst-class:: classref-descriptions-group
  153. Method Descriptions
  154. -------------------
  155. .. _class_NavigationObstacle3D_method_get_avoidance_layer_value:
  156. .. rst-class:: classref-method
  157. :ref:`bool<class_bool>` **get_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_avoidance_layer_value>`
  158. Returns whether or not the specified layer of the :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_NavigationObstacle3D_method_get_navigation_map:
  162. .. rst-class:: classref-method
  163. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_navigation_map>`
  164. Returns the :ref:`RID<class_RID>` of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use :ref:`set_navigation_map<class_NavigationObstacle3D_method_set_navigation_map>` to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_NavigationObstacle3D_method_get_rid:
  168. .. rst-class:: classref-method
  169. :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_rid>`
  170. Returns the :ref:`RID<class_RID>` of this obstacle on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_NavigationObstacle3D_method_set_avoidance_layer_value:
  174. .. rst-class:: classref-method
  175. |void| **set_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationObstacle3D_method_set_avoidance_layer_value>`
  176. Based on ``value``, enables or disables the specified layer in the :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` bitmask, given a ``layer_number`` between 1 and 32.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_NavigationObstacle3D_method_set_navigation_map:
  180. .. rst-class:: classref-method
  181. |void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_NavigationObstacle3D_method_set_navigation_map>`
  182. Sets the :ref:`RID<class_RID>` of the navigation map this NavigationObstacle node should use and also updates the ``obstacle`` on the NavigationServer.
  183. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  184. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  185. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  186. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  187. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  188. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  189. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  190. .. |void| replace:: :abbr:`void (No return value.)`