class_vector3.rst 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  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.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Vector3.xml.
  6. .. _class_Vector3:
  7. Vector3
  8. =======
  9. A 3D vector using floating-point coordinates.
  10. .. rst-class:: classref-introduction-group
  11. Description
  12. -----------
  13. A 3-element structure that can be used to represent 3D coordinates or any other triplet of numeric values.
  14. It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike :ref:`float<class_float>` which is always 64-bit. If double precision is needed, compile the engine with the option ``precision=double``.
  15. See :ref:`Vector3i<class_Vector3i>` for its integer counterpart.
  16. \ **Note:** In a boolean context, a Vector3 will evaluate to ``false`` if it's equal to ``Vector3(0, 0, 0)``. Otherwise, a Vector3 will always evaluate to ``true``.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Math documentation index <../tutorials/math/index>`
  21. - :doc:`Vector math <../tutorials/math/vector_math>`
  22. - :doc:`Advanced vector math <../tutorials/math/vectors_advanced>`
  23. - `3Blue1Brown Essence of Linear Algebra <https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab>`__
  24. - `Matrix Transform Demo <https://godotengine.org/asset-library/asset/2787>`__
  25. - `All 3D Demos <https://github.com/godotengine/godot-demo-projects/tree/master/3d>`__
  26. .. rst-class:: classref-reftable-group
  27. Properties
  28. ----------
  29. .. table::
  30. :widths: auto
  31. +---------------------------+------------------------------------+---------+
  32. | :ref:`float<class_float>` | :ref:`x<class_Vector3_property_x>` | ``0.0`` |
  33. +---------------------------+------------------------------------+---------+
  34. | :ref:`float<class_float>` | :ref:`y<class_Vector3_property_y>` | ``0.0`` |
  35. +---------------------------+------------------------------------+---------+
  36. | :ref:`float<class_float>` | :ref:`z<class_Vector3_property_z>` | ``0.0`` |
  37. +---------------------------+------------------------------------+---------+
  38. .. rst-class:: classref-reftable-group
  39. Constructors
  40. ------------
  41. .. table::
  42. :widths: auto
  43. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector3<class_Vector3>` | :ref:`Vector3<class_Vector3_constructor_Vector3>`\ (\ ) |
  45. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Vector3<class_Vector3>` | :ref:`Vector3<class_Vector3_constructor_Vector3>`\ (\ from\: :ref:`Vector3<class_Vector3>`\ ) |
  47. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Vector3<class_Vector3>` | :ref:`Vector3<class_Vector3_constructor_Vector3>`\ (\ from\: :ref:`Vector3i<class_Vector3i>`\ ) |
  49. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Vector3<class_Vector3>` | :ref:`Vector3<class_Vector3_constructor_Vector3>`\ (\ x\: :ref:`float<class_float>`, y\: :ref:`float<class_float>`, z\: :ref:`float<class_float>`\ ) |
  51. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. .. rst-class:: classref-reftable-group
  53. Methods
  54. -------
  55. .. table::
  56. :widths: auto
  57. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Vector3<class_Vector3>` | :ref:`abs<class_Vector3_method_abs>`\ (\ ) |const| |
  59. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`float<class_float>` | :ref:`angle_to<class_Vector3_method_angle_to>`\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  61. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Vector3<class_Vector3>` | :ref:`bezier_derivative<class_Vector3_method_bezier_derivative>`\ (\ control_1\: :ref:`Vector3<class_Vector3>`, control_2\: :ref:`Vector3<class_Vector3>`, end\: :ref:`Vector3<class_Vector3>`, t\: :ref:`float<class_float>`\ ) |const| |
  63. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Vector3<class_Vector3>` | :ref:`bezier_interpolate<class_Vector3_method_bezier_interpolate>`\ (\ control_1\: :ref:`Vector3<class_Vector3>`, control_2\: :ref:`Vector3<class_Vector3>`, end\: :ref:`Vector3<class_Vector3>`, t\: :ref:`float<class_float>`\ ) |const| |
  65. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Vector3<class_Vector3>` | :ref:`bounce<class_Vector3_method_bounce>`\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  67. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Vector3<class_Vector3>` | :ref:`ceil<class_Vector3_method_ceil>`\ (\ ) |const| |
  69. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Vector3<class_Vector3>` | :ref:`clamp<class_Vector3_method_clamp>`\ (\ min\: :ref:`Vector3<class_Vector3>`, max\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  71. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Vector3<class_Vector3>` | :ref:`clampf<class_Vector3_method_clampf>`\ (\ min\: :ref:`float<class_float>`, max\: :ref:`float<class_float>`\ ) |const| |
  73. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Vector3<class_Vector3>` | :ref:`cross<class_Vector3_method_cross>`\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  75. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`Vector3<class_Vector3>` | :ref:`cubic_interpolate<class_Vector3_method_cubic_interpolate>`\ (\ b\: :ref:`Vector3<class_Vector3>`, pre_a\: :ref:`Vector3<class_Vector3>`, post_b\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| |
  77. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`Vector3<class_Vector3>` | :ref:`cubic_interpolate_in_time<class_Vector3_method_cubic_interpolate_in_time>`\ (\ b\: :ref:`Vector3<class_Vector3>`, pre_a\: :ref:`Vector3<class_Vector3>`, post_b\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`, b_t\: :ref:`float<class_float>`, pre_a_t\: :ref:`float<class_float>`, post_b_t\: :ref:`float<class_float>`\ ) |const| |
  79. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Vector3<class_Vector3>` | :ref:`direction_to<class_Vector3_method_direction_to>`\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  81. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`float<class_float>` | :ref:`distance_squared_to<class_Vector3_method_distance_squared_to>`\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  83. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`float<class_float>` | :ref:`distance_to<class_Vector3_method_distance_to>`\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  85. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`float<class_float>` | :ref:`dot<class_Vector3_method_dot>`\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  87. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`Vector3<class_Vector3>` | :ref:`floor<class_Vector3_method_floor>`\ (\ ) |const| |
  89. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`Vector3<class_Vector3>` | :ref:`inverse<class_Vector3_method_inverse>`\ (\ ) |const| |
  91. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Vector3_method_is_equal_approx>`\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  93. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`is_finite<class_Vector3_method_is_finite>`\ (\ ) |const| |
  95. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`bool<class_bool>` | :ref:`is_normalized<class_Vector3_method_is_normalized>`\ (\ ) |const| |
  97. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`bool<class_bool>` | :ref:`is_zero_approx<class_Vector3_method_is_zero_approx>`\ (\ ) |const| |
  99. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`float<class_float>` | :ref:`length<class_Vector3_method_length>`\ (\ ) |const| |
  101. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`float<class_float>` | :ref:`length_squared<class_Vector3_method_length_squared>`\ (\ ) |const| |
  103. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | :ref:`Vector3<class_Vector3>` | :ref:`lerp<class_Vector3_method_lerp>`\ (\ to\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| |
  105. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | :ref:`Vector3<class_Vector3>` | :ref:`limit_length<class_Vector3_method_limit_length>`\ (\ length\: :ref:`float<class_float>` = 1.0\ ) |const| |
  107. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | :ref:`Vector3<class_Vector3>` | :ref:`max<class_Vector3_method_max>`\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  109. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`int<class_int>` | :ref:`max_axis_index<class_Vector3_method_max_axis_index>`\ (\ ) |const| |
  111. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`Vector3<class_Vector3>` | :ref:`maxf<class_Vector3_method_maxf>`\ (\ with\: :ref:`float<class_float>`\ ) |const| |
  113. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`Vector3<class_Vector3>` | :ref:`min<class_Vector3_method_min>`\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  115. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`int<class_int>` | :ref:`min_axis_index<class_Vector3_method_min_axis_index>`\ (\ ) |const| |
  117. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`Vector3<class_Vector3>` | :ref:`minf<class_Vector3_method_minf>`\ (\ with\: :ref:`float<class_float>`\ ) |const| |
  119. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`Vector3<class_Vector3>` | :ref:`move_toward<class_Vector3_method_move_toward>`\ (\ to\: :ref:`Vector3<class_Vector3>`, delta\: :ref:`float<class_float>`\ ) |const| |
  121. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`Vector3<class_Vector3>` | :ref:`normalized<class_Vector3_method_normalized>`\ (\ ) |const| |
  123. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`Vector3<class_Vector3>` | :ref:`octahedron_decode<class_Vector3_method_octahedron_decode>`\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) |static| |
  125. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`Vector2<class_Vector2>` | :ref:`octahedron_encode<class_Vector3_method_octahedron_encode>`\ (\ ) |const| |
  127. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`Basis<class_Basis>` | :ref:`outer<class_Vector3_method_outer>`\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  129. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`Vector3<class_Vector3>` | :ref:`posmod<class_Vector3_method_posmod>`\ (\ mod\: :ref:`float<class_float>`\ ) |const| |
  131. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`Vector3<class_Vector3>` | :ref:`posmodv<class_Vector3_method_posmodv>`\ (\ modv\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  133. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`Vector3<class_Vector3>` | :ref:`project<class_Vector3_method_project>`\ (\ b\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  135. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`Vector3<class_Vector3>` | :ref:`reflect<class_Vector3_method_reflect>`\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  137. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`Vector3<class_Vector3>` | :ref:`rotated<class_Vector3_method_rotated>`\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| |
  139. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`Vector3<class_Vector3>` | :ref:`round<class_Vector3_method_round>`\ (\ ) |const| |
  141. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`Vector3<class_Vector3>` | :ref:`sign<class_Vector3_method_sign>`\ (\ ) |const| |
  143. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | :ref:`float<class_float>` | :ref:`signed_angle_to<class_Vector3_method_signed_angle_to>`\ (\ to\: :ref:`Vector3<class_Vector3>`, axis\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  145. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`Vector3<class_Vector3>` | :ref:`slerp<class_Vector3_method_slerp>`\ (\ to\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| |
  147. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`Vector3<class_Vector3>` | :ref:`slide<class_Vector3_method_slide>`\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  149. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | :ref:`Vector3<class_Vector3>` | :ref:`snapped<class_Vector3_method_snapped>`\ (\ step\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  151. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | :ref:`Vector3<class_Vector3>` | :ref:`snappedf<class_Vector3_method_snappedf>`\ (\ step\: :ref:`float<class_float>`\ ) |const| |
  153. +-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. .. rst-class:: classref-reftable-group
  155. Operators
  156. ---------
  157. .. table::
  158. :widths: auto
  159. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  160. | :ref:`bool<class_bool>` | :ref:`operator !=<class_Vector3_operator_neq_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  161. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  162. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_Basis>`\ (\ right\: :ref:`Basis<class_Basis>`\ ) |
  163. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  164. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_Quaternion>`\ (\ right\: :ref:`Quaternion<class_Quaternion>`\ ) |
  165. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  166. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_Transform3D>`\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) |
  167. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  168. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  169. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  170. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_float>`\ (\ right\: :ref:`float<class_float>`\ ) |
  171. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  172. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Vector3_operator_mul_int>`\ (\ right\: :ref:`int<class_int>`\ ) |
  173. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  174. | :ref:`Vector3<class_Vector3>` | :ref:`operator +<class_Vector3_operator_sum_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  175. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  176. | :ref:`Vector3<class_Vector3>` | :ref:`operator -<class_Vector3_operator_dif_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  177. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  178. | :ref:`Vector3<class_Vector3>` | :ref:`operator /<class_Vector3_operator_div_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  179. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  180. | :ref:`Vector3<class_Vector3>` | :ref:`operator /<class_Vector3_operator_div_float>`\ (\ right\: :ref:`float<class_float>`\ ) |
  181. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  182. | :ref:`Vector3<class_Vector3>` | :ref:`operator /<class_Vector3_operator_div_int>`\ (\ right\: :ref:`int<class_int>`\ ) |
  183. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  184. | :ref:`bool<class_bool>` | :ref:`operator \<<class_Vector3_operator_lt_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  185. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  186. | :ref:`bool<class_bool>` | :ref:`operator \<=<class_Vector3_operator_lte_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  187. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  188. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Vector3_operator_eq_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  189. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  190. | :ref:`bool<class_bool>` | :ref:`operator ><class_Vector3_operator_gt_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  191. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  192. | :ref:`bool<class_bool>` | :ref:`operator >=<class_Vector3_operator_gte_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  193. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  194. | :ref:`float<class_float>` | :ref:`operator []<class_Vector3_operator_idx_int>`\ (\ index\: :ref:`int<class_int>`\ ) |
  195. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  196. | :ref:`Vector3<class_Vector3>` | :ref:`operator unary+<class_Vector3_operator_unplus>`\ (\ ) |
  197. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  198. | :ref:`Vector3<class_Vector3>` | :ref:`operator unary-<class_Vector3_operator_unminus>`\ (\ ) |
  199. +-------------------------------+----------------------------------------------------------------------------------------------------------------+
  200. .. rst-class:: classref-section-separator
  201. ----
  202. .. rst-class:: classref-descriptions-group
  203. Constants
  204. ---------
  205. .. _class_Vector3_constant_AXIS_X:
  206. .. rst-class:: classref-constant
  207. **AXIS_X** = ``0`` :ref:`🔗<class_Vector3_constant_AXIS_X>`
  208. Enumerated value for the X axis. Returned by :ref:`max_axis_index<class_Vector3_method_max_axis_index>` and :ref:`min_axis_index<class_Vector3_method_min_axis_index>`.
  209. .. _class_Vector3_constant_AXIS_Y:
  210. .. rst-class:: classref-constant
  211. **AXIS_Y** = ``1`` :ref:`🔗<class_Vector3_constant_AXIS_Y>`
  212. Enumerated value for the Y axis. Returned by :ref:`max_axis_index<class_Vector3_method_max_axis_index>` and :ref:`min_axis_index<class_Vector3_method_min_axis_index>`.
  213. .. _class_Vector3_constant_AXIS_Z:
  214. .. rst-class:: classref-constant
  215. **AXIS_Z** = ``2`` :ref:`🔗<class_Vector3_constant_AXIS_Z>`
  216. Enumerated value for the Z axis. Returned by :ref:`max_axis_index<class_Vector3_method_max_axis_index>` and :ref:`min_axis_index<class_Vector3_method_min_axis_index>`.
  217. .. _class_Vector3_constant_ZERO:
  218. .. rst-class:: classref-constant
  219. **ZERO** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_Vector3_constant_ZERO>`
  220. Zero vector, a vector with all components set to ``0``.
  221. .. _class_Vector3_constant_ONE:
  222. .. rst-class:: classref-constant
  223. **ONE** = ``Vector3(1, 1, 1)`` :ref:`🔗<class_Vector3_constant_ONE>`
  224. One vector, a vector with all components set to ``1``.
  225. .. _class_Vector3_constant_INF:
  226. .. rst-class:: classref-constant
  227. **INF** = ``Vector3(inf, inf, inf)`` :ref:`🔗<class_Vector3_constant_INF>`
  228. Infinity vector, a vector with all components set to :ref:`@GDScript.INF<class_@GDScript_constant_INF>`.
  229. .. _class_Vector3_constant_LEFT:
  230. .. rst-class:: classref-constant
  231. **LEFT** = ``Vector3(-1, 0, 0)`` :ref:`🔗<class_Vector3_constant_LEFT>`
  232. Left unit vector. Represents the local direction of left, and the global direction of west.
  233. .. _class_Vector3_constant_RIGHT:
  234. .. rst-class:: classref-constant
  235. **RIGHT** = ``Vector3(1, 0, 0)`` :ref:`🔗<class_Vector3_constant_RIGHT>`
  236. Right unit vector. Represents the local direction of right, and the global direction of east.
  237. .. _class_Vector3_constant_UP:
  238. .. rst-class:: classref-constant
  239. **UP** = ``Vector3(0, 1, 0)`` :ref:`🔗<class_Vector3_constant_UP>`
  240. Up unit vector.
  241. .. _class_Vector3_constant_DOWN:
  242. .. rst-class:: classref-constant
  243. **DOWN** = ``Vector3(0, -1, 0)`` :ref:`🔗<class_Vector3_constant_DOWN>`
  244. Down unit vector.
  245. .. _class_Vector3_constant_FORWARD:
  246. .. rst-class:: classref-constant
  247. **FORWARD** = ``Vector3(0, 0, -1)`` :ref:`🔗<class_Vector3_constant_FORWARD>`
  248. Forward unit vector. Represents the local direction of forward, and the global direction of north. Keep in mind that the forward direction for lights, cameras, etc is different from 3D assets like characters, which face towards the camera by convention. Use :ref:`MODEL_FRONT<class_Vector3_constant_MODEL_FRONT>` and similar constants when working in 3D asset space.
  249. .. _class_Vector3_constant_BACK:
  250. .. rst-class:: classref-constant
  251. **BACK** = ``Vector3(0, 0, 1)`` :ref:`🔗<class_Vector3_constant_BACK>`
  252. Back unit vector. Represents the local direction of back, and the global direction of south.
  253. .. _class_Vector3_constant_MODEL_LEFT:
  254. .. rst-class:: classref-constant
  255. **MODEL_LEFT** = ``Vector3(1, 0, 0)`` :ref:`🔗<class_Vector3_constant_MODEL_LEFT>`
  256. Unit vector pointing towards the left side of imported 3D assets.
  257. .. _class_Vector3_constant_MODEL_RIGHT:
  258. .. rst-class:: classref-constant
  259. **MODEL_RIGHT** = ``Vector3(-1, 0, 0)`` :ref:`🔗<class_Vector3_constant_MODEL_RIGHT>`
  260. Unit vector pointing towards the right side of imported 3D assets.
  261. .. _class_Vector3_constant_MODEL_TOP:
  262. .. rst-class:: classref-constant
  263. **MODEL_TOP** = ``Vector3(0, 1, 0)`` :ref:`🔗<class_Vector3_constant_MODEL_TOP>`
  264. Unit vector pointing towards the top side (up) of imported 3D assets.
  265. .. _class_Vector3_constant_MODEL_BOTTOM:
  266. .. rst-class:: classref-constant
  267. **MODEL_BOTTOM** = ``Vector3(0, -1, 0)`` :ref:`🔗<class_Vector3_constant_MODEL_BOTTOM>`
  268. Unit vector pointing towards the bottom side (down) of imported 3D assets.
  269. .. _class_Vector3_constant_MODEL_FRONT:
  270. .. rst-class:: classref-constant
  271. **MODEL_FRONT** = ``Vector3(0, 0, 1)`` :ref:`🔗<class_Vector3_constant_MODEL_FRONT>`
  272. Unit vector pointing towards the front side (facing forward) of imported 3D assets.
  273. .. _class_Vector3_constant_MODEL_REAR:
  274. .. rst-class:: classref-constant
  275. **MODEL_REAR** = ``Vector3(0, 0, -1)`` :ref:`🔗<class_Vector3_constant_MODEL_REAR>`
  276. Unit vector pointing towards the rear side (back) of imported 3D assets.
  277. .. rst-class:: classref-section-separator
  278. ----
  279. .. rst-class:: classref-descriptions-group
  280. Property Descriptions
  281. ---------------------
  282. .. _class_Vector3_property_x:
  283. .. rst-class:: classref-property
  284. :ref:`float<class_float>` **x** = ``0.0`` :ref:`🔗<class_Vector3_property_x>`
  285. The vector's X component. Also accessible by using the index position ``[0]``.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_Vector3_property_y:
  289. .. rst-class:: classref-property
  290. :ref:`float<class_float>` **y** = ``0.0`` :ref:`🔗<class_Vector3_property_y>`
  291. The vector's Y component. Also accessible by using the index position ``[1]``.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_Vector3_property_z:
  295. .. rst-class:: classref-property
  296. :ref:`float<class_float>` **z** = ``0.0`` :ref:`🔗<class_Vector3_property_z>`
  297. The vector's Z component. Also accessible by using the index position ``[2]``.
  298. .. rst-class:: classref-section-separator
  299. ----
  300. .. rst-class:: classref-descriptions-group
  301. Constructor Descriptions
  302. ------------------------
  303. .. _class_Vector3_constructor_Vector3:
  304. .. rst-class:: classref-constructor
  305. :ref:`Vector3<class_Vector3>` **Vector3**\ (\ ) :ref:`🔗<class_Vector3_constructor_Vector3>`
  306. Constructs a default-initialized **Vector3** with all components set to ``0``.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. rst-class:: classref-constructor
  310. :ref:`Vector3<class_Vector3>` **Vector3**\ (\ from\: :ref:`Vector3<class_Vector3>`\ )
  311. Constructs a **Vector3** as a copy of the given **Vector3**.
  312. .. rst-class:: classref-item-separator
  313. ----
  314. .. rst-class:: classref-constructor
  315. :ref:`Vector3<class_Vector3>` **Vector3**\ (\ from\: :ref:`Vector3i<class_Vector3i>`\ )
  316. Constructs a new **Vector3** from :ref:`Vector3i<class_Vector3i>`.
  317. .. rst-class:: classref-item-separator
  318. ----
  319. .. rst-class:: classref-constructor
  320. :ref:`Vector3<class_Vector3>` **Vector3**\ (\ x\: :ref:`float<class_float>`, y\: :ref:`float<class_float>`, z\: :ref:`float<class_float>`\ )
  321. Returns a **Vector3** with the given components.
  322. .. rst-class:: classref-section-separator
  323. ----
  324. .. rst-class:: classref-descriptions-group
  325. Method Descriptions
  326. -------------------
  327. .. _class_Vector3_method_abs:
  328. .. rst-class:: classref-method
  329. :ref:`Vector3<class_Vector3>` **abs**\ (\ ) |const| :ref:`🔗<class_Vector3_method_abs>`
  330. Returns a new vector with all components in absolute values (i.e. positive).
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_Vector3_method_angle_to:
  334. .. rst-class:: classref-method
  335. :ref:`float<class_float>` **angle_to**\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_angle_to>`
  336. Returns the unsigned minimum angle to the given vector, in radians.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_Vector3_method_bezier_derivative:
  340. .. rst-class:: classref-method
  341. :ref:`Vector3<class_Vector3>` **bezier_derivative**\ (\ control_1\: :ref:`Vector3<class_Vector3>`, control_2\: :ref:`Vector3<class_Vector3>`, end\: :ref:`Vector3<class_Vector3>`, t\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_bezier_derivative>`
  342. Returns the derivative at the given ``t`` on the `Bézier curve <https://en.wikipedia.org/wiki/B%C3%A9zier_curve>`__ defined by this vector and the given ``control_1``, ``control_2``, and ``end`` points.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_Vector3_method_bezier_interpolate:
  346. .. rst-class:: classref-method
  347. :ref:`Vector3<class_Vector3>` **bezier_interpolate**\ (\ control_1\: :ref:`Vector3<class_Vector3>`, control_2\: :ref:`Vector3<class_Vector3>`, end\: :ref:`Vector3<class_Vector3>`, t\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_bezier_interpolate>`
  348. Returns the point at the given ``t`` on the `Bézier curve <https://en.wikipedia.org/wiki/B%C3%A9zier_curve>`__ defined by this vector and the given ``control_1``, ``control_2``, and ``end`` points.
  349. .. rst-class:: classref-item-separator
  350. ----
  351. .. _class_Vector3_method_bounce:
  352. .. rst-class:: classref-method
  353. :ref:`Vector3<class_Vector3>` **bounce**\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_bounce>`
  354. Returns the vector "bounced off" from a plane defined by the given normal ``n``.
  355. \ **Note:** :ref:`bounce<class_Vector3_method_bounce>` performs the operation that most engines and frameworks call ``reflect()``.
  356. .. rst-class:: classref-item-separator
  357. ----
  358. .. _class_Vector3_method_ceil:
  359. .. rst-class:: classref-method
  360. :ref:`Vector3<class_Vector3>` **ceil**\ (\ ) |const| :ref:`🔗<class_Vector3_method_ceil>`
  361. Returns a new vector with all components rounded up (towards positive infinity).
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_Vector3_method_clamp:
  365. .. rst-class:: classref-method
  366. :ref:`Vector3<class_Vector3>` **clamp**\ (\ min\: :ref:`Vector3<class_Vector3>`, max\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_clamp>`
  367. Returns a new vector with all components clamped between the components of ``min`` and ``max``, by running :ref:`@GlobalScope.clamp<class_@GlobalScope_method_clamp>` on each component.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_Vector3_method_clampf:
  371. .. rst-class:: classref-method
  372. :ref:`Vector3<class_Vector3>` **clampf**\ (\ min\: :ref:`float<class_float>`, max\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_clampf>`
  373. Returns a new vector with all components clamped between ``min`` and ``max``, by running :ref:`@GlobalScope.clamp<class_@GlobalScope_method_clamp>` on each component.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_Vector3_method_cross:
  377. .. rst-class:: classref-method
  378. :ref:`Vector3<class_Vector3>` **cross**\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_cross>`
  379. Returns the cross product of this vector and ``with``.
  380. This returns a vector perpendicular to both this and ``with``, which would be the normal vector of the plane defined by the two vectors. As there are two such vectors, in opposite directions, this method returns the vector defined by a right-handed coordinate system. If the two vectors are parallel this returns an empty vector, making it useful for testing if two vectors are parallel.
  381. .. rst-class:: classref-item-separator
  382. ----
  383. .. _class_Vector3_method_cubic_interpolate:
  384. .. rst-class:: classref-method
  385. :ref:`Vector3<class_Vector3>` **cubic_interpolate**\ (\ b\: :ref:`Vector3<class_Vector3>`, pre_a\: :ref:`Vector3<class_Vector3>`, post_b\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_cubic_interpolate>`
  386. Performs a cubic interpolation between this vector and ``b`` using ``pre_a`` and ``post_b`` as handles, and returns the result at position ``weight``. ``weight`` is on the range of 0.0 to 1.0, representing the amount of interpolation.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_Vector3_method_cubic_interpolate_in_time:
  390. .. rst-class:: classref-method
  391. :ref:`Vector3<class_Vector3>` **cubic_interpolate_in_time**\ (\ b\: :ref:`Vector3<class_Vector3>`, pre_a\: :ref:`Vector3<class_Vector3>`, post_b\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`, b_t\: :ref:`float<class_float>`, pre_a_t\: :ref:`float<class_float>`, post_b_t\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_cubic_interpolate_in_time>`
  392. Performs a cubic interpolation between this vector and ``b`` using ``pre_a`` and ``post_b`` as handles, and returns the result at position ``weight``. ``weight`` is on the range of 0.0 to 1.0, representing the amount of interpolation.
  393. It can perform smoother interpolation than :ref:`cubic_interpolate<class_Vector3_method_cubic_interpolate>` by the time values.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_Vector3_method_direction_to:
  397. .. rst-class:: classref-method
  398. :ref:`Vector3<class_Vector3>` **direction_to**\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_direction_to>`
  399. Returns the normalized vector pointing from this vector to ``to``. This is equivalent to using ``(b - a).normalized()``.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_Vector3_method_distance_squared_to:
  403. .. rst-class:: classref-method
  404. :ref:`float<class_float>` **distance_squared_to**\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_distance_squared_to>`
  405. Returns the squared distance between this vector and ``to``.
  406. This method runs faster than :ref:`distance_to<class_Vector3_method_distance_to>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_Vector3_method_distance_to:
  410. .. rst-class:: classref-method
  411. :ref:`float<class_float>` **distance_to**\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_distance_to>`
  412. Returns the distance between this vector and ``to``.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_Vector3_method_dot:
  416. .. rst-class:: classref-method
  417. :ref:`float<class_float>` **dot**\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_dot>`
  418. Returns the dot product of this vector and ``with``. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player.
  419. The dot product will be ``0`` for a right angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees.
  420. When using unit (normalized) vectors, the result will always be between ``-1.0`` (180 degree angle) when the vectors are facing opposite directions, and ``1.0`` (0 degree angle) when the vectors are aligned.
  421. \ **Note:** ``a.dot(b)`` is equivalent to ``b.dot(a)``.
  422. .. rst-class:: classref-item-separator
  423. ----
  424. .. _class_Vector3_method_floor:
  425. .. rst-class:: classref-method
  426. :ref:`Vector3<class_Vector3>` **floor**\ (\ ) |const| :ref:`🔗<class_Vector3_method_floor>`
  427. Returns a new vector with all components rounded down (towards negative infinity).
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _class_Vector3_method_inverse:
  431. .. rst-class:: classref-method
  432. :ref:`Vector3<class_Vector3>` **inverse**\ (\ ) |const| :ref:`🔗<class_Vector3_method_inverse>`
  433. Returns the inverse of the vector. This is the same as ``Vector3(1.0 / v.x, 1.0 / v.y, 1.0 / v.z)``.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_Vector3_method_is_equal_approx:
  437. .. rst-class:: classref-method
  438. :ref:`bool<class_bool>` **is_equal_approx**\ (\ to\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_is_equal_approx>`
  439. Returns ``true`` if this vector and ``to`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_Vector3_method_is_finite:
  443. .. rst-class:: classref-method
  444. :ref:`bool<class_bool>` **is_finite**\ (\ ) |const| :ref:`🔗<class_Vector3_method_is_finite>`
  445. Returns ``true`` if this vector is finite, by calling :ref:`@GlobalScope.is_finite<class_@GlobalScope_method_is_finite>` on each component.
  446. .. rst-class:: classref-item-separator
  447. ----
  448. .. _class_Vector3_method_is_normalized:
  449. .. rst-class:: classref-method
  450. :ref:`bool<class_bool>` **is_normalized**\ (\ ) |const| :ref:`🔗<class_Vector3_method_is_normalized>`
  451. Returns ``true`` if the vector is normalized, i.e. its length is approximately equal to 1.
  452. .. rst-class:: classref-item-separator
  453. ----
  454. .. _class_Vector3_method_is_zero_approx:
  455. .. rst-class:: classref-method
  456. :ref:`bool<class_bool>` **is_zero_approx**\ (\ ) |const| :ref:`🔗<class_Vector3_method_is_zero_approx>`
  457. Returns ``true`` if this vector's values are approximately zero, by running :ref:`@GlobalScope.is_zero_approx<class_@GlobalScope_method_is_zero_approx>` on each component.
  458. This method is faster than using :ref:`is_equal_approx<class_Vector3_method_is_equal_approx>` with one value as a zero vector.
  459. .. rst-class:: classref-item-separator
  460. ----
  461. .. _class_Vector3_method_length:
  462. .. rst-class:: classref-method
  463. :ref:`float<class_float>` **length**\ (\ ) |const| :ref:`🔗<class_Vector3_method_length>`
  464. Returns the length (magnitude) of this vector.
  465. .. rst-class:: classref-item-separator
  466. ----
  467. .. _class_Vector3_method_length_squared:
  468. .. rst-class:: classref-method
  469. :ref:`float<class_float>` **length_squared**\ (\ ) |const| :ref:`🔗<class_Vector3_method_length_squared>`
  470. Returns the squared length (squared magnitude) of this vector.
  471. This method runs faster than :ref:`length<class_Vector3_method_length>`, so prefer it if you need to compare vectors or need the squared distance for some formula.
  472. .. rst-class:: classref-item-separator
  473. ----
  474. .. _class_Vector3_method_lerp:
  475. .. rst-class:: classref-method
  476. :ref:`Vector3<class_Vector3>` **lerp**\ (\ to\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_lerp>`
  477. Returns the result of the linear interpolation between this vector and ``to`` by amount ``weight``. ``weight`` is on the range of ``0.0`` to ``1.0``, representing the amount of interpolation.
  478. .. rst-class:: classref-item-separator
  479. ----
  480. .. _class_Vector3_method_limit_length:
  481. .. rst-class:: classref-method
  482. :ref:`Vector3<class_Vector3>` **limit_length**\ (\ length\: :ref:`float<class_float>` = 1.0\ ) |const| :ref:`🔗<class_Vector3_method_limit_length>`
  483. Returns the vector with a maximum length by limiting its length to ``length``.
  484. .. rst-class:: classref-item-separator
  485. ----
  486. .. _class_Vector3_method_max:
  487. .. rst-class:: classref-method
  488. :ref:`Vector3<class_Vector3>` **max**\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_max>`
  489. Returns the component-wise maximum of this and ``with``, equivalent to ``Vector3(maxf(x, with.x), maxf(y, with.y), maxf(z, with.z))``.
  490. .. rst-class:: classref-item-separator
  491. ----
  492. .. _class_Vector3_method_max_axis_index:
  493. .. rst-class:: classref-method
  494. :ref:`int<class_int>` **max_axis_index**\ (\ ) |const| :ref:`🔗<class_Vector3_method_max_axis_index>`
  495. Returns the axis of the vector's highest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_X<class_Vector3_constant_AXIS_X>`.
  496. .. rst-class:: classref-item-separator
  497. ----
  498. .. _class_Vector3_method_maxf:
  499. .. rst-class:: classref-method
  500. :ref:`Vector3<class_Vector3>` **maxf**\ (\ with\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_maxf>`
  501. Returns the component-wise maximum of this and ``with``, equivalent to ``Vector3(maxf(x, with), maxf(y, with), maxf(z, with))``.
  502. .. rst-class:: classref-item-separator
  503. ----
  504. .. _class_Vector3_method_min:
  505. .. rst-class:: classref-method
  506. :ref:`Vector3<class_Vector3>` **min**\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_min>`
  507. Returns the component-wise minimum of this and ``with``, equivalent to ``Vector3(minf(x, with.x), minf(y, with.y), minf(z, with.z))``.
  508. .. rst-class:: classref-item-separator
  509. ----
  510. .. _class_Vector3_method_min_axis_index:
  511. .. rst-class:: classref-method
  512. :ref:`int<class_int>` **min_axis_index**\ (\ ) |const| :ref:`🔗<class_Vector3_method_min_axis_index>`
  513. Returns the axis of the vector's lowest value. See ``AXIS_*`` constants. If all components are equal, this method returns :ref:`AXIS_Z<class_Vector3_constant_AXIS_Z>`.
  514. .. rst-class:: classref-item-separator
  515. ----
  516. .. _class_Vector3_method_minf:
  517. .. rst-class:: classref-method
  518. :ref:`Vector3<class_Vector3>` **minf**\ (\ with\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_minf>`
  519. Returns the component-wise minimum of this and ``with``, equivalent to ``Vector3(minf(x, with), minf(y, with), minf(z, with))``.
  520. .. rst-class:: classref-item-separator
  521. ----
  522. .. _class_Vector3_method_move_toward:
  523. .. rst-class:: classref-method
  524. :ref:`Vector3<class_Vector3>` **move_toward**\ (\ to\: :ref:`Vector3<class_Vector3>`, delta\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_move_toward>`
  525. Returns a new vector moved toward ``to`` by the fixed ``delta`` amount. Will not go past the final value.
  526. .. rst-class:: classref-item-separator
  527. ----
  528. .. _class_Vector3_method_normalized:
  529. .. rst-class:: classref-method
  530. :ref:`Vector3<class_Vector3>` **normalized**\ (\ ) |const| :ref:`🔗<class_Vector3_method_normalized>`
  531. Returns the result of scaling the vector to unit length. Equivalent to ``v / v.length()``. Returns ``(0, 0, 0)`` if ``v.length() == 0``. See also :ref:`is_normalized<class_Vector3_method_is_normalized>`.
  532. \ **Note:** This function may return incorrect values if the input vector length is near zero.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_Vector3_method_octahedron_decode:
  536. .. rst-class:: classref-method
  537. :ref:`Vector3<class_Vector3>` **octahedron_decode**\ (\ uv\: :ref:`Vector2<class_Vector2>`\ ) |static| :ref:`🔗<class_Vector3_method_octahedron_decode>`
  538. Returns the **Vector3** from an octahedral-compressed form created using :ref:`octahedron_encode<class_Vector3_method_octahedron_encode>` (stored as a :ref:`Vector2<class_Vector2>`).
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _class_Vector3_method_octahedron_encode:
  542. .. rst-class:: classref-method
  543. :ref:`Vector2<class_Vector2>` **octahedron_encode**\ (\ ) |const| :ref:`🔗<class_Vector3_method_octahedron_encode>`
  544. Returns the octahedral-encoded (oct32) form of this **Vector3** as a :ref:`Vector2<class_Vector2>`. Since a :ref:`Vector2<class_Vector2>` occupies 1/3 less memory compared to **Vector3**, this form of compression can be used to pass greater amounts of :ref:`normalized<class_Vector3_method_normalized>` **Vector3**\ s without increasing storage or memory requirements. See also :ref:`octahedron_decode<class_Vector3_method_octahedron_decode>`.
  545. \ **Note:** :ref:`octahedron_encode<class_Vector3_method_octahedron_encode>` can only be used for :ref:`normalized<class_Vector3_method_normalized>` vectors. :ref:`octahedron_encode<class_Vector3_method_octahedron_encode>` does *not* check whether this **Vector3** is normalized, and will return a value that does not decompress to the original value if the **Vector3** is not normalized.
  546. \ **Note:** Octahedral compression is *lossy*, although visual differences are rarely perceptible in real world scenarios.
  547. .. rst-class:: classref-item-separator
  548. ----
  549. .. _class_Vector3_method_outer:
  550. .. rst-class:: classref-method
  551. :ref:`Basis<class_Basis>` **outer**\ (\ with\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_outer>`
  552. Returns the outer product with ``with``.
  553. .. rst-class:: classref-item-separator
  554. ----
  555. .. _class_Vector3_method_posmod:
  556. .. rst-class:: classref-method
  557. :ref:`Vector3<class_Vector3>` **posmod**\ (\ mod\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_posmod>`
  558. Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_method_fposmod>` of this vector's components and ``mod``.
  559. .. rst-class:: classref-item-separator
  560. ----
  561. .. _class_Vector3_method_posmodv:
  562. .. rst-class:: classref-method
  563. :ref:`Vector3<class_Vector3>` **posmodv**\ (\ modv\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_posmodv>`
  564. Returns a vector composed of the :ref:`@GlobalScope.fposmod<class_@GlobalScope_method_fposmod>` of this vector's components and ``modv``'s components.
  565. .. rst-class:: classref-item-separator
  566. ----
  567. .. _class_Vector3_method_project:
  568. .. rst-class:: classref-method
  569. :ref:`Vector3<class_Vector3>` **project**\ (\ b\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_project>`
  570. Returns a new vector resulting from projecting this vector onto the given vector ``b``. The resulting new vector is parallel to ``b``. See also :ref:`slide<class_Vector3_method_slide>`.
  571. \ **Note:** If the vector ``b`` is a zero vector, the components of the resulting new vector will be :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_Vector3_method_reflect:
  575. .. rst-class:: classref-method
  576. :ref:`Vector3<class_Vector3>` **reflect**\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_reflect>`
  577. Returns the result of reflecting the vector through a plane defined by the given normal vector ``n``.
  578. \ **Note:** :ref:`reflect<class_Vector3_method_reflect>` differs from what other engines and frameworks call ``reflect()``. In other engines, ``reflect()`` returns the result of the vector reflected by the given plane. The reflection thus passes through the given normal. While in Godot the reflection passes through the plane and can be thought of as bouncing off the normal. See also :ref:`bounce<class_Vector3_method_bounce>` which does what most engines call ``reflect()``.
  579. .. rst-class:: classref-item-separator
  580. ----
  581. .. _class_Vector3_method_rotated:
  582. .. rst-class:: classref-method
  583. :ref:`Vector3<class_Vector3>` **rotated**\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_rotated>`
  584. Returns the result of rotating this vector around a given axis by ``angle`` (in radians). The axis must be a normalized vector. See also :ref:`@GlobalScope.deg_to_rad<class_@GlobalScope_method_deg_to_rad>`.
  585. .. rst-class:: classref-item-separator
  586. ----
  587. .. _class_Vector3_method_round:
  588. .. rst-class:: classref-method
  589. :ref:`Vector3<class_Vector3>` **round**\ (\ ) |const| :ref:`🔗<class_Vector3_method_round>`
  590. Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
  591. .. rst-class:: classref-item-separator
  592. ----
  593. .. _class_Vector3_method_sign:
  594. .. rst-class:: classref-method
  595. :ref:`Vector3<class_Vector3>` **sign**\ (\ ) |const| :ref:`🔗<class_Vector3_method_sign>`
  596. Returns a new vector with each component set to ``1.0`` if it's positive, ``-1.0`` if it's negative, and ``0.0`` if it's zero. The result is identical to calling :ref:`@GlobalScope.sign<class_@GlobalScope_method_sign>` on each component.
  597. .. rst-class:: classref-item-separator
  598. ----
  599. .. _class_Vector3_method_signed_angle_to:
  600. .. rst-class:: classref-method
  601. :ref:`float<class_float>` **signed_angle_to**\ (\ to\: :ref:`Vector3<class_Vector3>`, axis\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_signed_angle_to>`
  602. Returns the signed angle to the given vector, in radians. The sign of the angle is positive in a counter-clockwise direction and negative in a clockwise direction when viewed from the side specified by the ``axis``.
  603. .. rst-class:: classref-item-separator
  604. ----
  605. .. _class_Vector3_method_slerp:
  606. .. rst-class:: classref-method
  607. :ref:`Vector3<class_Vector3>` **slerp**\ (\ to\: :ref:`Vector3<class_Vector3>`, weight\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_slerp>`
  608. Returns the result of spherical linear interpolation between this vector and ``to``, by amount ``weight``. ``weight`` is on the range of 0.0 to 1.0, representing the amount of interpolation.
  609. This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like :ref:`lerp<class_Vector3_method_lerp>`.
  610. .. rst-class:: classref-item-separator
  611. ----
  612. .. _class_Vector3_method_slide:
  613. .. rst-class:: classref-method
  614. :ref:`Vector3<class_Vector3>` **slide**\ (\ n\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_slide>`
  615. Returns a new vector resulting from sliding this vector along a plane with normal ``n``. The resulting new vector is perpendicular to ``n``, and is equivalent to this vector minus its projection on ``n``. See also :ref:`project<class_Vector3_method_project>`.
  616. \ **Note:** The vector ``n`` must be normalized. See also :ref:`normalized<class_Vector3_method_normalized>`.
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_Vector3_method_snapped:
  620. .. rst-class:: classref-method
  621. :ref:`Vector3<class_Vector3>` **snapped**\ (\ step\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Vector3_method_snapped>`
  622. Returns a new vector with each component snapped to the nearest multiple of the corresponding component in ``step``. This can also be used to round the components to an arbitrary number of decimals.
  623. .. rst-class:: classref-item-separator
  624. ----
  625. .. _class_Vector3_method_snappedf:
  626. .. rst-class:: classref-method
  627. :ref:`Vector3<class_Vector3>` **snappedf**\ (\ step\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Vector3_method_snappedf>`
  628. Returns a new vector with each component snapped to the nearest multiple of ``step``. This can also be used to round the components to an arbitrary number of decimals.
  629. .. rst-class:: classref-section-separator
  630. ----
  631. .. rst-class:: classref-descriptions-group
  632. Operator Descriptions
  633. ---------------------
  634. .. _class_Vector3_operator_neq_Vector3:
  635. .. rst-class:: classref-operator
  636. :ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_neq_Vector3>`
  637. Returns ``true`` if the vectors are not equal.
  638. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector3_method_is_equal_approx>` instead, which is more reliable.
  639. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_Vector3_operator_mul_Basis:
  643. .. rst-class:: classref-operator
  644. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`Basis<class_Basis>`\ ) :ref:`🔗<class_Vector3_operator_mul_Basis>`
  645. Inversely transforms (multiplies) the **Vector3** by the given :ref:`Basis<class_Basis>` matrix, under the assumption that the basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
  646. \ ``vector * basis`` is equivalent to ``basis.transposed() * vector``. See :ref:`Basis.transposed<class_Basis_method_transposed>`.
  647. For transforming by inverse of a non-orthonormal basis (e.g. with scaling) ``basis.inverse() * vector`` can be used instead. See :ref:`Basis.inverse<class_Basis_method_inverse>`.
  648. .. rst-class:: classref-item-separator
  649. ----
  650. .. _class_Vector3_operator_mul_Quaternion:
  651. .. rst-class:: classref-operator
  652. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`Quaternion<class_Quaternion>`\ ) :ref:`🔗<class_Vector3_operator_mul_Quaternion>`
  653. Inversely transforms (multiplies) the **Vector3** by the given :ref:`Quaternion<class_Quaternion>`.
  654. \ ``vector * quaternion`` is equivalent to ``quaternion.inverse() * vector``. See :ref:`Quaternion.inverse<class_Quaternion_method_inverse>`.
  655. .. rst-class:: classref-item-separator
  656. ----
  657. .. _class_Vector3_operator_mul_Transform3D:
  658. .. rst-class:: classref-operator
  659. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_Vector3_operator_mul_Transform3D>`
  660. Inversely transforms (multiplies) the **Vector3** by the given :ref:`Transform3D<class_Transform3D>` transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
  661. \ ``vector * transform`` is equivalent to ``transform.inverse() * vector``. See :ref:`Transform3D.inverse<class_Transform3D_method_inverse>`.
  662. For transforming by inverse of an affine transformation (e.g. with scaling) ``transform.affine_inverse() * vector`` can be used instead. See :ref:`Transform3D.affine_inverse<class_Transform3D_method_affine_inverse>`.
  663. .. rst-class:: classref-item-separator
  664. ----
  665. .. _class_Vector3_operator_mul_Vector3:
  666. .. rst-class:: classref-operator
  667. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_mul_Vector3>`
  668. Multiplies each component of the **Vector3** by the components of the given **Vector3**.
  669. ::
  670. print(Vector3(10, 20, 30) * Vector3(3, 4, 5)) # Prints "(30, 80, 150)"
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_Vector3_operator_mul_float:
  674. .. rst-class:: classref-operator
  675. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Vector3_operator_mul_float>`
  676. Multiplies each component of the **Vector3** by the given :ref:`float<class_float>`.
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_Vector3_operator_mul_int:
  680. .. rst-class:: classref-operator
  681. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Vector3_operator_mul_int>`
  682. Multiplies each component of the **Vector3** by the given :ref:`int<class_int>`.
  683. .. rst-class:: classref-item-separator
  684. ----
  685. .. _class_Vector3_operator_sum_Vector3:
  686. .. rst-class:: classref-operator
  687. :ref:`Vector3<class_Vector3>` **operator +**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_sum_Vector3>`
  688. Adds each component of the **Vector3** by the components of the given **Vector3**.
  689. ::
  690. print(Vector3(10, 20, 30) + Vector3(3, 4, 5)) # Prints "(13, 24, 35)"
  691. .. rst-class:: classref-item-separator
  692. ----
  693. .. _class_Vector3_operator_dif_Vector3:
  694. .. rst-class:: classref-operator
  695. :ref:`Vector3<class_Vector3>` **operator -**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_dif_Vector3>`
  696. Subtracts each component of the **Vector3** by the components of the given **Vector3**.
  697. ::
  698. print(Vector3(10, 20, 30) - Vector3(3, 4, 5)) # Prints "(7, 16, 25)"
  699. .. rst-class:: classref-item-separator
  700. ----
  701. .. _class_Vector3_operator_div_Vector3:
  702. .. rst-class:: classref-operator
  703. :ref:`Vector3<class_Vector3>` **operator /**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_div_Vector3>`
  704. Divides each component of the **Vector3** by the components of the given **Vector3**.
  705. ::
  706. print(Vector3(10, 20, 30) / Vector3(2, 5, 3)) # Prints "(5, 4, 10)"
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_Vector3_operator_div_float:
  710. .. rst-class:: classref-operator
  711. :ref:`Vector3<class_Vector3>` **operator /**\ (\ right\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Vector3_operator_div_float>`
  712. Divides each component of the **Vector3** by the given :ref:`float<class_float>`.
  713. .. rst-class:: classref-item-separator
  714. ----
  715. .. _class_Vector3_operator_div_int:
  716. .. rst-class:: classref-operator
  717. :ref:`Vector3<class_Vector3>` **operator /**\ (\ right\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Vector3_operator_div_int>`
  718. Divides each component of the **Vector3** by the given :ref:`int<class_int>`.
  719. .. rst-class:: classref-item-separator
  720. ----
  721. .. _class_Vector3_operator_lt_Vector3:
  722. .. rst-class:: classref-operator
  723. :ref:`bool<class_bool>` **operator <**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_lt_Vector3>`
  724. Compares two **Vector3** vectors by first checking if the X value of the left vector is less than the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
  725. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  726. .. rst-class:: classref-item-separator
  727. ----
  728. .. _class_Vector3_operator_lte_Vector3:
  729. .. rst-class:: classref-operator
  730. :ref:`bool<class_bool>` **operator <=**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_lte_Vector3>`
  731. Compares two **Vector3** vectors by first checking if the X value of the left vector is less than or equal to the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
  732. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  733. .. rst-class:: classref-item-separator
  734. ----
  735. .. _class_Vector3_operator_eq_Vector3:
  736. .. rst-class:: classref-operator
  737. :ref:`bool<class_bool>` **operator ==**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_eq_Vector3>`
  738. Returns ``true`` if the vectors are exactly equal.
  739. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Vector3_method_is_equal_approx>` instead, which is more reliable.
  740. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  741. .. rst-class:: classref-item-separator
  742. ----
  743. .. _class_Vector3_operator_gt_Vector3:
  744. .. rst-class:: classref-operator
  745. :ref:`bool<class_bool>` **operator >**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_gt_Vector3>`
  746. Compares two **Vector3** vectors by first checking if the X value of the left vector is greater than the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
  747. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_Vector3_operator_gte_Vector3:
  751. .. rst-class:: classref-operator
  752. :ref:`bool<class_bool>` **operator >=**\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Vector3_operator_gte_Vector3>`
  753. Compares two **Vector3** vectors by first checking if the X value of the left vector is greater than or equal to the X value of the ``right`` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors.
  754. \ **Note:** Vectors with :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
  755. .. rst-class:: classref-item-separator
  756. ----
  757. .. _class_Vector3_operator_idx_int:
  758. .. rst-class:: classref-operator
  759. :ref:`float<class_float>` **operator []**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Vector3_operator_idx_int>`
  760. Access vector components using their ``index``. ``v[0]`` is equivalent to ``v.x``, ``v[1]`` is equivalent to ``v.y``, and ``v[2]`` is equivalent to ``v.z``.
  761. .. rst-class:: classref-item-separator
  762. ----
  763. .. _class_Vector3_operator_unplus:
  764. .. rst-class:: classref-operator
  765. :ref:`Vector3<class_Vector3>` **operator unary+**\ (\ ) :ref:`🔗<class_Vector3_operator_unplus>`
  766. Returns the same value as if the ``+`` was not there. Unary ``+`` does nothing, but sometimes it can make your code more readable.
  767. .. rst-class:: classref-item-separator
  768. ----
  769. .. _class_Vector3_operator_unminus:
  770. .. rst-class:: classref-operator
  771. :ref:`Vector3<class_Vector3>` **operator unary-**\ (\ ) :ref:`🔗<class_Vector3_operator_unminus>`
  772. Returns the negative value of the **Vector3**. This is the same as writing ``Vector3(-v.x, -v.y, -v.z)``. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
  773. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  774. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  775. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  776. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  777. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  778. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  779. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  780. .. |void| replace:: :abbr:`void (No return value.)`