class_navigationobstacle3d.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. 3D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 3D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area. The obstacle needs a navigation map and outline vertices defined to work correctly.
  15. If the obstacle's vertices are winded in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Outlines must not cross or overlap.
  16. Obstacles are **not** a replacement for a (re)baked navigation mesh. Obstacles **don't** change the resulting path from the pathfinding, obstacles only affect the navigation avoidance agent movement by altering the suggested velocity of the avoidance agent.
  17. Obstacles using vertices can warp to a new position but should not moved every frame as each move 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:`avoidance_enabled<class_NavigationObstacle3D_property_avoidance_enabled>` | ``true`` |
  29. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  30. | :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` | ``1`` |
  31. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  32. | :ref:`float<class_float>` | :ref:`height<class_NavigationObstacle3D_property_height>` | ``1.0`` |
  33. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  34. | :ref:`float<class_float>` | :ref:`radius<class_NavigationObstacle3D_property_radius>` | ``0.0`` |
  35. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  36. | :ref:`bool<class_bool>` | :ref:`use_3d_avoidance<class_NavigationObstacle3D_property_use_3d_avoidance>` | ``false`` |
  37. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  38. | :ref:`Vector3<class_Vector3>` | :ref:`velocity<class_NavigationObstacle3D_property_velocity>` | ``Vector3(0, 0, 0)`` |
  39. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  40. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`vertices<class_NavigationObstacle3D_property_vertices>` | ``PackedVector3Array()`` |
  41. +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
  42. .. rst-class:: classref-reftable-group
  43. Methods
  44. -------
  45. .. table::
  46. :widths: auto
  47. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationObstacle3D_method_get_avoidance_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  49. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationObstacle3D_method_get_navigation_map>` **(** **)** |const| |
  51. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationObstacle3D_method_get_rid>` **(** **)** |const| |
  53. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_avoidance_layer_value<class_NavigationObstacle3D_method_set_avoidance_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  55. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_navigation_map<class_NavigationObstacle3D_method_set_navigation_map>` **(** :ref:`RID<class_RID>` navigation_map **)** |
  57. +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. .. rst-class:: classref-section-separator
  59. ----
  60. .. rst-class:: classref-descriptions-group
  61. Property Descriptions
  62. ---------------------
  63. .. _class_NavigationObstacle3D_property_avoidance_enabled:
  64. .. rst-class:: classref-property
  65. :ref:`bool<class_bool>` **avoidance_enabled** = ``true``
  66. .. rst-class:: classref-property-setget
  67. - void **set_avoidance_enabled** **(** :ref:`bool<class_bool>` value **)**
  68. - :ref:`bool<class_bool>` **get_avoidance_enabled** **(** **)**
  69. If ``true`` the obstacle affects avoidance using agents.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_NavigationObstacle3D_property_avoidance_layers:
  73. .. rst-class:: classref-property
  74. :ref:`int<class_int>` **avoidance_layers** = ``1``
  75. .. rst-class:: classref-property-setget
  76. - void **set_avoidance_layers** **(** :ref:`int<class_int>` value **)**
  77. - :ref:`int<class_int>` **get_avoidance_layers** **(** **)**
  78. A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_NavigationObstacle3D_property_height:
  82. .. rst-class:: classref-property
  83. :ref:`float<class_float>` **height** = ``1.0``
  84. .. rst-class:: classref-property-setget
  85. - void **set_height** **(** :ref:`float<class_float>` value **)**
  86. - :ref:`float<class_float>` **get_height** **(** **)**
  87. Sets the obstacle height used in 2D avoidance. 2D avoidance using agent's ignore obstacles that are below or above them.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_NavigationObstacle3D_property_radius:
  91. .. rst-class:: classref-property
  92. :ref:`float<class_float>` **radius** = ``0.0``
  93. .. rst-class:: classref-property-setget
  94. - void **set_radius** **(** :ref:`float<class_float>` value **)**
  95. - :ref:`float<class_float>` **get_radius** **(** **)**
  96. Sets the avoidance radius for the obstacle.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_NavigationObstacle3D_property_use_3d_avoidance:
  100. .. rst-class:: classref-property
  101. :ref:`bool<class_bool>` **use_3d_avoidance** = ``false``
  102. .. rst-class:: classref-property-setget
  103. - void **set_use_3d_avoidance** **(** :ref:`bool<class_bool>` value **)**
  104. - :ref:`bool<class_bool>` **get_use_3d_avoidance** **(** **)**
  105. If ``true`` the obstacle affects 3D avoidance using agent's with obstacle :ref:`radius<class_NavigationObstacle3D_property_radius>`.
  106. 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>`.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_NavigationObstacle3D_property_velocity:
  110. .. rst-class:: classref-property
  111. :ref:`Vector3<class_Vector3>` **velocity** = ``Vector3(0, 0, 0)``
  112. .. rst-class:: classref-property-setget
  113. - void **set_velocity** **(** :ref:`Vector3<class_Vector3>` value **)**
  114. - :ref:`Vector3<class_Vector3>` **get_velocity** **(** **)**
  115. 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.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_NavigationObstacle3D_property_vertices:
  119. .. rst-class:: classref-property
  120. :ref:`PackedVector3Array<class_PackedVector3Array>` **vertices** = ``PackedVector3Array()``
  121. .. rst-class:: classref-property-setget
  122. - void **set_vertices** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` value **)**
  123. - :ref:`PackedVector3Array<class_PackedVector3Array>` **get_vertices** **(** **)**
  124. 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.
  125. .. rst-class:: classref-section-separator
  126. ----
  127. .. rst-class:: classref-descriptions-group
  128. Method Descriptions
  129. -------------------
  130. .. _class_NavigationObstacle3D_method_get_avoidance_layer_value:
  131. .. rst-class:: classref-method
  132. :ref:`bool<class_bool>` **get_avoidance_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  133. 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.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_NavigationObstacle3D_method_get_navigation_map:
  137. .. rst-class:: classref-method
  138. :ref:`RID<class_RID>` **get_navigation_map** **(** **)** |const|
  139. 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.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_NavigationObstacle3D_method_get_rid:
  143. .. rst-class:: classref-method
  144. :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
  145. Returns the :ref:`RID<class_RID>` of this obstacle on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_NavigationObstacle3D_method_set_avoidance_layer_value:
  149. .. rst-class:: classref-method
  150. void **set_avoidance_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  151. 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.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_NavigationObstacle3D_method_set_navigation_map:
  155. .. rst-class:: classref-method
  156. void **set_navigation_map** **(** :ref:`RID<class_RID>` navigation_map **)**
  157. Sets the :ref:`RID<class_RID>` of the navigation map this NavigationObstacle node should use and also updates the ``obstacle`` on the NavigationServer.
  158. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  159. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  160. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  161. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  162. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  163. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  164. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`