Debian Codegraph @

doc/classes/Vector3.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Vector3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A 3D vector using floating-point coordinates.
5 </brief_description>
6 <description>
7 A 3-element structure that can be used to represent 3D coordinates or any other triplet of numeric values.
8 It uses floating-point coordinates. By default, these floating-point values use 32-bit precision, unlike [float] which is always 64-bit. If double precision is needed, compile the engine with the option [code]precision=double[/code].
9 See [Vector3i] for its integer counterpart.
10 [b]Note:[/b] In a boolean context, a Vector3 will evaluate to [code]false[/code] if it's equal to [code]Vector3(0, 0, 0)[/code]. Otherwise, a Vector3 will always evaluate to [code]true[/code].
11 </description>
12 <tutorials>
13 <link title="Math documentation index">$DOCS_URL/tutorials/math/index.html</link>
14 <link title="Vector math">$DOCS_URL/tutorials/math/vector_math.html</link>
15 <link title="Advanced vector math">$DOCS_URL/tutorials/math/vectors_advanced.html</link>
16 <link title="3Blue1Brown Essence of Linear Algebra">https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab</link>
17 <link title="Matrix Transform Demo">https://godotengine.org/asset-library/asset/2787</link>
18 <link title="All 3D Demos">https://github.com/godotengine/godot-demo-projects/tree/master/3d</link>
19 </tutorials>
20 <constructors>
21 <constructor name="Vector3">
22 <return type="Vector3" />
23 <description>
24 Constructs a default-initialized [Vector3] with all components set to [code]0[/code].
25 </description>
26 </constructor>
27 <constructor name="Vector3">
28 <return type="Vector3" />
29 <param index="0" name="from" type="Vector3" />
30 <description>
31 Constructs a [Vector3] as a copy of the given [Vector3].
32 </description>
33 </constructor>
34 <constructor name="Vector3">
35 <return type="Vector3" />
36 <param index="0" name="from" type="Vector3i" />
37 <description>
38 Constructs a new [Vector3] from [Vector3i].
39 </description>
40 </constructor>
41 <constructor name="Vector3">
42 <return type="Vector3" />
43 <param index="0" name="x" type="float" />
44 <param index="1" name="y" type="float" />
45 <param index="2" name="z" type="float" />
46 <description>
47 Returns a [Vector3] with the given components.
48 </description>
49 </constructor>
50 </constructors>
51 <methods>
52 <method name="abs" qualifiers="const">
53 <return type="Vector3" />
54 <description>
55 Returns a new vector with all components in absolute values (i.e. positive).
56 </description>
57 </method>
58 <method name="angle_to" qualifiers="const">
59 <return type="float" />
60 <param index="0" name="to" type="Vector3" />
61 <description>
62 Returns the unsigned minimum angle to the given vector, in radians.
63 </description>
64 </method>
65 <method name="bezier_derivative" qualifiers="const">
66 <return type="Vector3" />
67 <param index="0" name="control_1" type="Vector3" />
68 <param index="1" name="control_2" type="Vector3" />
69 <param index="2" name="end" type="Vector3" />
70 <param index="3" name="t" type="float" />
71 <description>
72 Returns the derivative at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
73 </description>
74 </method>
75 <method name="bezier_interpolate" qualifiers="const">
76 <return type="Vector3" />
77 <param index="0" name="control_1" type="Vector3" />
78 <param index="1" name="control_2" type="Vector3" />
79 <param index="2" name="end" type="Vector3" />
80 <param index="3" name="t" type="float" />
81 <description>
82 Returns the point at the given [param t] on the [url=https://en.wikipedia.org/wiki/B%C3%A9zier_curve]Bézier curve[/url] defined by this vector and the given [param control_1], [param control_2], and [param end] points.
83 </description>
84 </method>
85 <method name="bounce" qualifiers="const">
86 <return type="Vector3" />
87 <param index="0" name="n" type="Vector3" />
88 <description>
89 Returns the vector "bounced off" from a plane defined by the given normal [param n].
90 [b]Note:[/b] [method bounce] performs the operation that most engines and frameworks call [code skip-lint]reflect()[/code].
91 </description>
92 </method>
93 <method name="ceil" qualifiers="const">
94 <return type="Vector3" />
95 <description>
96 Returns a new vector with all components rounded up (towards positive infinity).
97 </description>
98 </method>
99 <method name="clamp" qualifiers="const">
100 <return type="Vector3" />
101 <param index="0" name="min" type="Vector3" />
102 <param index="1" name="max" type="Vector3" />
103 <description>
104 Returns a new vector with all components clamped between the components of [param min] and [param max], by running [method @GlobalScope.clamp] on each component.
105 </description>
106 </method>
107 <method name="clampf" qualifiers="const">
108 <return type="Vector3" />
109 <param index="0" name="min" type="float" />
110 <param index="1" name="max" type="float" />
111 <description>
112 Returns a new vector with all components clamped between [param min] and [param max], by running [method @GlobalScope.clamp] on each component.
113 </description>
114 </method>
115 <method name="cross" qualifiers="const">
116 <return type="Vector3" />
117 <param index="0" name="with" type="Vector3" />
118 <description>
119 Returns the cross product of this vector and [param with].
120 This returns a vector perpendicular to both this and [param 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.
121 </description>
122 </method>
123 <method name="cubic_interpolate" qualifiers="const">
124 <return type="Vector3" />
125 <param index="0" name="b" type="Vector3" />
126 <param index="1" name="pre_a" type="Vector3" />
127 <param index="2" name="post_b" type="Vector3" />
128 <param index="3" name="weight" type="float" />
129 <description>
130 Performs a cubic interpolation between this vector and [param b] using [param pre_a] and [param post_b] as handles, and returns the result at position [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation.
131 </description>
132 </method>
133 <method name="cubic_interpolate_in_time" qualifiers="const">
134 <return type="Vector3" />
135 <param index="0" name="b" type="Vector3" />
136 <param index="1" name="pre_a" type="Vector3" />
137 <param index="2" name="post_b" type="Vector3" />
138 <param index="3" name="weight" type="float" />
139 <param index="4" name="b_t" type="float" />
140 <param index="5" name="pre_a_t" type="float" />
141 <param index="6" name="post_b_t" type="float" />
142 <description>
143 Performs a cubic interpolation between this vector and [param b] using [param pre_a] and [param post_b] as handles, and returns the result at position [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation.
144 It can perform smoother interpolation than [method cubic_interpolate] by the time values.
145 </description>
146 </method>
147 <method name="direction_to" qualifiers="const">
148 <return type="Vector3" />
149 <param index="0" name="to" type="Vector3" />
150 <description>
151 Returns the normalized vector pointing from this vector to [param to]. This is equivalent to using [code](b - a).normalized()[/code].
152 </description>
153 </method>
154 <method name="distance_squared_to" qualifiers="const">
155 <return type="float" />
156 <param index="0" name="to" type="Vector3" />
157 <description>
158 Returns the squared distance between this vector and [param to].
159 This method runs faster than [method distance_to], so prefer it if you need to compare vectors or need the squared distance for some formula.
160 </description>
161 </method>
162 <method name="distance_to" qualifiers="const">
163 <return type="float" />
164 <param index="0" name="to" type="Vector3" />
165 <description>
166 Returns the distance between this vector and [param to].
167 </description>
168 </method>
169 <method name="dot" qualifiers="const">
170 <return type="float" />
171 <param index="0" name="with" type="Vector3" />
172 <description>
173 Returns the dot product of this vector and [param 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.
174 The dot product will be [code]0[/code] 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.
175 When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned.
176 [b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code].
177 </description>
178 </method>
179 <method name="floor" qualifiers="const">
180 <return type="Vector3" />
181 <description>
182 Returns a new vector with all components rounded down (towards negative infinity).
183 </description>
184 </method>
185 <method name="inverse" qualifiers="const">
186 <return type="Vector3" />
187 <description>
188 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].
189 </description>
190 </method>
191 <method name="is_equal_approx" qualifiers="const">
192 <return type="bool" />
193 <param index="0" name="to" type="Vector3" />
194 <description>
195 Returns [code]true[/code] if this vector and [param to] are approximately equal, by running [method @GlobalScope.is_equal_approx] on each component.
196 </description>
197 </method>
198 <method name="is_finite" qualifiers="const">
199 <return type="bool" />
200 <description>
201 Returns [code]true[/code] if this vector is finite, by calling [method @GlobalScope.is_finite] on each component.
202 </description>
203 </method>
204 <method name="is_normalized" qualifiers="const">
205 <return type="bool" />
206 <description>
207 Returns [code]true[/code] if the vector is normalized, i.e. its length is approximately equal to 1.
208 </description>
209 </method>
210 <method name="is_zero_approx" qualifiers="const">
211 <return type="bool" />
212 <description>
213 Returns [code]true[/code] if this vector's values are approximately zero, by running [method @GlobalScope.is_zero_approx] on each component.
214 This method is faster than using [method is_equal_approx] with one value as a zero vector.
215 </description>
216 </method>
217 <method name="length" qualifiers="const" keywords="size">
218 <return type="float" />
219 <description>
220 Returns the length (magnitude) of this vector.
221 </description>
222 </method>
223 <method name="length_squared" qualifiers="const">
224 <return type="float" />
225 <description>
226 Returns the squared length (squared magnitude) of this vector.
227 This method runs faster than [method length], so prefer it if you need to compare vectors or need the squared distance for some formula.
228 </description>
229 </method>
230 <method name="lerp" qualifiers="const" keywords="interpolate">
231 <return type="Vector3" />
232 <param index="0" name="to" type="Vector3" />
233 <param index="1" name="weight" type="float" />
234 <description>
235 Returns the result of the linear interpolation between this vector and [param to] by amount [param weight]. [param weight] is on the range of [code]0.0[/code] to [code]1.0[/code], representing the amount of interpolation.
236 </description>
237 </method>
238 <method name="limit_length" qualifiers="const" keywords="clamp, saturate, truncate">
239 <return type="Vector3" />
240 <param index="0" name="length" type="float" default="1.0" />
241 <description>
242 Returns the vector with a maximum length by limiting its length to [param length]. If the vector is non-finite, the result is undefined.
243 </description>
244 </method>
245 <method name="max" qualifiers="const">
246 <return type="Vector3" />
247 <param index="0" name="with" type="Vector3" />
248 <description>
249 Returns the component-wise maximum of this and [param with], equivalent to [code]Vector3(maxf(x, with.x), maxf(y, with.y), maxf(z, with.z))[/code].
250 </description>
251 </method>
252 <method name="max_axis_index" qualifiers="const">
253 <return type="int" />
254 <description>
255 Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
256 </description>
257 </method>
258 <method name="maxf" qualifiers="const">
259 <return type="Vector3" />
260 <param index="0" name="with" type="float" />
261 <description>
262 Returns the component-wise maximum of this and [param with], equivalent to [code]Vector3(maxf(x, with), maxf(y, with), maxf(z, with))[/code].
263 </description>
264 </method>
265 <method name="min" qualifiers="const">
266 <return type="Vector3" />
267 <param index="0" name="with" type="Vector3" />
268 <description>
269 Returns the component-wise minimum of this and [param with], equivalent to [code]Vector3(minf(x, with.x), minf(y, with.y), minf(z, with.z))[/code].
270 </description>
271 </method>
272 <method name="min_axis_index" qualifiers="const">
273 <return type="int" />
274 <description>
275 Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
276 </description>
277 </method>
278 <method name="minf" qualifiers="const">
279 <return type="Vector3" />
280 <param index="0" name="with" type="float" />
281 <description>
282 Returns the component-wise minimum of this and [param with], equivalent to [code]Vector3(minf(x, with), minf(y, with), minf(z, with))[/code].
283 </description>
284 </method>
285 <method name="move_toward" qualifiers="const">
286 <return type="Vector3" />
287 <param index="0" name="to" type="Vector3" />
288 <param index="1" name="delta" type="float" />
289 <description>
290 Returns a new vector moved toward [param to] by the fixed [param delta] amount. Will not go past the final value.
291 </description>
292 </method>
293 <method name="normalized" qualifiers="const">
294 <return type="Vector3" />
295 <description>
296 Returns the result of scaling the vector to unit length. Equivalent to [code]v / v.length()[/code]. Returns [code](0, 0, 0)[/code] if [code]v.length() == 0[/code]. See also [method is_normalized].
297 [b]Note:[/b] This function may return incorrect values if the input vector length is near zero.
298 </description>
299 </method>
300 <method name="octahedron_decode" qualifiers="static">
301 <return type="Vector3" />
302 <param index="0" name="uv" type="Vector2" />
303 <description>
304 Returns the [Vector3] from an octahedral-compressed form created using [method octahedron_encode] (stored as a [Vector2]).
305 </description>
306 </method>
307 <method name="octahedron_encode" qualifiers="const">
308 <return type="Vector2" />
309 <description>
310 Returns the octahedral-encoded (oct32) form of this [Vector3] as a [Vector2]. Since a [Vector2] occupies 1/3 less memory compared to [Vector3], this form of compression can be used to pass greater amounts of [method normalized] [Vector3]s without increasing storage or memory requirements. See also [method octahedron_decode].
311 [b]Note:[/b] [method octahedron_encode] can only be used for [method normalized] vectors. [method octahedron_encode] does [i]not[/i] 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.
312 [b]Note:[/b] Octahedral compression is [i]lossy[/i], although visual differences are rarely perceptible in real world scenarios.
313 </description>
314 </method>
315 <method name="outer" qualifiers="const">
316 <return type="Basis" />
317 <param index="0" name="with" type="Vector3" />
318 <description>
319 Returns the outer product with [param with].
320 </description>
321 </method>
322 <method name="posmod" qualifiers="const">
323 <return type="Vector3" />
324 <param index="0" name="mod" type="float" />
325 <description>
326 Returns a vector composed of the [method @GlobalScope.fposmod] of this vector's components and [param mod].
327 </description>
328 </method>
329 <method name="posmodv" qualifiers="const">
330 <return type="Vector3" />
331 <param index="0" name="modv" type="Vector3" />
332 <description>
333 Returns a vector composed of the [method @GlobalScope.fposmod] of this vector's components and [param modv]'s components.
334 </description>
335 </method>
336 <method name="project" qualifiers="const">
337 <return type="Vector3" />
338 <param index="0" name="b" type="Vector3" />
339 <description>
340 Returns a new vector resulting from projecting this vector onto the given vector [param b]. The resulting new vector is parallel to [param b]. See also [method slide].
341 [b]Note:[/b] If the vector [param b] is a zero vector, the components of the resulting new vector will be [constant @GDScript.NAN].
342 </description>
343 </method>
344 <method name="reflect" qualifiers="const">
345 <return type="Vector3" />
346 <param index="0" name="n" type="Vector3" />
347 <description>
348 Returns the result of reflecting the vector through a plane defined by the given normal vector [param n].
349 [b]Note:[/b] [method reflect] differs from what other engines and frameworks call [code skip-lint]reflect()[/code]. In other engines, [code skip-lint]reflect()[/code] 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 [method bounce] which does what most engines call [code skip-lint]reflect()[/code].
350 </description>
351 </method>
352 <method name="rotated" qualifiers="const">
353 <return type="Vector3" />
354 <param index="0" name="axis" type="Vector3" />
355 <param index="1" name="angle" type="float" />
356 <description>
357 Returns the result of rotating this vector around a given axis by [param angle] (in radians). The axis must be a normalized vector. See also [method @GlobalScope.deg_to_rad].
358 </description>
359 </method>
360 <method name="round" qualifiers="const">
361 <return type="Vector3" />
362 <description>
363 Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
364 </description>
365 </method>
366 <method name="sign" qualifiers="const">
367 <return type="Vector3" />
368 <description>
369 Returns a new vector with each component set to [code]1.0[/code] if it's positive, [code]-1.0[/code] if it's negative, and [code]0.0[/code] if it's zero. The result is identical to calling [method @GlobalScope.sign] on each component.
370 </description>
371 </method>
372 <method name="signed_angle_to" qualifiers="const">
373 <return type="float" />
374 <param index="0" name="to" type="Vector3" />
375 <param index="1" name="axis" type="Vector3" />
376 <description>
377 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 [param axis].
378 </description>
379 </method>
380 <method name="slerp" qualifiers="const" keywords="interpolate">
381 <return type="Vector3" />
382 <param index="0" name="to" type="Vector3" />
383 <param index="1" name="weight" type="float" />
384 <description>
385 Returns the result of spherical linear interpolation between this vector and [param to], by amount [param weight]. [param weight] is on the range of 0.0 to 1.0, representing the amount of interpolation.
386 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 [method lerp].
387 </description>
388 </method>
389 <method name="slide" qualifiers="const">
390 <return type="Vector3" />
391 <param index="0" name="n" type="Vector3" />
392 <description>
393 Returns a new vector resulting from sliding this vector along a plane with normal [param n]. The resulting new vector is perpendicular to [param n], and is equivalent to this vector minus its projection on [param n]. See also [method project].
394 [b]Note:[/b] The vector [param n] must be normalized. See also [method normalized].
395 </description>
396 </method>
397 <method name="snapped" qualifiers="const">
398 <return type="Vector3" />
399 <param index="0" name="step" type="Vector3" />
400 <description>
401 Returns a new vector with each component snapped to the nearest multiple of the corresponding component in [param step]. This can also be used to round the components to an arbitrary number of decimals.
402 </description>
403 </method>
404 <method name="snappedf" qualifiers="const">
405 <return type="Vector3" />
406 <param index="0" name="step" type="float" />
407 <description>
408 Returns a new vector with each component snapped to the nearest multiple of [param step]. This can also be used to round the components to an arbitrary number of decimals.
409 </description>
410 </method>
411 </methods>
412 <members>
413 <member name="x" type="float" setter="" getter="" default="0.0">
414 The vector's X component. Also accessible by using the index position [code][0][/code].
415 </member>
416 <member name="y" type="float" setter="" getter="" default="0.0">
417 The vector's Y component. Also accessible by using the index position [code][1][/code].
418 </member>
419 <member name="z" type="float" setter="" getter="" default="0.0">
420 The vector's Z component. Also accessible by using the index position [code][2][/code].
421 </member>
422 </members>
423 <constants>
424 <constant name="AXIS_X" value="0" enum="Axis">
425 Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index].
426 </constant>
427 <constant name="AXIS_Y" value="1" enum="Axis">
428 Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index].
429 </constant>
430 <constant name="AXIS_Z" value="2" enum="Axis">
431 Enumerated value for the Z axis. Returned by [method max_axis_index] and [method min_axis_index].
432 </constant>
433 <constant name="ZERO" value="Vector3(0, 0, 0)">
434 Zero vector, a vector with all components set to [code]0[/code].
435 </constant>
436 <constant name="ONE" value="Vector3(1, 1, 1)">
437 One vector, a vector with all components set to [code]1[/code].
438 </constant>
439 <constant name="INF" value="Vector3(inf, inf, inf)">
440 Infinity vector, a vector with all components set to [constant @GDScript.INF].
441 </constant>
442 <constant name="LEFT" value="Vector3(-1, 0, 0)">
443 Left unit vector. Represents the local direction of left, and the global direction of west.
444 </constant>
445 <constant name="RIGHT" value="Vector3(1, 0, 0)">
446 Right unit vector. Represents the local direction of right, and the global direction of east.
447 </constant>
448 <constant name="UP" value="Vector3(0, 1, 0)">
449 Up unit vector.
450 </constant>
451 <constant name="DOWN" value="Vector3(0, -1, 0)">
452 Down unit vector.
453 </constant>
454 <constant name="FORWARD" value="Vector3(0, 0, -1)">
455 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 [constant Vector3.MODEL_FRONT] and similar constants when working in 3D asset space.
456 </constant>
457 <constant name="BACK" value="Vector3(0, 0, 1)">
458 Back unit vector. Represents the local direction of back, and the global direction of south.
459 </constant>
460 <constant name="MODEL_LEFT" value="Vector3(1, 0, 0)">
461 Unit vector pointing towards the left side of imported 3D assets.
462 </constant>
463 <constant name="MODEL_RIGHT" value="Vector3(-1, 0, 0)">
464 Unit vector pointing towards the right side of imported 3D assets.
465 </constant>
466 <constant name="MODEL_TOP" value="Vector3(0, 1, 0)">
467 Unit vector pointing towards the top side (up) of imported 3D assets.
468 </constant>
469 <constant name="MODEL_BOTTOM" value="Vector3(0, -1, 0)">
470 Unit vector pointing towards the bottom side (down) of imported 3D assets.
471 </constant>
472 <constant name="MODEL_FRONT" value="Vector3(0, 0, 1)">
473 Unit vector pointing towards the front side (facing forward) of imported 3D assets.
474 </constant>
475 <constant name="MODEL_REAR" value="Vector3(0, 0, -1)">
476 Unit vector pointing towards the rear side (back) of imported 3D assets.
477 </constant>
478 </constants>
479 <operators>
480 <operator name="operator !=">
481 <return type="bool" />
482 <param index="0" name="right" type="Vector3" />
483 <description>
484 Returns [code]true[/code] if the vectors are not equal.
485 [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
486 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
487 </description>
488 </operator>
489 <operator name="operator *">
490 <return type="Vector3" />
491 <param index="0" name="right" type="Basis" />
492 <description>
493 Inversely transforms (multiplies) the [Vector3] by the given [Basis] matrix, under the assumption that the basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
494 [code]vector * basis[/code] is equivalent to [code]basis.transposed() * vector[/code]. See [method Basis.transposed].
495 For transforming by inverse of a non-orthonormal basis (e.g. with scaling) [code]basis.inverse() * vector[/code] can be used instead. See [method Basis.inverse].
496 </description>
497 </operator>
498 <operator name="operator *">
499 <return type="Vector3" />
500 <param index="0" name="right" type="Quaternion" />
501 <description>
502 Inversely transforms (multiplies) the [Vector3] by the given [Quaternion].
503 [code]vector * quaternion[/code] is equivalent to [code]quaternion.inverse() * vector[/code]. See [method Quaternion.inverse].
504 </description>
505 </operator>
506 <operator name="operator *">
507 <return type="Vector3" />
508 <param index="0" name="right" type="Transform3D" />
509 <description>
510 Inversely transforms (multiplies) the [Vector3] by the given [Transform3D] transformation matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not).
511 [code]vector * transform[/code] is equivalent to [code]transform.inverse() * vector[/code]. See [method Transform3D.inverse].
512 For transforming by inverse of an affine transformation (e.g. with scaling) [code]transform.affine_inverse() * vector[/code] can be used instead. See [method Transform3D.affine_inverse].
513 </description>
514 </operator>
515 <operator name="operator *">
516 <return type="Vector3" />
517 <param index="0" name="right" type="Vector3" />
518 <description>
519 Multiplies each component of the [Vector3] by the components of the given [Vector3].
520 [codeblock]
521 print(Vector3(10, 20, 30) * Vector3(3, 4, 5)) # Prints (30.0, 80.0, 150.0)
522 [/codeblock]
523 </description>
524 </operator>
525 <operator name="operator *">
526 <return type="Vector3" />
527 <param index="0" name="right" type="float" />
528 <description>
529 Multiplies each component of the [Vector3] by the given [float].
530 </description>
531 </operator>
532 <operator name="operator *">
533 <return type="Vector3" />
534 <param index="0" name="right" type="int" />
535 <description>
536 Multiplies each component of the [Vector3] by the given [int].
537 </description>
538 </operator>
539 <operator name="operator +">
540 <return type="Vector3" />
541 <param index="0" name="right" type="Vector3" />
542 <description>
543 Adds each component of the [Vector3] by the components of the given [Vector3].
544 [codeblock]
545 print(Vector3(10, 20, 30) + Vector3(3, 4, 5)) # Prints (13.0, 24.0, 35.0)
546 [/codeblock]
547 </description>
548 </operator>
549 <operator name="operator -">
550 <return type="Vector3" />
551 <param index="0" name="right" type="Vector3" />
552 <description>
553 Subtracts each component of the [Vector3] by the components of the given [Vector3].
554 [codeblock]
555 print(Vector3(10, 20, 30) - Vector3(3, 4, 5)) # Prints (7.0, 16.0, 25.0)
556 [/codeblock]
557 </description>
558 </operator>
559 <operator name="operator /">
560 <return type="Vector3" />
561 <param index="0" name="right" type="Vector3" />
562 <description>
563 Divides each component of the [Vector3] by the components of the given [Vector3].
564 [codeblock]
565 print(Vector3(10, 20, 30) / Vector3(2, 5, 3)) # Prints (5.0, 4.0, 10.0)
566 [/codeblock]
567 </description>
568 </operator>
569 <operator name="operator /">
570 <return type="Vector3" />
571 <param index="0" name="right" type="float" />
572 <description>
573 Divides each component of the [Vector3] by the given [float].
574 </description>
575 </operator>
576 <operator name="operator /">
577 <return type="Vector3" />
578 <param index="0" name="right" type="int" />
579 <description>
580 Divides each component of the [Vector3] by the given [int].
581 </description>
582 </operator>
583 <operator name="operator &lt;">
584 <return type="bool" />
585 <param index="0" name="right" type="Vector3" />
586 <description>
587 Compares two [Vector3] vectors by first checking if the X value of the left vector is less than the X value of the [param 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.
588 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
589 </description>
590 </operator>
591 <operator name="operator &lt;=">
592 <return type="bool" />
593 <param index="0" name="right" type="Vector3" />
594 <description>
595 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 [param 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.
596 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
597 </description>
598 </operator>
599 <operator name="operator ==">
600 <return type="bool" />
601 <param index="0" name="right" type="Vector3" />
602 <description>
603 Returns [code]true[/code] if the vectors are exactly equal.
604 [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
605 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
606 </description>
607 </operator>
608 <operator name="operator &gt;">
609 <return type="bool" />
610 <param index="0" name="right" type="Vector3" />
611 <description>
612 Compares two [Vector3] vectors by first checking if the X value of the left vector is greater than the X value of the [param 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.
613 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
614 </description>
615 </operator>
616 <operator name="operator &gt;=">
617 <return type="bool" />
618 <param index="0" name="right" type="Vector3" />
619 <description>
620 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 [param 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.
621 [b]Note:[/b] Vectors with [constant @GDScript.NAN] elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
622 </description>
623 </operator>
624 <operator name="operator []">
625 <return type="float" />
626 <param index="0" name="index" type="int" />
627 <description>
628 Access vector components using their [param index]. [code]v[0][/code] is equivalent to [code]v.x[/code], [code]v[1][/code] is equivalent to [code]v.y[/code], and [code]v[2][/code] is equivalent to [code]v.z[/code].
629 </description>
630 </operator>
631 <operator name="operator unary+">
632 <return type="Vector3" />
633 <description>
634 Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable.
635 </description>
636 </operator>
637 <operator name="operator unary-">
638 <return type="Vector3" />
639 <description>
640 Returns the negative value of the [Vector3]. This is the same as writing [code]Vector3(-v.x, -v.y, -v.z)[/code]. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
641 </description>
642 </operator>
643 </operators>
644 </class>