Vector3.xml 9.6 KB

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