class_navigationagent3d.rst 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017
  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/NavigationAgent3D.xml.
  6. .. _class_NavigationAgent3D:
  7. NavigationAgent3D
  8. =================
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. A 3D agent used to pathfind to a position while avoiding obstacles.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. A 3D agent used to pathfind to a position while avoiding static and dynamic obstacles. The calculation can be used by the parent node to dynamically move it along the path. Requires navigation data to work correctly.
  16. Dynamic obstacles are avoided using RVO collision avoidance. Avoidance is computed before physics, so the pathfinding information can be used safely in the physics step.
  17. \ **Note:** After setting the :ref:`target_position<class_NavigationAgent3D_property_target_position>` property, the :ref:`get_next_path_position()<class_NavigationAgent3D_method_get_next_path_position>` method must be used once every physics frame to update the internal path logic of the navigation agent. The vector position it returns should be used as the next movement position for the agent's parent node.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`Using NavigationAgents <../tutorials/navigation/navigation_using_navigationagents>`
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  28. | :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationAgent3D_property_avoidance_enabled>` | ``false`` |
  29. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  30. | :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationAgent3D_property_avoidance_layers>` | ``1`` |
  31. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  32. | :ref:`int<class_int>` | :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` | ``1`` |
  33. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  34. | :ref:`float<class_float>` | :ref:`avoidance_priority<class_NavigationAgent3D_property_avoidance_priority>` | ``1.0`` |
  35. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  36. | :ref:`bool<class_bool>` | :ref:`debug_enabled<class_NavigationAgent3D_property_debug_enabled>` | ``false`` |
  37. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  38. | :ref:`Color<class_Color>` | :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` | ``Color(1, 1, 1, 1)`` |
  39. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  40. | :ref:`float<class_float>` | :ref:`debug_path_custom_point_size<class_NavigationAgent3D_property_debug_path_custom_point_size>` | ``4.0`` |
  41. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  42. | :ref:`bool<class_bool>` | :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` | ``false`` |
  43. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  44. | :ref:`float<class_float>` | :ref:`height<class_NavigationAgent3D_property_height>` | ``1.0`` |
  45. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  46. | :ref:`bool<class_bool>` | :ref:`keep_y_velocity<class_NavigationAgent3D_property_keep_y_velocity>` | ``true`` |
  47. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  48. | :ref:`int<class_int>` | :ref:`max_neighbors<class_NavigationAgent3D_property_max_neighbors>` | ``10`` |
  49. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  50. | :ref:`float<class_float>` | :ref:`max_speed<class_NavigationAgent3D_property_max_speed>` | ``10.0`` |
  51. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  52. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationAgent3D_property_navigation_layers>` | ``1`` |
  53. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  54. | :ref:`float<class_float>` | :ref:`neighbor_distance<class_NavigationAgent3D_property_neighbor_distance>` | ``50.0`` |
  55. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  56. | :ref:`float<class_float>` | :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` | ``1.0`` |
  57. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  58. | :ref:`float<class_float>` | :ref:`path_height_offset<class_NavigationAgent3D_property_path_height_offset>` | ``0.0`` |
  59. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  60. | :ref:`float<class_float>` | :ref:`path_max_distance<class_NavigationAgent3D_property_path_max_distance>` | ``5.0`` |
  61. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  62. | |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] | :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>` | ``7`` |
  63. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  64. | :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` | :ref:`path_postprocessing<class_NavigationAgent3D_property_path_postprocessing>` | ``0`` |
  65. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  66. | :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` | :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>` | ``0`` |
  67. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  68. | :ref:`float<class_float>` | :ref:`radius<class_NavigationAgent3D_property_radius>` | ``0.5`` |
  69. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  70. | :ref:`float<class_float>` | :ref:`simplify_epsilon<class_NavigationAgent3D_property_simplify_epsilon>` | ``0.0`` |
  71. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  72. | :ref:`bool<class_bool>` | :ref:`simplify_path<class_NavigationAgent3D_property_simplify_path>` | ``false`` |
  73. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  74. | :ref:`float<class_float>` | :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` | ``1.0`` |
  75. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  76. | :ref:`Vector3<class_Vector3>` | :ref:`target_position<class_NavigationAgent3D_property_target_position>` | ``Vector3(0, 0, 0)`` |
  77. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  78. | :ref:`float<class_float>` | :ref:`time_horizon_agents<class_NavigationAgent3D_property_time_horizon_agents>` | ``1.0`` |
  79. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  80. | :ref:`float<class_float>` | :ref:`time_horizon_obstacles<class_NavigationAgent3D_property_time_horizon_obstacles>` | ``0.0`` |
  81. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  82. | :ref:`bool<class_bool>` | :ref:`use_3d_avoidance<class_NavigationAgent3D_property_use_3d_avoidance>` | ``false`` |
  83. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  84. | :ref:`Vector3<class_Vector3>` | :ref:`velocity<class_NavigationAgent3D_property_velocity>` | ``Vector3(0, 0, 0)`` |
  85. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  86. .. rst-class:: classref-reftable-group
  87. Methods
  88. -------
  89. .. table::
  90. :widths: auto
  91. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`float<class_float>` | :ref:`distance_to_target<class_NavigationAgent3D_method_distance_to_target>`\ (\ ) |const| |
  93. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationAgent3D_method_get_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  95. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`bool<class_bool>` | :ref:`get_avoidance_mask_value<class_NavigationAgent3D_method_get_avoidance_mask_value>`\ (\ mask_number\: :ref:`int<class_int>`\ ) |const| |
  97. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_current_navigation_path<class_NavigationAgent3D_method_get_current_navigation_path>`\ (\ ) |const| |
  99. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`int<class_int>` | :ref:`get_current_navigation_path_index<class_NavigationAgent3D_method_get_current_navigation_path_index>`\ (\ ) |const| |
  101. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` | :ref:`get_current_navigation_result<class_NavigationAgent3D_method_get_current_navigation_result>`\ (\ ) |const| |
  103. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`Vector3<class_Vector3>` | :ref:`get_final_position<class_NavigationAgent3D_method_get_final_position>`\ (\ ) |
  105. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationAgent3D_method_get_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  107. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationAgent3D_method_get_navigation_map>`\ (\ ) |const| |
  109. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`Vector3<class_Vector3>` | :ref:`get_next_path_position<class_NavigationAgent3D_method_get_next_path_position>`\ (\ ) |
  111. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationAgent3D_method_get_rid>`\ (\ ) |const| |
  113. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`bool<class_bool>` | :ref:`is_navigation_finished<class_NavigationAgent3D_method_is_navigation_finished>`\ (\ ) |
  115. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`bool<class_bool>` | :ref:`is_target_reachable<class_NavigationAgent3D_method_is_target_reachable>`\ (\ ) |
  117. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`bool<class_bool>` | :ref:`is_target_reached<class_NavigationAgent3D_method_is_target_reached>`\ (\ ) |const| |
  119. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | |void| | :ref:`set_avoidance_layer_value<class_NavigationAgent3D_method_set_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  121. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | |void| | :ref:`set_avoidance_mask_value<class_NavigationAgent3D_method_set_avoidance_mask_value>`\ (\ mask_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  123. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | |void| | :ref:`set_navigation_layer_value<class_NavigationAgent3D_method_set_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  125. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | |void| | :ref:`set_navigation_map<class_NavigationAgent3D_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
  127. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | |void| | :ref:`set_velocity_forced<class_NavigationAgent3D_method_set_velocity_forced>`\ (\ velocity\: :ref:`Vector3<class_Vector3>`\ ) |
  129. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. .. rst-class:: classref-section-separator
  131. ----
  132. .. rst-class:: classref-descriptions-group
  133. Signals
  134. -------
  135. .. _class_NavigationAgent3D_signal_link_reached:
  136. .. rst-class:: classref-signal
  137. **link_reached**\ (\ details\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_link_reached>`
  138. Signals that the agent reached a navigation link. Emitted when the agent moves within :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` of the next position of the path when that position is a navigation link.
  139. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  140. - ``position``: The start position of the link that was reached.
  141. - ``type``: Always :ref:`NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK<class_NavigationPathQueryResult3D_constant_PATH_SEGMENT_TYPE_LINK>`.
  142. - ``rid``: The :ref:`RID<class_RID>` of the link.
  143. - ``owner``: The object which manages the link (usually :ref:`NavigationLink3D<class_NavigationLink3D>`).
  144. - ``link_entry_position``: If ``owner`` is available and the owner is a :ref:`NavigationLink3D<class_NavigationLink3D>`, it will contain the global position of the link's point the agent is entering.
  145. - ``link_exit_position``: If ``owner`` is available and the owner is a :ref:`NavigationLink3D<class_NavigationLink3D>`, it will contain the global position of the link's point which the agent is exiting.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_NavigationAgent3D_signal_navigation_finished:
  149. .. rst-class:: classref-signal
  150. **navigation_finished**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_navigation_finished>`
  151. Signals that the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached. This signal is emitted only once per loaded path.
  152. This signal will be emitted just after :ref:`target_reached<class_NavigationAgent3D_signal_target_reached>` when the target is reachable.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_NavigationAgent3D_signal_path_changed:
  156. .. rst-class:: classref-signal
  157. **path_changed**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_path_changed>`
  158. Emitted when the agent had to update the loaded path:
  159. - because path was previously empty.
  160. - because navigation map has changed.
  161. - because agent pushed further away from the current path segment than the :ref:`path_max_distance<class_NavigationAgent3D_property_path_max_distance>`.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_NavigationAgent3D_signal_target_reached:
  165. .. rst-class:: classref-signal
  166. **target_reached**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_target_reached>`
  167. Signals that the agent reached the target, i.e. the agent moved within :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` of the :ref:`target_position<class_NavigationAgent3D_property_target_position>`. This signal is emitted only once per loaded path.
  168. This signal will be emitted just before :ref:`navigation_finished<class_NavigationAgent3D_signal_navigation_finished>` when the target is reachable.
  169. It may not always be possible to reach the target but it should always be possible to reach the final position. See :ref:`get_final_position()<class_NavigationAgent3D_method_get_final_position>`.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_NavigationAgent3D_signal_velocity_computed:
  173. .. rst-class:: classref-signal
  174. **velocity_computed**\ (\ safe_velocity\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_velocity_computed>`
  175. Notifies when the collision avoidance velocity is calculated. Emitted every update as long as :ref:`avoidance_enabled<class_NavigationAgent3D_property_avoidance_enabled>` is ``true`` and the agent has a navigation map.
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_NavigationAgent3D_signal_waypoint_reached:
  179. .. rst-class:: classref-signal
  180. **waypoint_reached**\ (\ details\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_waypoint_reached>`
  181. Signals that the agent reached a waypoint. Emitted when the agent moves within :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` of the next position of the path.
  182. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  183. - ``position``: The position of the waypoint that was reached.
  184. - ``type``: The type of navigation primitive (region or link) that contains this waypoint.
  185. - ``rid``: The :ref:`RID<class_RID>` of the containing navigation primitive (region or link).
  186. - ``owner``: The object which manages the containing navigation primitive (region or link).
  187. .. rst-class:: classref-section-separator
  188. ----
  189. .. rst-class:: classref-descriptions-group
  190. Property Descriptions
  191. ---------------------
  192. .. _class_NavigationAgent3D_property_avoidance_enabled:
  193. .. rst-class:: classref-property
  194. :ref:`bool<class_bool>` **avoidance_enabled** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_enabled>`
  195. .. rst-class:: classref-property-setget
  196. - |void| **set_avoidance_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  197. - :ref:`bool<class_bool>` **get_avoidance_enabled**\ (\ )
  198. If ``true`` the agent is registered for an RVO avoidance callback on the :ref:`NavigationServer3D<class_NavigationServer3D>`. When :ref:`velocity<class_NavigationAgent3D_property_velocity>` is set and the processing is completed a ``safe_velocity`` Vector3 is received with a signal connection to :ref:`velocity_computed<class_NavigationAgent3D_signal_velocity_computed>`. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it.
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_NavigationAgent3D_property_avoidance_layers:
  202. .. rst-class:: classref-property
  203. :ref:`int<class_int>` **avoidance_layers** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_layers>`
  204. .. rst-class:: classref-property-setget
  205. - |void| **set_avoidance_layers**\ (\ value\: :ref:`int<class_int>`\ )
  206. - :ref:`int<class_int>` **get_avoidance_layers**\ (\ )
  207. A bitfield determining the avoidance layers for this NavigationAgent. Other agents with a matching bit on the :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` will avoid this agent.
  208. .. rst-class:: classref-item-separator
  209. ----
  210. .. _class_NavigationAgent3D_property_avoidance_mask:
  211. .. rst-class:: classref-property
  212. :ref:`int<class_int>` **avoidance_mask** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_mask>`
  213. .. rst-class:: classref-property-setget
  214. - |void| **set_avoidance_mask**\ (\ value\: :ref:`int<class_int>`\ )
  215. - :ref:`int<class_int>` **get_avoidance_mask**\ (\ )
  216. A bitfield determining what other avoidance agents and obstacles this NavigationAgent will avoid when a bit matches at least one of their :ref:`avoidance_layers<class_NavigationAgent3D_property_avoidance_layers>`.
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_NavigationAgent3D_property_avoidance_priority:
  220. .. rst-class:: classref-property
  221. :ref:`float<class_float>` **avoidance_priority** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_priority>`
  222. .. rst-class:: classref-property-setget
  223. - |void| **set_avoidance_priority**\ (\ value\: :ref:`float<class_float>`\ )
  224. - :ref:`float<class_float>` **get_avoidance_priority**\ (\ )
  225. The agent does not adjust the velocity for other agents that would match the :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` but have a lower :ref:`avoidance_priority<class_NavigationAgent3D_property_avoidance_priority>`. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent.
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_NavigationAgent3D_property_debug_enabled:
  229. .. rst-class:: classref-property
  230. :ref:`bool<class_bool>` **debug_enabled** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_debug_enabled>`
  231. .. rst-class:: classref-property-setget
  232. - |void| **set_debug_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  233. - :ref:`bool<class_bool>` **get_debug_enabled**\ (\ )
  234. If ``true`` shows debug visuals for this agent.
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_NavigationAgent3D_property_debug_path_custom_color:
  238. .. rst-class:: classref-property
  239. :ref:`Color<class_Color>` **debug_path_custom_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_NavigationAgent3D_property_debug_path_custom_color>`
  240. .. rst-class:: classref-property-setget
  241. - |void| **set_debug_path_custom_color**\ (\ value\: :ref:`Color<class_Color>`\ )
  242. - :ref:`Color<class_Color>` **get_debug_path_custom_color**\ (\ )
  243. If :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` is ``true`` uses this color for this agent instead of global color.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_NavigationAgent3D_property_debug_path_custom_point_size:
  247. .. rst-class:: classref-property
  248. :ref:`float<class_float>` **debug_path_custom_point_size** = ``4.0`` :ref:`🔗<class_NavigationAgent3D_property_debug_path_custom_point_size>`
  249. .. rst-class:: classref-property-setget
  250. - |void| **set_debug_path_custom_point_size**\ (\ value\: :ref:`float<class_float>`\ )
  251. - :ref:`float<class_float>` **get_debug_path_custom_point_size**\ (\ )
  252. If :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` is ``true`` uses this rasterized point size for rendering path points for this agent instead of global point size.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_NavigationAgent3D_property_debug_use_custom:
  256. .. rst-class:: classref-property
  257. :ref:`bool<class_bool>` **debug_use_custom** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_debug_use_custom>`
  258. .. rst-class:: classref-property-setget
  259. - |void| **set_debug_use_custom**\ (\ value\: :ref:`bool<class_bool>`\ )
  260. - :ref:`bool<class_bool>` **get_debug_use_custom**\ (\ )
  261. If ``true`` uses the defined :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` for this agent instead of global color.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_NavigationAgent3D_property_height:
  265. .. rst-class:: classref-property
  266. :ref:`float<class_float>` **height** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_height>`
  267. .. rst-class:: classref-property-setget
  268. - |void| **set_height**\ (\ value\: :ref:`float<class_float>`\ )
  269. - :ref:`float<class_float>` **get_height**\ (\ )
  270. The height of the avoidance agent. Agents will ignore other agents or obstacles that are above or below their current position + height in 2D avoidance. Does nothing in 3D avoidance which uses radius spheres alone.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_NavigationAgent3D_property_keep_y_velocity:
  274. .. rst-class:: classref-property
  275. :ref:`bool<class_bool>` **keep_y_velocity** = ``true`` :ref:`🔗<class_NavigationAgent3D_property_keep_y_velocity>`
  276. .. rst-class:: classref-property-setget
  277. - |void| **set_keep_y_velocity**\ (\ value\: :ref:`bool<class_bool>`\ )
  278. - :ref:`bool<class_bool>` **get_keep_y_velocity**\ (\ )
  279. If ``true``, and the agent uses 2D avoidance, it will remember the set y-axis velocity and reapply it after the avoidance step. While 2D avoidance has no y-axis and simulates on a flat plane this setting can help to soften the most obvious clipping on uneven 3D geometry.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_NavigationAgent3D_property_max_neighbors:
  283. .. rst-class:: classref-property
  284. :ref:`int<class_int>` **max_neighbors** = ``10`` :ref:`🔗<class_NavigationAgent3D_property_max_neighbors>`
  285. .. rst-class:: classref-property-setget
  286. - |void| **set_max_neighbors**\ (\ value\: :ref:`int<class_int>`\ )
  287. - :ref:`int<class_int>` **get_max_neighbors**\ (\ )
  288. The maximum number of neighbors for the agent to consider.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_NavigationAgent3D_property_max_speed:
  292. .. rst-class:: classref-property
  293. :ref:`float<class_float>` **max_speed** = ``10.0`` :ref:`🔗<class_NavigationAgent3D_property_max_speed>`
  294. .. rst-class:: classref-property-setget
  295. - |void| **set_max_speed**\ (\ value\: :ref:`float<class_float>`\ )
  296. - :ref:`float<class_float>` **get_max_speed**\ (\ )
  297. The maximum speed that an agent can move.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_NavigationAgent3D_property_navigation_layers:
  301. .. rst-class:: classref-property
  302. :ref:`int<class_int>` **navigation_layers** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_navigation_layers>`
  303. .. rst-class:: classref-property-setget
  304. - |void| **set_navigation_layers**\ (\ value\: :ref:`int<class_int>`\ )
  305. - :ref:`int<class_int>` **get_navigation_layers**\ (\ )
  306. A bitfield determining which navigation layers of navigation regions this agent will use to calculate a path. Changing it during runtime will clear the current navigation path and generate a new one, according to the new navigation layers.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_NavigationAgent3D_property_neighbor_distance:
  310. .. rst-class:: classref-property
  311. :ref:`float<class_float>` **neighbor_distance** = ``50.0`` :ref:`🔗<class_NavigationAgent3D_property_neighbor_distance>`
  312. .. rst-class:: classref-property-setget
  313. - |void| **set_neighbor_distance**\ (\ value\: :ref:`float<class_float>`\ )
  314. - :ref:`float<class_float>` **get_neighbor_distance**\ (\ )
  315. The distance to search for other agents.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_NavigationAgent3D_property_path_desired_distance:
  319. .. rst-class:: classref-property
  320. :ref:`float<class_float>` **path_desired_distance** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_path_desired_distance>`
  321. .. rst-class:: classref-property-setget
  322. - |void| **set_path_desired_distance**\ (\ value\: :ref:`float<class_float>`\ )
  323. - :ref:`float<class_float>` **get_path_desired_distance**\ (\ )
  324. The distance threshold before a path point is considered to be reached. This allows agents to not have to hit a path point on the path exactly, but only to reach its general area. If this value is set too high, the NavigationAgent will skip points on the path, which can lead to it leaving the navigation mesh. If this value is set too low, the NavigationAgent will be stuck in a repath loop because it will constantly overshoot the distance to the next point on each physics frame update.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_NavigationAgent3D_property_path_height_offset:
  328. .. rst-class:: classref-property
  329. :ref:`float<class_float>` **path_height_offset** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_path_height_offset>`
  330. .. rst-class:: classref-property-setget
  331. - |void| **set_path_height_offset**\ (\ value\: :ref:`float<class_float>`\ )
  332. - :ref:`float<class_float>` **get_path_height_offset**\ (\ )
  333. The height offset is subtracted from the y-axis value of any vector path position for this NavigationAgent. The NavigationAgent height offset does not change or influence the navigation mesh or pathfinding query result. Additional navigation maps that use regions with navigation meshes that the developer baked with appropriate agent radius or height values are required to support different-sized agents.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_NavigationAgent3D_property_path_max_distance:
  337. .. rst-class:: classref-property
  338. :ref:`float<class_float>` **path_max_distance** = ``5.0`` :ref:`🔗<class_NavigationAgent3D_property_path_max_distance>`
  339. .. rst-class:: classref-property-setget
  340. - |void| **set_path_max_distance**\ (\ value\: :ref:`float<class_float>`\ )
  341. - :ref:`float<class_float>` **get_path_max_distance**\ (\ )
  342. The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_NavigationAgent3D_property_path_metadata_flags:
  346. .. rst-class:: classref-property
  347. |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] **path_metadata_flags** = ``7`` :ref:`🔗<class_NavigationAgent3D_property_path_metadata_flags>`
  348. .. rst-class:: classref-property-setget
  349. - |void| **set_path_metadata_flags**\ (\ value\: |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\]\ )
  350. - |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] **get_path_metadata_flags**\ (\ )
  351. Additional information to return with the navigation path.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_NavigationAgent3D_property_path_postprocessing:
  355. .. rst-class:: classref-property
  356. :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **path_postprocessing** = ``0`` :ref:`🔗<class_NavigationAgent3D_property_path_postprocessing>`
  357. .. rst-class:: classref-property-setget
  358. - |void| **set_path_postprocessing**\ (\ value\: :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>`\ )
  359. - :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **get_path_postprocessing**\ (\ )
  360. The path postprocessing applied to the raw path corridor found by the :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>`.
  361. .. rst-class:: classref-item-separator
  362. ----
  363. .. _class_NavigationAgent3D_property_pathfinding_algorithm:
  364. .. rst-class:: classref-property
  365. :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **pathfinding_algorithm** = ``0`` :ref:`🔗<class_NavigationAgent3D_property_pathfinding_algorithm>`
  366. .. rst-class:: classref-property-setget
  367. - |void| **set_pathfinding_algorithm**\ (\ value\: :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>`\ )
  368. - :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **get_pathfinding_algorithm**\ (\ )
  369. The pathfinding algorithm used in the path query.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_NavigationAgent3D_property_radius:
  373. .. rst-class:: classref-property
  374. :ref:`float<class_float>` **radius** = ``0.5`` :ref:`🔗<class_NavigationAgent3D_property_radius>`
  375. .. rst-class:: classref-property-setget
  376. - |void| **set_radius**\ (\ value\: :ref:`float<class_float>`\ )
  377. - :ref:`float<class_float>` **get_radius**\ (\ )
  378. The radius of the avoidance agent. This is the "body" of the avoidance agent and not the avoidance maneuver starting radius (which is controlled by :ref:`neighbor_distance<class_NavigationAgent3D_property_neighbor_distance>`).
  379. Does not affect normal pathfinding. To change an actor's pathfinding radius bake :ref:`NavigationMesh<class_NavigationMesh>` resources with a different :ref:`NavigationMesh.agent_radius<class_NavigationMesh_property_agent_radius>` property and use different navigation maps for each actor size.
  380. .. rst-class:: classref-item-separator
  381. ----
  382. .. _class_NavigationAgent3D_property_simplify_epsilon:
  383. .. rst-class:: classref-property
  384. :ref:`float<class_float>` **simplify_epsilon** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_simplify_epsilon>`
  385. .. rst-class:: classref-property-setget
  386. - |void| **set_simplify_epsilon**\ (\ value\: :ref:`float<class_float>`\ )
  387. - :ref:`float<class_float>` **get_simplify_epsilon**\ (\ )
  388. The path simplification amount in worlds units.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_NavigationAgent3D_property_simplify_path:
  392. .. rst-class:: classref-property
  393. :ref:`bool<class_bool>` **simplify_path** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_simplify_path>`
  394. .. rst-class:: classref-property-setget
  395. - |void| **set_simplify_path**\ (\ value\: :ref:`bool<class_bool>`\ )
  396. - :ref:`bool<class_bool>` **get_simplify_path**\ (\ )
  397. If ``true`` a simplified version of the path will be returned with less critical path points removed. The simplification amount is controlled by :ref:`simplify_epsilon<class_NavigationAgent3D_property_simplify_epsilon>`. The simplification uses a variant of Ramer-Douglas-Peucker algorithm for curve point decimation.
  398. Path simplification can be helpful to mitigate various path following issues that can arise with certain agent types and script behaviors. E.g. "steering" agents or avoidance in "open fields".
  399. .. rst-class:: classref-item-separator
  400. ----
  401. .. _class_NavigationAgent3D_property_target_desired_distance:
  402. .. rst-class:: classref-property
  403. :ref:`float<class_float>` **target_desired_distance** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_target_desired_distance>`
  404. .. rst-class:: classref-property-setget
  405. - |void| **set_target_desired_distance**\ (\ value\: :ref:`float<class_float>`\ )
  406. - :ref:`float<class_float>` **get_target_desired_distance**\ (\ )
  407. The distance threshold before the target is considered to be reached. On reaching the target, :ref:`target_reached<class_NavigationAgent3D_signal_target_reached>` is emitted and navigation ends (see :ref:`is_navigation_finished()<class_NavigationAgent3D_method_is_navigation_finished>` and :ref:`navigation_finished<class_NavigationAgent3D_signal_navigation_finished>`).
  408. You can make navigation end early by setting this property to a value greater than :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` (navigation will end before reaching the last waypoint).
  409. You can also make navigation end closer to the target than each individual path position by setting this property to a value lower than :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` (navigation won't immediately end when reaching the last waypoint). However, if the value set is too low, the agent will be stuck in a repath loop because it will constantly overshoot the distance to the target on each physics frame update.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_NavigationAgent3D_property_target_position:
  413. .. rst-class:: classref-property
  414. :ref:`Vector3<class_Vector3>` **target_position** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationAgent3D_property_target_position>`
  415. .. rst-class:: classref-property-setget
  416. - |void| **set_target_position**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  417. - :ref:`Vector3<class_Vector3>` **get_target_position**\ (\ )
  418. If set, a new navigation path from the current agent position to the :ref:`target_position<class_NavigationAgent3D_property_target_position>` is requested from the NavigationServer.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_NavigationAgent3D_property_time_horizon_agents:
  422. .. rst-class:: classref-property
  423. :ref:`float<class_float>` **time_horizon_agents** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_time_horizon_agents>`
  424. .. rst-class:: classref-property-setget
  425. - |void| **set_time_horizon_agents**\ (\ value\: :ref:`float<class_float>`\ )
  426. - :ref:`float<class_float>` **get_time_horizon_agents**\ (\ )
  427. The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _class_NavigationAgent3D_property_time_horizon_obstacles:
  431. .. rst-class:: classref-property
  432. :ref:`float<class_float>` **time_horizon_obstacles** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_time_horizon_obstacles>`
  433. .. rst-class:: classref-property-setget
  434. - |void| **set_time_horizon_obstacles**\ (\ value\: :ref:`float<class_float>`\ )
  435. - :ref:`float<class_float>` **get_time_horizon_obstacles**\ (\ )
  436. The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to static avoidance obstacles. The larger the number, the sooner the agent will respond to static avoidance obstacles, but less freedom in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_NavigationAgent3D_property_use_3d_avoidance:
  440. .. rst-class:: classref-property
  441. :ref:`bool<class_bool>` **use_3d_avoidance** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_use_3d_avoidance>`
  442. .. rst-class:: classref-property-setget
  443. - |void| **set_use_3d_avoidance**\ (\ value\: :ref:`bool<class_bool>`\ )
  444. - :ref:`bool<class_bool>` **get_use_3d_avoidance**\ (\ )
  445. If ``true``, the agent calculates avoidance velocities in 3D omnidirectionally, e.g. for games that take place in air, underwater or space. Agents using 3D avoidance only avoid other agents using 3D avoidance, and react to radius-based avoidance obstacles. They ignore any vertex-based obstacles.
  446. If ``false``, the agent calculates avoidance velocities in 2D along the x and z-axes, ignoring the y-axis. Agents using 2D avoidance only avoid other agents using 2D avoidance, and react to radius-based avoidance obstacles or vertex-based avoidance obstacles. Other agents using 2D avoidance that are below or above their current position including :ref:`height<class_NavigationAgent3D_property_height>` are ignored.
  447. .. rst-class:: classref-item-separator
  448. ----
  449. .. _class_NavigationAgent3D_property_velocity:
  450. .. rst-class:: classref-property
  451. :ref:`Vector3<class_Vector3>` **velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationAgent3D_property_velocity>`
  452. .. rst-class:: classref-property-setget
  453. - |void| **set_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  454. - :ref:`Vector3<class_Vector3>` **get_velocity**\ (\ )
  455. Sets the new wanted velocity for the agent. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agents and obstacles. When an agent is teleported to a new position, use :ref:`set_velocity_forced()<class_NavigationAgent3D_method_set_velocity_forced>` as well to reset the internal simulation velocity.
  456. .. rst-class:: classref-section-separator
  457. ----
  458. .. rst-class:: classref-descriptions-group
  459. Method Descriptions
  460. -------------------
  461. .. _class_NavigationAgent3D_method_distance_to_target:
  462. .. rst-class:: classref-method
  463. :ref:`float<class_float>` **distance_to_target**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_distance_to_target>`
  464. Returns the distance to the target position, using the agent's global position. The user must set :ref:`target_position<class_NavigationAgent3D_property_target_position>` in order for this to be accurate.
  465. .. rst-class:: classref-item-separator
  466. ----
  467. .. _class_NavigationAgent3D_method_get_avoidance_layer_value:
  468. .. rst-class:: classref-method
  469. :ref:`bool<class_bool>` **get_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_avoidance_layer_value>`
  470. Returns whether or not the specified layer of the :ref:`avoidance_layers<class_NavigationAgent3D_property_avoidance_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
  471. .. rst-class:: classref-item-separator
  472. ----
  473. .. _class_NavigationAgent3D_method_get_avoidance_mask_value:
  474. .. rst-class:: classref-method
  475. :ref:`bool<class_bool>` **get_avoidance_mask_value**\ (\ mask_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_avoidance_mask_value>`
  476. Returns whether or not the specified mask of the :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` bitmask is enabled, given a ``mask_number`` between 1 and 32.
  477. .. rst-class:: classref-item-separator
  478. ----
  479. .. _class_NavigationAgent3D_method_get_current_navigation_path:
  480. .. rst-class:: classref-method
  481. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_current_navigation_path**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_path>`
  482. Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended :ref:`get_next_path_position()<class_NavigationAgent3D_method_get_next_path_position>` once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic.
  483. .. rst-class:: classref-item-separator
  484. ----
  485. .. _class_NavigationAgent3D_method_get_current_navigation_path_index:
  486. .. rst-class:: classref-method
  487. :ref:`int<class_int>` **get_current_navigation_path_index**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_path_index>`
  488. Returns which index the agent is currently on in the navigation path's :ref:`PackedVector3Array<class_PackedVector3Array>`.
  489. .. rst-class:: classref-item-separator
  490. ----
  491. .. _class_NavigationAgent3D_method_get_current_navigation_result:
  492. .. rst-class:: classref-method
  493. :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` **get_current_navigation_result**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_result>`
  494. Returns the path query result for the path the agent is currently following.
  495. .. rst-class:: classref-item-separator
  496. ----
  497. .. _class_NavigationAgent3D_method_get_final_position:
  498. .. rst-class:: classref-method
  499. :ref:`Vector3<class_Vector3>` **get_final_position**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_get_final_position>`
  500. Returns the reachable final position of the current navigation path in global coordinates. This position can change if the agent needs to update the navigation path which makes the agent emit the :ref:`path_changed<class_NavigationAgent3D_signal_path_changed>` signal.
  501. .. rst-class:: classref-item-separator
  502. ----
  503. .. _class_NavigationAgent3D_method_get_navigation_layer_value:
  504. .. rst-class:: classref-method
  505. :ref:`bool<class_bool>` **get_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_navigation_layer_value>`
  506. Returns whether or not the specified layer of the :ref:`navigation_layers<class_NavigationAgent3D_property_navigation_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
  507. .. rst-class:: classref-item-separator
  508. ----
  509. .. _class_NavigationAgent3D_method_get_navigation_map:
  510. .. rst-class:: classref-method
  511. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_navigation_map>`
  512. Returns the :ref:`RID<class_RID>` of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use :ref:`set_navigation_map()<class_NavigationAgent3D_method_set_navigation_map>` to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer.
  513. .. rst-class:: classref-item-separator
  514. ----
  515. .. _class_NavigationAgent3D_method_get_next_path_position:
  516. .. rst-class:: classref-method
  517. :ref:`Vector3<class_Vector3>` **get_next_path_position**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_get_next_path_position>`
  518. Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent.
  519. .. rst-class:: classref-item-separator
  520. ----
  521. .. _class_NavigationAgent3D_method_get_rid:
  522. .. rst-class:: classref-method
  523. :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_rid>`
  524. Returns the :ref:`RID<class_RID>` of this agent on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  525. .. rst-class:: classref-item-separator
  526. ----
  527. .. _class_NavigationAgent3D_method_is_navigation_finished:
  528. .. rst-class:: classref-method
  529. :ref:`bool<class_bool>` **is_navigation_finished**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_is_navigation_finished>`
  530. Returns ``true`` if the agent's navigation has finished. If the target is reachable, navigation ends when the target is reached. If the target is unreachable, navigation ends when the last waypoint of the path is reached.
  531. \ **Note:** While ``true`` prefer to stop calling update functions like :ref:`get_next_path_position()<class_NavigationAgent3D_method_get_next_path_position>`. This avoids jittering the standing agent due to calling repeated path updates.
  532. .. rst-class:: classref-item-separator
  533. ----
  534. .. _class_NavigationAgent3D_method_is_target_reachable:
  535. .. rst-class:: classref-method
  536. :ref:`bool<class_bool>` **is_target_reachable**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_is_target_reachable>`
  537. Returns ``true`` if :ref:`get_final_position()<class_NavigationAgent3D_method_get_final_position>` is within :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` of the :ref:`target_position<class_NavigationAgent3D_property_target_position>`.
  538. .. rst-class:: classref-item-separator
  539. ----
  540. .. _class_NavigationAgent3D_method_is_target_reached:
  541. .. rst-class:: classref-method
  542. :ref:`bool<class_bool>` **is_target_reached**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_is_target_reached>`
  543. Returns ``true`` if the agent reached the target, i.e. the agent moved within :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` of the :ref:`target_position<class_NavigationAgent3D_property_target_position>`. It may not always be possible to reach the target but it should always be possible to reach the final position. See :ref:`get_final_position()<class_NavigationAgent3D_method_get_final_position>`.
  544. .. rst-class:: classref-item-separator
  545. ----
  546. .. _class_NavigationAgent3D_method_set_avoidance_layer_value:
  547. .. rst-class:: classref-method
  548. |void| **set_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_avoidance_layer_value>`
  549. Based on ``value``, enables or disables the specified layer in the :ref:`avoidance_layers<class_NavigationAgent3D_property_avoidance_layers>` bitmask, given a ``layer_number`` between 1 and 32.
  550. .. rst-class:: classref-item-separator
  551. ----
  552. .. _class_NavigationAgent3D_method_set_avoidance_mask_value:
  553. .. rst-class:: classref-method
  554. |void| **set_avoidance_mask_value**\ (\ mask_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_avoidance_mask_value>`
  555. Based on ``value``, enables or disables the specified mask in the :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` bitmask, given a ``mask_number`` between 1 and 32.
  556. .. rst-class:: classref-item-separator
  557. ----
  558. .. _class_NavigationAgent3D_method_set_navigation_layer_value:
  559. .. rst-class:: classref-method
  560. |void| **set_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_navigation_layer_value>`
  561. Based on ``value``, enables or disables the specified layer in the :ref:`navigation_layers<class_NavigationAgent3D_property_navigation_layers>` bitmask, given a ``layer_number`` between 1 and 32.
  562. .. rst-class:: classref-item-separator
  563. ----
  564. .. _class_NavigationAgent3D_method_set_navigation_map:
  565. .. rst-class:: classref-method
  566. |void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_navigation_map>`
  567. Sets the :ref:`RID<class_RID>` of the navigation map this NavigationAgent node should use and also updates the ``agent`` on the NavigationServer.
  568. .. rst-class:: classref-item-separator
  569. ----
  570. .. _class_NavigationAgent3D_method_set_velocity_forced:
  571. .. rst-class:: classref-method
  572. |void| **set_velocity_forced**\ (\ velocity\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_velocity_forced>`
  573. Replaces the internal velocity in the collision avoidance simulation with ``velocity``. When an agent is teleported to a new position this function should be used in the same frame. If called frequently this function can get agents stuck.
  574. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  575. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  576. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  577. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  578. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  579. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  580. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  581. .. |void| replace:: :abbr:`void (No return value.)`