Vector3.xml 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Vector3" category="Built-In Types" version="3.1">
  3. <brief_description>
  4. Vector class, which performs basic 3D vector math operations.
  5. </brief_description>
  6. <description>
  7. Vector3 is one of the core classes of the engine, and includes several built-in helper functions to perform basic vector math operations.
  8. </description>
  9. <tutorials>
  10. <link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
  11. </tutorials>
  12. <demos>
  13. </demos>
  14. <methods>
  15. <method name="Vector3">
  16. <return type="Vector3">
  17. </return>
  18. <argument index="0" name="x" type="float">
  19. </argument>
  20. <argument index="1" name="y" type="float">
  21. </argument>
  22. <argument index="2" name="z" type="float">
  23. </argument>
  24. <description>
  25. Returns a Vector3 with the given components.
  26. </description>
  27. </method>
  28. <method name="abs">
  29. <return type="Vector3">
  30. </return>
  31. <description>
  32. Returns a new vector with all components in absolute values (i.e. positive).
  33. </description>
  34. </method>
  35. <method name="angle_to">
  36. <return type="float">
  37. </return>
  38. <argument index="0" name="to" type="Vector3">
  39. </argument>
  40. <description>
  41. Returns the minimum angle to the given vector.
  42. </description>
  43. </method>
  44. <method name="bounce">
  45. <return type="Vector3">
  46. </return>
  47. <argument index="0" name="n" type="Vector3">
  48. </argument>
  49. <description>
  50. Returns the vector "bounced off" from a plane defined by the given normal.
  51. </description>
  52. </method>
  53. <method name="ceil">
  54. <return type="Vector3">
  55. </return>
  56. <description>
  57. Returns a new vector with all components rounded up.
  58. </description>
  59. </method>
  60. <method name="cross">
  61. <return type="Vector3">
  62. </return>
  63. <argument index="0" name="b" type="Vector3">
  64. </argument>
  65. <description>
  66. Returns the cross product with [code]b[/code].
  67. </description>
  68. </method>
  69. <method name="cubic_interpolate">
  70. <return type="Vector3">
  71. </return>
  72. <argument index="0" name="b" type="Vector3">
  73. </argument>
  74. <argument index="1" name="pre_a" type="Vector3">
  75. </argument>
  76. <argument index="2" name="post_b" type="Vector3">
  77. </argument>
  78. <argument index="3" name="t" type="float">
  79. </argument>
  80. <description>
  81. Performs a cubic interpolation between vectors [code]pre_a[/code], [code]a[/code], [code]b[/code], [code]post_b[/code] ([code]a[/code] is current), by the given amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
  82. </description>
  83. </method>
  84. <method name="distance_squared_to">
  85. <return type="float">
  86. </return>
  87. <argument index="0" name="b" type="Vector3">
  88. </argument>
  89. <description>
  90. Returns the squared distance to [code]b[/code]. Prefer this function over [method distance_to] if you need to sort vectors or need the squared distance for some formula.
  91. </description>
  92. </method>
  93. <method name="distance_to">
  94. <return type="float">
  95. </return>
  96. <argument index="0" name="b" type="Vector3">
  97. </argument>
  98. <description>
  99. Returns the distance to [code]b[/code].
  100. </description>
  101. </method>
  102. <method name="dot">
  103. <return type="float">
  104. </return>
  105. <argument index="0" name="b" type="Vector3">
  106. </argument>
  107. <description>
  108. Returns the dot product with [code]b[/code].
  109. </description>
  110. </method>
  111. <method name="floor">
  112. <return type="Vector3">
  113. </return>
  114. <description>
  115. Returns a new vector with all components rounded down.
  116. </description>
  117. </method>
  118. <method name="inverse">
  119. <return type="Vector3">
  120. </return>
  121. <description>
  122. Returns the inverse of the vector. This is the same as [code]Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )[/code].
  123. </description>
  124. </method>
  125. <method name="is_normalized">
  126. <return type="bool">
  127. </return>
  128. <description>
  129. Returns [code]true[/code] if the vector is normalized.
  130. </description>
  131. </method>
  132. <method name="length">
  133. <return type="float">
  134. </return>
  135. <description>
  136. Returns the vector's length.
  137. </description>
  138. </method>
  139. <method name="length_squared">
  140. <return type="float">
  141. </return>
  142. <description>
  143. Returns the vector's length squared. Prefer this function over [method length] if you need to sort vectors or need the squared length for some formula.
  144. </description>
  145. </method>
  146. <method name="linear_interpolate">
  147. <return type="Vector3">
  148. </return>
  149. <argument index="0" name="b" type="Vector3">
  150. </argument>
  151. <argument index="1" name="t" type="float">
  152. </argument>
  153. <description>
  154. Returns the result of the linear interpolation between this vector and [code]b[/code] by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation..
  155. </description>
  156. </method>
  157. <method name="max_axis">
  158. <return type="int">
  159. </return>
  160. <description>
  161. Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants.
  162. </description>
  163. </method>
  164. <method name="min_axis">
  165. <return type="int">
  166. </return>
  167. <description>
  168. Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants.
  169. </description>
  170. </method>
  171. <method name="normalized">
  172. <return type="Vector3">
  173. </return>
  174. <description>
  175. Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code].
  176. </description>
  177. </method>
  178. <method name="outer">
  179. <return type="Basis">
  180. </return>
  181. <argument index="0" name="b" type="Vector3">
  182. </argument>
  183. <description>
  184. Returns the outer product with [code]b[/code].
  185. </description>
  186. </method>
  187. <method name="project">
  188. <return type="Vector3">
  189. </return>
  190. <argument index="0" name="b" type="Vector3">
  191. </argument>
  192. <description>
  193. Returns the vector projected onto the vector [code]b[/code].
  194. </description>
  195. </method>
  196. <method name="reflect">
  197. <return type="Vector3">
  198. </return>
  199. <argument index="0" name="n" type="Vector3">
  200. </argument>
  201. <description>
  202. Returns the vector reflected from a plane defined by the given normal.
  203. </description>
  204. </method>
  205. <method name="rotated">
  206. <return type="Vector3">
  207. </return>
  208. <argument index="0" name="axis" type="Vector3">
  209. </argument>
  210. <argument index="1" name="phi" type="float">
  211. </argument>
  212. <description>
  213. Rotates the vector around a given axis by [code]phi[/code] radians. The axis must be a normalized vector.
  214. </description>
  215. </method>
  216. <method name="round">
  217. <return type="Vector3">
  218. </return>
  219. <description>
  220. Returns the vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
  221. </description>
  222. </method>
  223. <method name="slerp">
  224. <return type="Vector3">
  225. </return>
  226. <argument index="0" name="b" type="Vector3">
  227. </argument>
  228. <argument index="1" name="t" type="float">
  229. </argument>
  230. <description>
  231. Returns the result of SLERP between this vector and [code]b[/code], by amount [code]t[/code]. [code]t[/code] is in the range of [code]0.0 - 1.0[/code], representing the amount of interpolation.
  232. Both vectors need to be normalized.
  233. </description>
  234. </method>
  235. <method name="slide">
  236. <return type="Vector3">
  237. </return>
  238. <argument index="0" name="n" type="Vector3">
  239. </argument>
  240. <description>
  241. Returns the component of the vector along a plane defined by the given normal.
  242. </description>
  243. </method>
  244. <method name="snapped">
  245. <return type="Vector3">
  246. </return>
  247. <argument index="0" name="by" type="Vector3">
  248. </argument>
  249. <description>
  250. Returns a copy of the vector, snapped to the lowest neared multiple.
  251. </description>
  252. </method>
  253. <method name="to_diagonal_matrix">
  254. <return type="Basis">
  255. </return>
  256. <description>
  257. Returns a diagonal matrix with the vector as main diagonal.
  258. </description>
  259. </method>
  260. </methods>
  261. <members>
  262. <member name="x" type="float" setter="" getter="">
  263. The vector's x component. Also accessible by using the index position [code][0][/code].
  264. </member>
  265. <member name="y" type="float" setter="" getter="">
  266. The vector's y component. Also accessible by using the index position [code][1][/code].
  267. </member>
  268. <member name="z" type="float" setter="" getter="">
  269. The vector's z component. Also accessible by using the index position [code][2][/code].
  270. </member>
  271. </members>
  272. <constants>
  273. <constant name="AXIS_X" value="0">
  274. Enumerated value for the X axis. Returned by [method max_axis] and [method min_axis].
  275. </constant>
  276. <constant name="AXIS_Y" value="1">
  277. Enumerated value for the Y axis.
  278. </constant>
  279. <constant name="AXIS_Z" value="2">
  280. Enumerated value for the Z axis.
  281. </constant>
  282. <constant name="ZERO" value="Vector3( 0, 0, 0 )">
  283. Zero vector.
  284. </constant>
  285. <constant name="ONE" value="Vector3( 1, 1, 1 )">
  286. One vector.
  287. </constant>
  288. <constant name="INF" value="Vector3( inf, inf, inf )">
  289. Infinite vector.
  290. </constant>
  291. <constant name="LEFT" value="Vector3( -1, 0, 0 )">
  292. Left unit vector.
  293. </constant>
  294. <constant name="RIGHT" value="Vector3( 1, 0, 0 )">
  295. Right unit vector.
  296. </constant>
  297. <constant name="UP" value="Vector3( 0, 1, 0 )">
  298. Up unit vector.
  299. </constant>
  300. <constant name="DOWN" value="Vector3( 0, -1, 0 )">
  301. Down unit vector.
  302. </constant>
  303. <constant name="FORWARD" value="Vector3( 0, 0, -1 )">
  304. Forward unit vector.
  305. </constant>
  306. <constant name="BACK" value="Vector3( 0, 0, 1 )">
  307. Back unit vector.
  308. </constant>
  309. </constants>
  310. </class>