class_navigationagent3d.rst 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  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/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/NavigationAgent3D.xml.
  6. .. _class_NavigationAgent3D:
  7. NavigationAgent3D
  8. =================
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. 3D Agent used in navigation for collision avoidance.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 3D Agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. **NavigationAgent3D** is physics safe.
  15. \ **Note:** After setting :ref:`target_position<class_NavigationAgent3D_property_target_position>` it is required to use the :ref:`get_next_path_position<class_NavigationAgent3D_method_get_next_path_position>` function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Using NavigationAgents <../tutorials/navigation/navigation_using_navigationagents>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  26. | :ref:`float<class_float>` | :ref:`agent_height_offset<class_NavigationAgent3D_property_agent_height_offset>` | ``0.0`` |
  27. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  28. | :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationAgent3D_property_avoidance_enabled>` | ``false`` |
  29. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  30. | :ref:`bool<class_bool>` | :ref:`debug_enabled<class_NavigationAgent3D_property_debug_enabled>` | ``false`` |
  31. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  32. | :ref:`Color<class_Color>` | :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` | ``Color(1, 1, 1, 1)`` |
  33. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  34. | :ref:`float<class_float>` | :ref:`debug_path_custom_point_size<class_NavigationAgent3D_property_debug_path_custom_point_size>` | ``4.0`` |
  35. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  36. | :ref:`bool<class_bool>` | :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` | ``false`` |
  37. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  38. | :ref:`bool<class_bool>` | :ref:`ignore_y<class_NavigationAgent3D_property_ignore_y>` | ``true`` |
  39. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  40. | :ref:`int<class_int>` | :ref:`max_neighbors<class_NavigationAgent3D_property_max_neighbors>` | ``10`` |
  41. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  42. | :ref:`float<class_float>` | :ref:`max_speed<class_NavigationAgent3D_property_max_speed>` | ``10.0`` |
  43. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  44. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationAgent3D_property_navigation_layers>` | ``1`` |
  45. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  46. | :ref:`float<class_float>` | :ref:`neighbor_distance<class_NavigationAgent3D_property_neighbor_distance>` | ``50.0`` |
  47. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  48. | :ref:`float<class_float>` | :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` | ``1.0`` |
  49. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  50. | :ref:`float<class_float>` | :ref:`path_max_distance<class_NavigationAgent3D_property_path_max_distance>` | ``5.0`` |
  51. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  52. | :ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>` | :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>` | ``7`` |
  53. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  54. | :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` | :ref:`path_postprocessing<class_NavigationAgent3D_property_path_postprocessing>` | ``0`` |
  55. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  56. | :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` | :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>` | ``0`` |
  57. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  58. | :ref:`float<class_float>` | :ref:`radius<class_NavigationAgent3D_property_radius>` | ``0.5`` |
  59. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  60. | :ref:`float<class_float>` | :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` | ``1.0`` |
  61. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  62. | :ref:`Vector3<class_Vector3>` | :ref:`target_position<class_NavigationAgent3D_property_target_position>` | ``Vector3(0, 0, 0)`` |
  63. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  64. | :ref:`float<class_float>` | :ref:`time_horizon<class_NavigationAgent3D_property_time_horizon>` | ``1.0`` |
  65. +----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  66. .. rst-class:: classref-reftable-group
  67. Methods
  68. -------
  69. .. table::
  70. :widths: auto
  71. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`float<class_float>` | :ref:`distance_to_target<class_NavigationAgent3D_method_distance_to_target>` **(** **)** |const| |
  73. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_current_navigation_path<class_NavigationAgent3D_method_get_current_navigation_path>` **(** **)** |const| |
  75. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`int<class_int>` | :ref:`get_current_navigation_path_index<class_NavigationAgent3D_method_get_current_navigation_path_index>` **(** **)** |const| |
  77. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` | :ref:`get_current_navigation_result<class_NavigationAgent3D_method_get_current_navigation_result>` **(** **)** |const| |
  79. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Vector3<class_Vector3>` | :ref:`get_final_position<class_NavigationAgent3D_method_get_final_position>` **(** **)** |
  81. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationAgent3D_method_get_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  83. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationAgent3D_method_get_navigation_map>` **(** **)** |const| |
  85. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`Vector3<class_Vector3>` | :ref:`get_next_path_position<class_NavigationAgent3D_method_get_next_path_position>` **(** **)** |
  87. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationAgent3D_method_get_rid>` **(** **)** |const| |
  89. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`bool<class_bool>` | :ref:`is_navigation_finished<class_NavigationAgent3D_method_is_navigation_finished>` **(** **)** |
  91. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_target_reachable<class_NavigationAgent3D_method_is_target_reachable>` **(** **)** |
  93. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`is_target_reached<class_NavigationAgent3D_method_is_target_reached>` **(** **)** |const| |
  95. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | void | :ref:`set_navigation_layer_value<class_NavigationAgent3D_method_set_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  97. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`set_navigation_map<class_NavigationAgent3D_method_set_navigation_map>` **(** :ref:`RID<class_RID>` navigation_map **)** |
  99. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`set_velocity<class_NavigationAgent3D_method_set_velocity>` **(** :ref:`Vector3<class_Vector3>` velocity **)** |
  101. +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. .. rst-class:: classref-section-separator
  103. ----
  104. .. rst-class:: classref-descriptions-group
  105. Signals
  106. -------
  107. .. _class_NavigationAgent3D_signal_link_reached:
  108. .. rst-class:: classref-signal
  109. **link_reached** **(** :ref:`Dictionary<class_Dictionary>` details **)**
  110. Notifies when a navigation link has been reached.
  111. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  112. - ``position``: The start position of the link that was reached.
  113. - ``type``: Always :ref:`NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK<class_NavigationPathQueryResult3D_constant_PATH_SEGMENT_TYPE_LINK>`.
  114. - ``rid``: The :ref:`RID<class_RID>` of the link.
  115. - ``owner``: The object which manages the link (usually :ref:`NavigationLink3D<class_NavigationLink3D>`).
  116. - ``link_entry_position``: If ``owner`` is available and the owner is a :ref:`NavigationLink2D<class_NavigationLink2D>`, it will contain the global position of the link's point the agent is entering.
  117. - ``link_exit_position``: If ``owner`` is available and the owner is a :ref:`NavigationLink2D<class_NavigationLink2D>`, it will contain the global position of the link's point which the agent is exiting.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_NavigationAgent3D_signal_navigation_finished:
  121. .. rst-class:: classref-signal
  122. **navigation_finished** **(** **)**
  123. Notifies when the final position is reached.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_NavigationAgent3D_signal_path_changed:
  127. .. rst-class:: classref-signal
  128. **path_changed** **(** **)**
  129. Notifies when the navigation path changes.
  130. .. rst-class:: classref-item-separator
  131. ----
  132. .. _class_NavigationAgent3D_signal_target_reached:
  133. .. rst-class:: classref-signal
  134. **target_reached** **(** **)**
  135. Notifies when the player-defined :ref:`target_position<class_NavigationAgent3D_property_target_position>` is reached.
  136. .. rst-class:: classref-item-separator
  137. ----
  138. .. _class_NavigationAgent3D_signal_velocity_computed:
  139. .. rst-class:: classref-signal
  140. **velocity_computed** **(** :ref:`Vector3<class_Vector3>` safe_velocity **)**
  141. Notifies when the collision avoidance velocity is calculated. Emitted at the end of the physics frame in which :ref:`set_velocity<class_NavigationAgent3D_method_set_velocity>` is called. Only emitted when :ref:`avoidance_enabled<class_NavigationAgent3D_property_avoidance_enabled>` is true.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_NavigationAgent3D_signal_waypoint_reached:
  145. .. rst-class:: classref-signal
  146. **waypoint_reached** **(** :ref:`Dictionary<class_Dictionary>` details **)**
  147. Notifies when a waypoint along the path has been reached.
  148. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  149. - ``position``: The position of the waypoint that was reached.
  150. - ``type``: The type of navigation primitive (region or link) that contains this waypoint.
  151. - ``rid``: The :ref:`RID<class_RID>` of the containing navigation primitive (region or link).
  152. - ``owner``: The object which manages the containing navigation primitive (region or link).
  153. .. rst-class:: classref-section-separator
  154. ----
  155. .. rst-class:: classref-descriptions-group
  156. Property Descriptions
  157. ---------------------
  158. .. _class_NavigationAgent3D_property_agent_height_offset:
  159. .. rst-class:: classref-property
  160. :ref:`float<class_float>` **agent_height_offset** = ``0.0``
  161. .. rst-class:: classref-property-setget
  162. - void **set_agent_height_offset** **(** :ref:`float<class_float>` value **)**
  163. - :ref:`float<class_float>` **get_agent_height_offset** **(** **)**
  164. The NavigationAgent 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.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_NavigationAgent3D_property_avoidance_enabled:
  168. .. rst-class:: classref-property
  169. :ref:`bool<class_bool>` **avoidance_enabled** = ``false``
  170. .. rst-class:: classref-property-setget
  171. - void **set_avoidance_enabled** **(** :ref:`bool<class_bool>` value **)**
  172. - :ref:`bool<class_bool>` **get_avoidance_enabled** **(** **)**
  173. If ``true`` the agent is registered for an RVO avoidance callback on the :ref:`NavigationServer3D<class_NavigationServer3D>`. When :ref:`set_velocity<class_NavigationAgent3D_method_set_velocity>` is used 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.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_NavigationAgent3D_property_debug_enabled:
  177. .. rst-class:: classref-property
  178. :ref:`bool<class_bool>` **debug_enabled** = ``false``
  179. .. rst-class:: classref-property-setget
  180. - void **set_debug_enabled** **(** :ref:`bool<class_bool>` value **)**
  181. - :ref:`bool<class_bool>` **get_debug_enabled** **(** **)**
  182. If ``true`` shows debug visuals for this agent.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_NavigationAgent3D_property_debug_path_custom_color:
  186. .. rst-class:: classref-property
  187. :ref:`Color<class_Color>` **debug_path_custom_color** = ``Color(1, 1, 1, 1)``
  188. .. rst-class:: classref-property-setget
  189. - void **set_debug_path_custom_color** **(** :ref:`Color<class_Color>` value **)**
  190. - :ref:`Color<class_Color>` **get_debug_path_custom_color** **(** **)**
  191. If :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` is ``true`` uses this color for this agent instead of global color.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_NavigationAgent3D_property_debug_path_custom_point_size:
  195. .. rst-class:: classref-property
  196. :ref:`float<class_float>` **debug_path_custom_point_size** = ``4.0``
  197. .. rst-class:: classref-property-setget
  198. - void **set_debug_path_custom_point_size** **(** :ref:`float<class_float>` value **)**
  199. - :ref:`float<class_float>` **get_debug_path_custom_point_size** **(** **)**
  200. 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.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_NavigationAgent3D_property_debug_use_custom:
  204. .. rst-class:: classref-property
  205. :ref:`bool<class_bool>` **debug_use_custom** = ``false``
  206. .. rst-class:: classref-property-setget
  207. - void **set_debug_use_custom** **(** :ref:`bool<class_bool>` value **)**
  208. - :ref:`bool<class_bool>` **get_debug_use_custom** **(** **)**
  209. If ``true`` uses the defined :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` for this agent instead of global color.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_NavigationAgent3D_property_ignore_y:
  213. .. rst-class:: classref-property
  214. :ref:`bool<class_bool>` **ignore_y** = ``true``
  215. .. rst-class:: classref-property-setget
  216. - void **set_ignore_y** **(** :ref:`bool<class_bool>` value **)**
  217. - :ref:`bool<class_bool>` **get_ignore_y** **(** **)**
  218. Ignores collisions on the Y axis. Must be true to move on a horizontal plane.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_NavigationAgent3D_property_max_neighbors:
  222. .. rst-class:: classref-property
  223. :ref:`int<class_int>` **max_neighbors** = ``10``
  224. .. rst-class:: classref-property-setget
  225. - void **set_max_neighbors** **(** :ref:`int<class_int>` value **)**
  226. - :ref:`int<class_int>` **get_max_neighbors** **(** **)**
  227. The maximum number of neighbors for the agent to consider.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_NavigationAgent3D_property_max_speed:
  231. .. rst-class:: classref-property
  232. :ref:`float<class_float>` **max_speed** = ``10.0``
  233. .. rst-class:: classref-property-setget
  234. - void **set_max_speed** **(** :ref:`float<class_float>` value **)**
  235. - :ref:`float<class_float>` **get_max_speed** **(** **)**
  236. The maximum speed that an agent can move.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_NavigationAgent3D_property_navigation_layers:
  240. .. rst-class:: classref-property
  241. :ref:`int<class_int>` **navigation_layers** = ``1``
  242. .. rst-class:: classref-property-setget
  243. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  244. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  245. A bitfield determining what navigation layers of navigation regions this agent will use to calculate path. Changing it runtime will clear current navigation path and generate new one, according to new navigation layers.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_NavigationAgent3D_property_neighbor_distance:
  249. .. rst-class:: classref-property
  250. :ref:`float<class_float>` **neighbor_distance** = ``50.0``
  251. .. rst-class:: classref-property-setget
  252. - void **set_neighbor_distance** **(** :ref:`float<class_float>` value **)**
  253. - :ref:`float<class_float>` **get_neighbor_distance** **(** **)**
  254. The distance to search for other agents.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_NavigationAgent3D_property_path_desired_distance:
  258. .. rst-class:: classref-property
  259. :ref:`float<class_float>` **path_desired_distance** = ``1.0``
  260. .. rst-class:: classref-property-setget
  261. - void **set_path_desired_distance** **(** :ref:`float<class_float>` value **)**
  262. - :ref:`float<class_float>` **get_path_desired_distance** **(** **)**
  263. The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_NavigationAgent3D_property_path_max_distance:
  267. .. rst-class:: classref-property
  268. :ref:`float<class_float>` **path_max_distance** = ``5.0``
  269. .. rst-class:: classref-property-setget
  270. - void **set_path_max_distance** **(** :ref:`float<class_float>` value **)**
  271. - :ref:`float<class_float>` **get_path_max_distance** **(** **)**
  272. 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.
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_NavigationAgent3D_property_path_metadata_flags:
  276. .. rst-class:: classref-property
  277. :ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>` **path_metadata_flags** = ``7``
  278. .. rst-class:: classref-property-setget
  279. - void **set_path_metadata_flags** **(** :ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>` value **)**
  280. - :ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>` **get_path_metadata_flags** **(** **)**
  281. Additional information to return with the navigation path.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_NavigationAgent3D_property_path_postprocessing:
  285. .. rst-class:: classref-property
  286. :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **path_postprocessing** = ``0``
  287. .. rst-class:: classref-property-setget
  288. - void **set_path_postprocessing** **(** :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` value **)**
  289. - :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **get_path_postprocessing** **(** **)**
  290. The path postprocessing applied to the raw path corridor found by the :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>`.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_NavigationAgent3D_property_pathfinding_algorithm:
  294. .. rst-class:: classref-property
  295. :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **pathfinding_algorithm** = ``0``
  296. .. rst-class:: classref-property-setget
  297. - void **set_pathfinding_algorithm** **(** :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` value **)**
  298. - :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **get_pathfinding_algorithm** **(** **)**
  299. The pathfinding algorithm used in the path query.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_NavigationAgent3D_property_radius:
  303. .. rst-class:: classref-property
  304. :ref:`float<class_float>` **radius** = ``0.5``
  305. .. rst-class:: classref-property-setget
  306. - void **set_radius** **(** :ref:`float<class_float>` value **)**
  307. - :ref:`float<class_float>` **get_radius** **(** **)**
  308. 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>`).
  309. 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.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_NavigationAgent3D_property_target_desired_distance:
  313. .. rst-class:: classref-property
  314. :ref:`float<class_float>` **target_desired_distance** = ``1.0``
  315. .. rst-class:: classref-property-setget
  316. - void **set_target_desired_distance** **(** :ref:`float<class_float>` value **)**
  317. - :ref:`float<class_float>` **get_target_desired_distance** **(** **)**
  318. The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_NavigationAgent3D_property_target_position:
  322. .. rst-class:: classref-property
  323. :ref:`Vector3<class_Vector3>` **target_position** = ``Vector3(0, 0, 0)``
  324. .. rst-class:: classref-property-setget
  325. - void **set_target_position** **(** :ref:`Vector3<class_Vector3>` value **)**
  326. - :ref:`Vector3<class_Vector3>` **get_target_position** **(** **)**
  327. The user-defined target position. Setting this property will clear the current navigation path.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_NavigationAgent3D_property_time_horizon:
  331. .. rst-class:: classref-property
  332. :ref:`float<class_float>` **time_horizon** = ``1.0``
  333. .. rst-class:: classref-property-setget
  334. - void **set_time_horizon** **(** :ref:`float<class_float>` value **)**
  335. - :ref:`float<class_float>` **get_time_horizon** **(** **)**
  336. 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. Must be positive.
  337. .. rst-class:: classref-section-separator
  338. ----
  339. .. rst-class:: classref-descriptions-group
  340. Method Descriptions
  341. -------------------
  342. .. _class_NavigationAgent3D_method_distance_to_target:
  343. .. rst-class:: classref-method
  344. :ref:`float<class_float>` **distance_to_target** **(** **)** |const|
  345. 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.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_NavigationAgent3D_method_get_current_navigation_path:
  349. .. rst-class:: classref-method
  350. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_current_navigation_path** **(** **)** |const|
  351. 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.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_NavigationAgent3D_method_get_current_navigation_path_index:
  355. .. rst-class:: classref-method
  356. :ref:`int<class_int>` **get_current_navigation_path_index** **(** **)** |const|
  357. Returns which index the agent is currently on in the navigation path's :ref:`PackedVector3Array<class_PackedVector3Array>`.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_NavigationAgent3D_method_get_current_navigation_result:
  361. .. rst-class:: classref-method
  362. :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` **get_current_navigation_result** **(** **)** |const|
  363. Returns the path query result for the path the agent is currently following.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_NavigationAgent3D_method_get_final_position:
  367. .. rst-class:: classref-method
  368. :ref:`Vector3<class_Vector3>` **get_final_position** **(** **)**
  369. Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_NavigationAgent3D_method_get_navigation_layer_value:
  373. .. rst-class:: classref-method
  374. :ref:`bool<class_bool>` **get_navigation_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  375. 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.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _class_NavigationAgent3D_method_get_navigation_map:
  379. .. rst-class:: classref-method
  380. :ref:`RID<class_RID>` **get_navigation_map** **(** **)** |const|
  381. 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.
  382. .. rst-class:: classref-item-separator
  383. ----
  384. .. _class_NavigationAgent3D_method_get_next_path_position:
  385. .. rst-class:: classref-method
  386. :ref:`Vector3<class_Vector3>` **get_next_path_position** **(** **)**
  387. 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.
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_NavigationAgent3D_method_get_rid:
  391. .. rst-class:: classref-method
  392. :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
  393. Returns the :ref:`RID<class_RID>` of this agent on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_NavigationAgent3D_method_is_navigation_finished:
  397. .. rst-class:: classref-method
  398. :ref:`bool<class_bool>` **is_navigation_finished** **(** **)**
  399. Returns true if the navigation path's final position has been reached.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_NavigationAgent3D_method_is_target_reachable:
  403. .. rst-class:: classref-method
  404. :ref:`bool<class_bool>` **is_target_reachable** **(** **)**
  405. Returns true if :ref:`target_position<class_NavigationAgent3D_property_target_position>` is reachable.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_NavigationAgent3D_method_is_target_reached:
  409. .. rst-class:: classref-method
  410. :ref:`bool<class_bool>` **is_target_reached** **(** **)** |const|
  411. Returns true if :ref:`target_position<class_NavigationAgent3D_property_target_position>` is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See :ref:`get_final_position<class_NavigationAgent3D_method_get_final_position>`.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_NavigationAgent3D_method_set_navigation_layer_value:
  415. .. rst-class:: classref-method
  416. void **set_navigation_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  417. 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.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_NavigationAgent3D_method_set_navigation_map:
  421. .. rst-class:: classref-method
  422. void **set_navigation_map** **(** :ref:`RID<class_RID>` navigation_map **)**
  423. Sets the :ref:`RID<class_RID>` of the navigation map this NavigationAgent node should use and also updates the ``agent`` on the NavigationServer.
  424. .. rst-class:: classref-item-separator
  425. ----
  426. .. _class_NavigationAgent3D_method_set_velocity:
  427. .. rst-class:: classref-method
  428. void **set_velocity** **(** :ref:`Vector3<class_Vector3>` velocity **)**
  429. Sends the passed in velocity to the collision avoidance algorithm. It will adjust the velocity to avoid collisions. Once the adjustment to the velocity is complete, it will emit the :ref:`velocity_computed<class_NavigationAgent3D_signal_velocity_computed>` signal.
  430. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  431. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  432. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  433. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  434. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  435. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`