class_navigationagent3d.rst 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112
  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. \ **Note:** Several methods of this class, such as :ref:`get_next_path_position()<class_NavigationAgent3D_method_get_next_path_position>`, can trigger a new path calculation. Calling these in your callback to an agent's signal, such as :ref:`waypoint_reached<class_NavigationAgent3D_signal_waypoint_reached>`, can cause infinite recursion. It is recommended to call these methods in the physics step or, alternatively, delay their call until the end of the frame (see :ref:`Object.call_deferred()<class_Object_method_call_deferred>` or :ref:`Object.CONNECT_DEFERRED<class_Object_constant_CONNECT_DEFERRED>`).
  19. .. rst-class:: classref-introduction-group
  20. Tutorials
  21. ---------
  22. - :doc:`Using NavigationAgents <../tutorials/navigation/navigation_using_navigationagents>`
  23. .. rst-class:: classref-reftable-group
  24. Properties
  25. ----------
  26. .. table::
  27. :widths: auto
  28. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  29. | :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationAgent3D_property_avoidance_enabled>` | ``false`` |
  30. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  31. | :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationAgent3D_property_avoidance_layers>` | ``1`` |
  32. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  33. | :ref:`int<class_int>` | :ref:`avoidance_mask<class_NavigationAgent3D_property_avoidance_mask>` | ``1`` |
  34. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  35. | :ref:`float<class_float>` | :ref:`avoidance_priority<class_NavigationAgent3D_property_avoidance_priority>` | ``1.0`` |
  36. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  37. | :ref:`bool<class_bool>` | :ref:`debug_enabled<class_NavigationAgent3D_property_debug_enabled>` | ``false`` |
  38. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  39. | :ref:`Color<class_Color>` | :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` | ``Color(1, 1, 1, 1)`` |
  40. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  41. | :ref:`float<class_float>` | :ref:`debug_path_custom_point_size<class_NavigationAgent3D_property_debug_path_custom_point_size>` | ``4.0`` |
  42. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  43. | :ref:`bool<class_bool>` | :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` | ``false`` |
  44. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  45. | :ref:`float<class_float>` | :ref:`height<class_NavigationAgent3D_property_height>` | ``1.0`` |
  46. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  47. | :ref:`bool<class_bool>` | :ref:`keep_y_velocity<class_NavigationAgent3D_property_keep_y_velocity>` | ``true`` |
  48. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  49. | :ref:`int<class_int>` | :ref:`max_neighbors<class_NavigationAgent3D_property_max_neighbors>` | ``10`` |
  50. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  51. | :ref:`float<class_float>` | :ref:`max_speed<class_NavigationAgent3D_property_max_speed>` | ``10.0`` |
  52. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  53. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationAgent3D_property_navigation_layers>` | ``1`` |
  54. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  55. | :ref:`float<class_float>` | :ref:`neighbor_distance<class_NavigationAgent3D_property_neighbor_distance>` | ``50.0`` |
  56. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  57. | :ref:`float<class_float>` | :ref:`path_desired_distance<class_NavigationAgent3D_property_path_desired_distance>` | ``1.0`` |
  58. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  59. | :ref:`float<class_float>` | :ref:`path_height_offset<class_NavigationAgent3D_property_path_height_offset>` | ``0.0`` |
  60. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  61. | :ref:`float<class_float>` | :ref:`path_max_distance<class_NavigationAgent3D_property_path_max_distance>` | ``5.0`` |
  62. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  63. | |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] | :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>` | ``7`` |
  64. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  65. | :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` | :ref:`path_postprocessing<class_NavigationAgent3D_property_path_postprocessing>` | ``0`` |
  66. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  67. | :ref:`float<class_float>` | :ref:`path_return_max_length<class_NavigationAgent3D_property_path_return_max_length>` | ``0.0`` |
  68. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  69. | :ref:`float<class_float>` | :ref:`path_return_max_radius<class_NavigationAgent3D_property_path_return_max_radius>` | ``0.0`` |
  70. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  71. | :ref:`float<class_float>` | :ref:`path_search_max_distance<class_NavigationAgent3D_property_path_search_max_distance>` | ``0.0`` |
  72. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  73. | :ref:`int<class_int>` | :ref:`path_search_max_polygons<class_NavigationAgent3D_property_path_search_max_polygons>` | ``4096`` |
  74. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  75. | :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` | :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>` | ``0`` |
  76. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  77. | :ref:`float<class_float>` | :ref:`radius<class_NavigationAgent3D_property_radius>` | ``0.5`` |
  78. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  79. | :ref:`float<class_float>` | :ref:`simplify_epsilon<class_NavigationAgent3D_property_simplify_epsilon>` | ``0.0`` |
  80. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  81. | :ref:`bool<class_bool>` | :ref:`simplify_path<class_NavigationAgent3D_property_simplify_path>` | ``false`` |
  82. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  83. | :ref:`float<class_float>` | :ref:`target_desired_distance<class_NavigationAgent3D_property_target_desired_distance>` | ``1.0`` |
  84. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  85. | :ref:`Vector3<class_Vector3>` | :ref:`target_position<class_NavigationAgent3D_property_target_position>` | ``Vector3(0, 0, 0)`` |
  86. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  87. | :ref:`float<class_float>` | :ref:`time_horizon_agents<class_NavigationAgent3D_property_time_horizon_agents>` | ``1.0`` |
  88. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  89. | :ref:`float<class_float>` | :ref:`time_horizon_obstacles<class_NavigationAgent3D_property_time_horizon_obstacles>` | ``0.0`` |
  90. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  91. | :ref:`bool<class_bool>` | :ref:`use_3d_avoidance<class_NavigationAgent3D_property_use_3d_avoidance>` | ``false`` |
  92. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  93. | :ref:`Vector3<class_Vector3>` | :ref:`velocity<class_NavigationAgent3D_property_velocity>` | ``Vector3(0, 0, 0)`` |
  94. +------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------+-----------------------+
  95. .. rst-class:: classref-reftable-group
  96. Methods
  97. -------
  98. .. table::
  99. :widths: auto
  100. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`float<class_float>` | :ref:`distance_to_target<class_NavigationAgent3D_method_distance_to_target>`\ (\ ) |const| |
  102. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationAgent3D_method_get_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  104. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`bool<class_bool>` | :ref:`get_avoidance_mask_value<class_NavigationAgent3D_method_get_avoidance_mask_value>`\ (\ mask_number\: :ref:`int<class_int>`\ ) |const| |
  106. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_current_navigation_path<class_NavigationAgent3D_method_get_current_navigation_path>`\ (\ ) |const| |
  108. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`int<class_int>` | :ref:`get_current_navigation_path_index<class_NavigationAgent3D_method_get_current_navigation_path_index>`\ (\ ) |const| |
  110. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` | :ref:`get_current_navigation_result<class_NavigationAgent3D_method_get_current_navigation_result>`\ (\ ) |const| |
  112. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`Vector3<class_Vector3>` | :ref:`get_final_position<class_NavigationAgent3D_method_get_final_position>`\ (\ ) |
  114. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationAgent3D_method_get_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  116. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationAgent3D_method_get_navigation_map>`\ (\ ) |const| |
  118. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`Vector3<class_Vector3>` | :ref:`get_next_path_position<class_NavigationAgent3D_method_get_next_path_position>`\ (\ ) |
  120. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`float<class_float>` | :ref:`get_path_length<class_NavigationAgent3D_method_get_path_length>`\ (\ ) |const| |
  122. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationAgent3D_method_get_rid>`\ (\ ) |const| |
  124. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`bool<class_bool>` | :ref:`is_navigation_finished<class_NavigationAgent3D_method_is_navigation_finished>`\ (\ ) |
  126. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`bool<class_bool>` | :ref:`is_target_reachable<class_NavigationAgent3D_method_is_target_reachable>`\ (\ ) |
  128. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`bool<class_bool>` | :ref:`is_target_reached<class_NavigationAgent3D_method_is_target_reached>`\ (\ ) |const| |
  130. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | |void| | :ref:`set_avoidance_layer_value<class_NavigationAgent3D_method_set_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  132. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | |void| | :ref:`set_avoidance_mask_value<class_NavigationAgent3D_method_set_avoidance_mask_value>`\ (\ mask_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  134. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | |void| | :ref:`set_navigation_layer_value<class_NavigationAgent3D_method_set_navigation_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  136. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | |void| | :ref:`set_navigation_map<class_NavigationAgent3D_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
  138. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | |void| | :ref:`set_velocity_forced<class_NavigationAgent3D_method_set_velocity_forced>`\ (\ velocity\: :ref:`Vector3<class_Vector3>`\ ) |
  140. +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. .. rst-class:: classref-section-separator
  142. ----
  143. .. rst-class:: classref-descriptions-group
  144. Signals
  145. -------
  146. .. _class_NavigationAgent3D_signal_link_reached:
  147. .. rst-class:: classref-signal
  148. **link_reached**\ (\ details\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_link_reached>`
  149. 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.
  150. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  151. - ``position``: The start position of the link that was reached.
  152. - ``type``: Always :ref:`NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK<class_NavigationPathQueryResult3D_constant_PATH_SEGMENT_TYPE_LINK>`.
  153. - ``rid``: The :ref:`RID<class_RID>` of the link.
  154. - ``owner``: The object which manages the link (usually :ref:`NavigationLink3D<class_NavigationLink3D>`).
  155. - ``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.
  156. - ``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.
  157. .. rst-class:: classref-item-separator
  158. ----
  159. .. _class_NavigationAgent3D_signal_navigation_finished:
  160. .. rst-class:: classref-signal
  161. **navigation_finished**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_navigation_finished>`
  162. 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.
  163. This signal will be emitted just after :ref:`target_reached<class_NavigationAgent3D_signal_target_reached>` when the target is reachable.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_NavigationAgent3D_signal_path_changed:
  167. .. rst-class:: classref-signal
  168. **path_changed**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_path_changed>`
  169. Emitted when the agent had to update the loaded path:
  170. - because path was previously empty.
  171. - because navigation map has changed.
  172. - because agent pushed further away from the current path segment than the :ref:`path_max_distance<class_NavigationAgent3D_property_path_max_distance>`.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_NavigationAgent3D_signal_target_reached:
  176. .. rst-class:: classref-signal
  177. **target_reached**\ (\ ) :ref:`🔗<class_NavigationAgent3D_signal_target_reached>`
  178. 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.
  179. This signal will be emitted just before :ref:`navigation_finished<class_NavigationAgent3D_signal_navigation_finished>` when the target is reachable.
  180. 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>`.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_NavigationAgent3D_signal_velocity_computed:
  184. .. rst-class:: classref-signal
  185. **velocity_computed**\ (\ safe_velocity\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_velocity_computed>`
  186. 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.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_NavigationAgent3D_signal_waypoint_reached:
  190. .. rst-class:: classref-signal
  191. **waypoint_reached**\ (\ details\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_NavigationAgent3D_signal_waypoint_reached>`
  192. 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.
  193. The details dictionary may contain the following keys depending on the value of :ref:`path_metadata_flags<class_NavigationAgent3D_property_path_metadata_flags>`:
  194. - ``position``: The position of the waypoint that was reached.
  195. - ``type``: The type of navigation primitive (region or link) that contains this waypoint.
  196. - ``rid``: The :ref:`RID<class_RID>` of the containing navigation primitive (region or link).
  197. - ``owner``: The object which manages the containing navigation primitive (region or link).
  198. .. rst-class:: classref-section-separator
  199. ----
  200. .. rst-class:: classref-descriptions-group
  201. Property Descriptions
  202. ---------------------
  203. .. _class_NavigationAgent3D_property_avoidance_enabled:
  204. .. rst-class:: classref-property
  205. :ref:`bool<class_bool>` **avoidance_enabled** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_enabled>`
  206. .. rst-class:: classref-property-setget
  207. - |void| **set_avoidance_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  208. - :ref:`bool<class_bool>` **get_avoidance_enabled**\ (\ )
  209. 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.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_NavigationAgent3D_property_avoidance_layers:
  213. .. rst-class:: classref-property
  214. :ref:`int<class_int>` **avoidance_layers** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_layers>`
  215. .. rst-class:: classref-property-setget
  216. - |void| **set_avoidance_layers**\ (\ value\: :ref:`int<class_int>`\ )
  217. - :ref:`int<class_int>` **get_avoidance_layers**\ (\ )
  218. 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.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_NavigationAgent3D_property_avoidance_mask:
  222. .. rst-class:: classref-property
  223. :ref:`int<class_int>` **avoidance_mask** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_mask>`
  224. .. rst-class:: classref-property-setget
  225. - |void| **set_avoidance_mask**\ (\ value\: :ref:`int<class_int>`\ )
  226. - :ref:`int<class_int>` **get_avoidance_mask**\ (\ )
  227. 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>`.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_NavigationAgent3D_property_avoidance_priority:
  231. .. rst-class:: classref-property
  232. :ref:`float<class_float>` **avoidance_priority** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_avoidance_priority>`
  233. .. rst-class:: classref-property-setget
  234. - |void| **set_avoidance_priority**\ (\ value\: :ref:`float<class_float>`\ )
  235. - :ref:`float<class_float>` **get_avoidance_priority**\ (\ )
  236. 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.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_NavigationAgent3D_property_debug_enabled:
  240. .. rst-class:: classref-property
  241. :ref:`bool<class_bool>` **debug_enabled** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_debug_enabled>`
  242. .. rst-class:: classref-property-setget
  243. - |void| **set_debug_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
  244. - :ref:`bool<class_bool>` **get_debug_enabled**\ (\ )
  245. If ``true`` shows debug visuals for this agent.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_NavigationAgent3D_property_debug_path_custom_color:
  249. .. rst-class:: classref-property
  250. :ref:`Color<class_Color>` **debug_path_custom_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_NavigationAgent3D_property_debug_path_custom_color>`
  251. .. rst-class:: classref-property-setget
  252. - |void| **set_debug_path_custom_color**\ (\ value\: :ref:`Color<class_Color>`\ )
  253. - :ref:`Color<class_Color>` **get_debug_path_custom_color**\ (\ )
  254. If :ref:`debug_use_custom<class_NavigationAgent3D_property_debug_use_custom>` is ``true`` uses this color for this agent instead of global color.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_NavigationAgent3D_property_debug_path_custom_point_size:
  258. .. rst-class:: classref-property
  259. :ref:`float<class_float>` **debug_path_custom_point_size** = ``4.0`` :ref:`🔗<class_NavigationAgent3D_property_debug_path_custom_point_size>`
  260. .. rst-class:: classref-property-setget
  261. - |void| **set_debug_path_custom_point_size**\ (\ value\: :ref:`float<class_float>`\ )
  262. - :ref:`float<class_float>` **get_debug_path_custom_point_size**\ (\ )
  263. 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.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_NavigationAgent3D_property_debug_use_custom:
  267. .. rst-class:: classref-property
  268. :ref:`bool<class_bool>` **debug_use_custom** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_debug_use_custom>`
  269. .. rst-class:: classref-property-setget
  270. - |void| **set_debug_use_custom**\ (\ value\: :ref:`bool<class_bool>`\ )
  271. - :ref:`bool<class_bool>` **get_debug_use_custom**\ (\ )
  272. If ``true`` uses the defined :ref:`debug_path_custom_color<class_NavigationAgent3D_property_debug_path_custom_color>` for this agent instead of global color.
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_NavigationAgent3D_property_height:
  276. .. rst-class:: classref-property
  277. :ref:`float<class_float>` **height** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_height>`
  278. .. rst-class:: classref-property-setget
  279. - |void| **set_height**\ (\ value\: :ref:`float<class_float>`\ )
  280. - :ref:`float<class_float>` **get_height**\ (\ )
  281. 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.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_NavigationAgent3D_property_keep_y_velocity:
  285. .. rst-class:: classref-property
  286. :ref:`bool<class_bool>` **keep_y_velocity** = ``true`` :ref:`🔗<class_NavigationAgent3D_property_keep_y_velocity>`
  287. .. rst-class:: classref-property-setget
  288. - |void| **set_keep_y_velocity**\ (\ value\: :ref:`bool<class_bool>`\ )
  289. - :ref:`bool<class_bool>` **get_keep_y_velocity**\ (\ )
  290. 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.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_NavigationAgent3D_property_max_neighbors:
  294. .. rst-class:: classref-property
  295. :ref:`int<class_int>` **max_neighbors** = ``10`` :ref:`🔗<class_NavigationAgent3D_property_max_neighbors>`
  296. .. rst-class:: classref-property-setget
  297. - |void| **set_max_neighbors**\ (\ value\: :ref:`int<class_int>`\ )
  298. - :ref:`int<class_int>` **get_max_neighbors**\ (\ )
  299. The maximum number of neighbors for the agent to consider.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_NavigationAgent3D_property_max_speed:
  303. .. rst-class:: classref-property
  304. :ref:`float<class_float>` **max_speed** = ``10.0`` :ref:`🔗<class_NavigationAgent3D_property_max_speed>`
  305. .. rst-class:: classref-property-setget
  306. - |void| **set_max_speed**\ (\ value\: :ref:`float<class_float>`\ )
  307. - :ref:`float<class_float>` **get_max_speed**\ (\ )
  308. The maximum speed that an agent can move.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_NavigationAgent3D_property_navigation_layers:
  312. .. rst-class:: classref-property
  313. :ref:`int<class_int>` **navigation_layers** = ``1`` :ref:`🔗<class_NavigationAgent3D_property_navigation_layers>`
  314. .. rst-class:: classref-property-setget
  315. - |void| **set_navigation_layers**\ (\ value\: :ref:`int<class_int>`\ )
  316. - :ref:`int<class_int>` **get_navigation_layers**\ (\ )
  317. 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.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_NavigationAgent3D_property_neighbor_distance:
  321. .. rst-class:: classref-property
  322. :ref:`float<class_float>` **neighbor_distance** = ``50.0`` :ref:`🔗<class_NavigationAgent3D_property_neighbor_distance>`
  323. .. rst-class:: classref-property-setget
  324. - |void| **set_neighbor_distance**\ (\ value\: :ref:`float<class_float>`\ )
  325. - :ref:`float<class_float>` **get_neighbor_distance**\ (\ )
  326. The distance to search for other agents.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _class_NavigationAgent3D_property_path_desired_distance:
  330. .. rst-class:: classref-property
  331. :ref:`float<class_float>` **path_desired_distance** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_path_desired_distance>`
  332. .. rst-class:: classref-property-setget
  333. - |void| **set_path_desired_distance**\ (\ value\: :ref:`float<class_float>`\ )
  334. - :ref:`float<class_float>` **get_path_desired_distance**\ (\ )
  335. 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.
  336. .. rst-class:: classref-item-separator
  337. ----
  338. .. _class_NavigationAgent3D_property_path_height_offset:
  339. .. rst-class:: classref-property
  340. :ref:`float<class_float>` **path_height_offset** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_path_height_offset>`
  341. .. rst-class:: classref-property-setget
  342. - |void| **set_path_height_offset**\ (\ value\: :ref:`float<class_float>`\ )
  343. - :ref:`float<class_float>` **get_path_height_offset**\ (\ )
  344. 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.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_NavigationAgent3D_property_path_max_distance:
  348. .. rst-class:: classref-property
  349. :ref:`float<class_float>` **path_max_distance** = ``5.0`` :ref:`🔗<class_NavigationAgent3D_property_path_max_distance>`
  350. .. rst-class:: classref-property-setget
  351. - |void| **set_path_max_distance**\ (\ value\: :ref:`float<class_float>`\ )
  352. - :ref:`float<class_float>` **get_path_max_distance**\ (\ )
  353. 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.
  354. .. rst-class:: classref-item-separator
  355. ----
  356. .. _class_NavigationAgent3D_property_path_metadata_flags:
  357. .. rst-class:: classref-property
  358. |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] **path_metadata_flags** = ``7`` :ref:`🔗<class_NavigationAgent3D_property_path_metadata_flags>`
  359. .. rst-class:: classref-property-setget
  360. - |void| **set_path_metadata_flags**\ (\ value\: |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\]\ )
  361. - |bitfield|\[:ref:`PathMetadataFlags<enum_NavigationPathQueryParameters3D_PathMetadataFlags>`\] **get_path_metadata_flags**\ (\ )
  362. Additional information to return with the navigation path.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_NavigationAgent3D_property_path_postprocessing:
  366. .. rst-class:: classref-property
  367. :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **path_postprocessing** = ``0`` :ref:`🔗<class_NavigationAgent3D_property_path_postprocessing>`
  368. .. rst-class:: classref-property-setget
  369. - |void| **set_path_postprocessing**\ (\ value\: :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>`\ )
  370. - :ref:`PathPostProcessing<enum_NavigationPathQueryParameters3D_PathPostProcessing>` **get_path_postprocessing**\ (\ )
  371. The path postprocessing applied to the raw path corridor found by the :ref:`pathfinding_algorithm<class_NavigationAgent3D_property_pathfinding_algorithm>`.
  372. .. rst-class:: classref-item-separator
  373. ----
  374. .. _class_NavigationAgent3D_property_path_return_max_length:
  375. .. rst-class:: classref-property
  376. :ref:`float<class_float>` **path_return_max_length** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_path_return_max_length>`
  377. .. rst-class:: classref-property-setget
  378. - |void| **set_path_return_max_length**\ (\ value\: :ref:`float<class_float>`\ )
  379. - :ref:`float<class_float>` **get_path_return_max_length**\ (\ )
  380. The maximum allowed length of the returned path in world units. A path will be clipped when going over this length.
  381. .. rst-class:: classref-item-separator
  382. ----
  383. .. _class_NavigationAgent3D_property_path_return_max_radius:
  384. .. rst-class:: classref-property
  385. :ref:`float<class_float>` **path_return_max_radius** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_path_return_max_radius>`
  386. .. rst-class:: classref-property-setget
  387. - |void| **set_path_return_max_radius**\ (\ value\: :ref:`float<class_float>`\ )
  388. - :ref:`float<class_float>` **get_path_return_max_radius**\ (\ )
  389. The maximum allowed radius in world units that the returned path can be from the path start. The path will be clipped when going over this radius. Compared to :ref:`path_return_max_length<class_NavigationAgent3D_property_path_return_max_length>`, this allows the agent to go that much further, if they need to walk around a corner.
  390. \ **Note:** This will perform a sphere clip considering only the actual navigation mesh path points with the first path position being the sphere's center.
  391. .. rst-class:: classref-item-separator
  392. ----
  393. .. _class_NavigationAgent3D_property_path_search_max_distance:
  394. .. rst-class:: classref-property
  395. :ref:`float<class_float>` **path_search_max_distance** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_path_search_max_distance>`
  396. .. rst-class:: classref-property-setget
  397. - |void| **set_path_search_max_distance**\ (\ value\: :ref:`float<class_float>`\ )
  398. - :ref:`float<class_float>` **get_path_search_max_distance**\ (\ )
  399. The maximum distance a searched polygon can be away from the start polygon before the pathfinding cancels the search for a path to the (possibly unreachable or very far away) target position polygon. In this case the pathfinding resets and builds a path from the start polygon to the polygon that was found closest to the target position so far. A value of ``0`` or below counts as unlimited. In case of unlimited the pathfinding will search all polygons connected with the start polygon until either the target position polygon is found or all available polygon search options are exhausted.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_NavigationAgent3D_property_path_search_max_polygons:
  403. .. rst-class:: classref-property
  404. :ref:`int<class_int>` **path_search_max_polygons** = ``4096`` :ref:`🔗<class_NavigationAgent3D_property_path_search_max_polygons>`
  405. .. rst-class:: classref-property-setget
  406. - |void| **set_path_search_max_polygons**\ (\ value\: :ref:`int<class_int>`\ )
  407. - :ref:`int<class_int>` **get_path_search_max_polygons**\ (\ )
  408. The maximum number of polygons that are searched before the pathfinding cancels the search for a path to the (possibly unreachable or very far away) target position polygon. In this case the pathfinding resets and builds a path from the start polygon to the polygon that was found closest to the target position so far. A value of ``0`` or below counts as unlimited. In case of unlimited the pathfinding will search all polygons connected with the start polygon until either the target position polygon is found or all available polygon search options are exhausted.
  409. .. rst-class:: classref-item-separator
  410. ----
  411. .. _class_NavigationAgent3D_property_pathfinding_algorithm:
  412. .. rst-class:: classref-property
  413. :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **pathfinding_algorithm** = ``0`` :ref:`🔗<class_NavigationAgent3D_property_pathfinding_algorithm>`
  414. .. rst-class:: classref-property-setget
  415. - |void| **set_pathfinding_algorithm**\ (\ value\: :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>`\ )
  416. - :ref:`PathfindingAlgorithm<enum_NavigationPathQueryParameters3D_PathfindingAlgorithm>` **get_pathfinding_algorithm**\ (\ )
  417. The pathfinding algorithm used in the path query.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_NavigationAgent3D_property_radius:
  421. .. rst-class:: classref-property
  422. :ref:`float<class_float>` **radius** = ``0.5`` :ref:`🔗<class_NavigationAgent3D_property_radius>`
  423. .. rst-class:: classref-property-setget
  424. - |void| **set_radius**\ (\ value\: :ref:`float<class_float>`\ )
  425. - :ref:`float<class_float>` **get_radius**\ (\ )
  426. 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>`).
  427. 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.
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _class_NavigationAgent3D_property_simplify_epsilon:
  431. .. rst-class:: classref-property
  432. :ref:`float<class_float>` **simplify_epsilon** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_simplify_epsilon>`
  433. .. rst-class:: classref-property-setget
  434. - |void| **set_simplify_epsilon**\ (\ value\: :ref:`float<class_float>`\ )
  435. - :ref:`float<class_float>` **get_simplify_epsilon**\ (\ )
  436. The path simplification amount in worlds units.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_NavigationAgent3D_property_simplify_path:
  440. .. rst-class:: classref-property
  441. :ref:`bool<class_bool>` **simplify_path** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_simplify_path>`
  442. .. rst-class:: classref-property-setget
  443. - |void| **set_simplify_path**\ (\ value\: :ref:`bool<class_bool>`\ )
  444. - :ref:`bool<class_bool>` **get_simplify_path**\ (\ )
  445. 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.
  446. 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".
  447. .. rst-class:: classref-item-separator
  448. ----
  449. .. _class_NavigationAgent3D_property_target_desired_distance:
  450. .. rst-class:: classref-property
  451. :ref:`float<class_float>` **target_desired_distance** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_target_desired_distance>`
  452. .. rst-class:: classref-property-setget
  453. - |void| **set_target_desired_distance**\ (\ value\: :ref:`float<class_float>`\ )
  454. - :ref:`float<class_float>` **get_target_desired_distance**\ (\ )
  455. 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>`).
  456. 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).
  457. 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.
  458. .. rst-class:: classref-item-separator
  459. ----
  460. .. _class_NavigationAgent3D_property_target_position:
  461. .. rst-class:: classref-property
  462. :ref:`Vector3<class_Vector3>` **target_position** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationAgent3D_property_target_position>`
  463. .. rst-class:: classref-property-setget
  464. - |void| **set_target_position**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  465. - :ref:`Vector3<class_Vector3>` **get_target_position**\ (\ )
  466. 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.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_NavigationAgent3D_property_time_horizon_agents:
  470. .. rst-class:: classref-property
  471. :ref:`float<class_float>` **time_horizon_agents** = ``1.0`` :ref:`🔗<class_NavigationAgent3D_property_time_horizon_agents>`
  472. .. rst-class:: classref-property-setget
  473. - |void| **set_time_horizon_agents**\ (\ value\: :ref:`float<class_float>`\ )
  474. - :ref:`float<class_float>` **get_time_horizon_agents**\ (\ )
  475. 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.
  476. .. rst-class:: classref-item-separator
  477. ----
  478. .. _class_NavigationAgent3D_property_time_horizon_obstacles:
  479. .. rst-class:: classref-property
  480. :ref:`float<class_float>` **time_horizon_obstacles** = ``0.0`` :ref:`🔗<class_NavigationAgent3D_property_time_horizon_obstacles>`
  481. .. rst-class:: classref-property-setget
  482. - |void| **set_time_horizon_obstacles**\ (\ value\: :ref:`float<class_float>`\ )
  483. - :ref:`float<class_float>` **get_time_horizon_obstacles**\ (\ )
  484. 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.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_NavigationAgent3D_property_use_3d_avoidance:
  488. .. rst-class:: classref-property
  489. :ref:`bool<class_bool>` **use_3d_avoidance** = ``false`` :ref:`🔗<class_NavigationAgent3D_property_use_3d_avoidance>`
  490. .. rst-class:: classref-property-setget
  491. - |void| **set_use_3d_avoidance**\ (\ value\: :ref:`bool<class_bool>`\ )
  492. - :ref:`bool<class_bool>` **get_use_3d_avoidance**\ (\ )
  493. 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.
  494. 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.
  495. .. rst-class:: classref-item-separator
  496. ----
  497. .. _class_NavigationAgent3D_property_velocity:
  498. .. rst-class:: classref-property
  499. :ref:`Vector3<class_Vector3>` **velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationAgent3D_property_velocity>`
  500. .. rst-class:: classref-property-setget
  501. - |void| **set_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  502. - :ref:`Vector3<class_Vector3>` **get_velocity**\ (\ )
  503. 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.
  504. .. rst-class:: classref-section-separator
  505. ----
  506. .. rst-class:: classref-descriptions-group
  507. Method Descriptions
  508. -------------------
  509. .. _class_NavigationAgent3D_method_distance_to_target:
  510. .. rst-class:: classref-method
  511. :ref:`float<class_float>` **distance_to_target**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_distance_to_target>`
  512. 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.
  513. .. rst-class:: classref-item-separator
  514. ----
  515. .. _class_NavigationAgent3D_method_get_avoidance_layer_value:
  516. .. rst-class:: classref-method
  517. :ref:`bool<class_bool>` **get_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_avoidance_layer_value>`
  518. 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.
  519. .. rst-class:: classref-item-separator
  520. ----
  521. .. _class_NavigationAgent3D_method_get_avoidance_mask_value:
  522. .. rst-class:: classref-method
  523. :ref:`bool<class_bool>` **get_avoidance_mask_value**\ (\ mask_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_avoidance_mask_value>`
  524. 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.
  525. .. rst-class:: classref-item-separator
  526. ----
  527. .. _class_NavigationAgent3D_method_get_current_navigation_path:
  528. .. rst-class:: classref-method
  529. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_current_navigation_path**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_path>`
  530. 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.
  531. .. rst-class:: classref-item-separator
  532. ----
  533. .. _class_NavigationAgent3D_method_get_current_navigation_path_index:
  534. .. rst-class:: classref-method
  535. :ref:`int<class_int>` **get_current_navigation_path_index**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_path_index>`
  536. Returns which index the agent is currently on in the navigation path's :ref:`PackedVector3Array<class_PackedVector3Array>`.
  537. .. rst-class:: classref-item-separator
  538. ----
  539. .. _class_NavigationAgent3D_method_get_current_navigation_result:
  540. .. rst-class:: classref-method
  541. :ref:`NavigationPathQueryResult3D<class_NavigationPathQueryResult3D>` **get_current_navigation_result**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_current_navigation_result>`
  542. Returns the path query result for the path the agent is currently following.
  543. .. rst-class:: classref-item-separator
  544. ----
  545. .. _class_NavigationAgent3D_method_get_final_position:
  546. .. rst-class:: classref-method
  547. :ref:`Vector3<class_Vector3>` **get_final_position**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_get_final_position>`
  548. 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.
  549. .. rst-class:: classref-item-separator
  550. ----
  551. .. _class_NavigationAgent3D_method_get_navigation_layer_value:
  552. .. rst-class:: classref-method
  553. :ref:`bool<class_bool>` **get_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_navigation_layer_value>`
  554. 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.
  555. .. rst-class:: classref-item-separator
  556. ----
  557. .. _class_NavigationAgent3D_method_get_navigation_map:
  558. .. rst-class:: classref-method
  559. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_navigation_map>`
  560. 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.
  561. .. rst-class:: classref-item-separator
  562. ----
  563. .. _class_NavigationAgent3D_method_get_next_path_position:
  564. .. rst-class:: classref-method
  565. :ref:`Vector3<class_Vector3>` **get_next_path_position**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_get_next_path_position>`
  566. 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.
  567. .. rst-class:: classref-item-separator
  568. ----
  569. .. _class_NavigationAgent3D_method_get_path_length:
  570. .. rst-class:: classref-method
  571. :ref:`float<class_float>` **get_path_length**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_path_length>`
  572. Returns the length of the currently calculated path. The returned value is ``0.0``, if the path is still calculating or no calculation has been requested yet.
  573. .. rst-class:: classref-item-separator
  574. ----
  575. .. _class_NavigationAgent3D_method_get_rid:
  576. .. rst-class:: classref-method
  577. :ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_get_rid>`
  578. Returns the :ref:`RID<class_RID>` of this agent on the :ref:`NavigationServer3D<class_NavigationServer3D>`.
  579. .. rst-class:: classref-item-separator
  580. ----
  581. .. _class_NavigationAgent3D_method_is_navigation_finished:
  582. .. rst-class:: classref-method
  583. :ref:`bool<class_bool>` **is_navigation_finished**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_is_navigation_finished>`
  584. 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.
  585. \ **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.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_NavigationAgent3D_method_is_target_reachable:
  589. .. rst-class:: classref-method
  590. :ref:`bool<class_bool>` **is_target_reachable**\ (\ ) :ref:`🔗<class_NavigationAgent3D_method_is_target_reachable>`
  591. 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>`.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_NavigationAgent3D_method_is_target_reached:
  595. .. rst-class:: classref-method
  596. :ref:`bool<class_bool>` **is_target_reached**\ (\ ) |const| :ref:`🔗<class_NavigationAgent3D_method_is_target_reached>`
  597. 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>`.
  598. .. rst-class:: classref-item-separator
  599. ----
  600. .. _class_NavigationAgent3D_method_set_avoidance_layer_value:
  601. .. rst-class:: classref-method
  602. |void| **set_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_avoidance_layer_value>`
  603. 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.
  604. .. rst-class:: classref-item-separator
  605. ----
  606. .. _class_NavigationAgent3D_method_set_avoidance_mask_value:
  607. .. rst-class:: classref-method
  608. |void| **set_avoidance_mask_value**\ (\ mask_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_avoidance_mask_value>`
  609. 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.
  610. .. rst-class:: classref-item-separator
  611. ----
  612. .. _class_NavigationAgent3D_method_set_navigation_layer_value:
  613. .. rst-class:: classref-method
  614. |void| **set_navigation_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_navigation_layer_value>`
  615. 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.
  616. .. rst-class:: classref-item-separator
  617. ----
  618. .. _class_NavigationAgent3D_method_set_navigation_map:
  619. .. rst-class:: classref-method
  620. |void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_navigation_map>`
  621. Sets the :ref:`RID<class_RID>` of the navigation map this NavigationAgent node should use and also updates the ``agent`` on the NavigationServer.
  622. .. rst-class:: classref-item-separator
  623. ----
  624. .. _class_NavigationAgent3D_method_set_velocity_forced:
  625. .. rst-class:: classref-method
  626. |void| **set_velocity_forced**\ (\ velocity\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_NavigationAgent3D_method_set_velocity_forced>`
  627. 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.
  628. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  629. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  630. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  631. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  632. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  633. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  634. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  635. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  636. .. |void| replace:: :abbr:`void (No return value.)`