Debian Codegraph @

doc/classes/Basis.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Basis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A 3×3 matrix for representing 3D rotation and scale.
5 </brief_description>
6 <description>
7 The [Basis] built-in [Variant] type is a 3×3 [url=https://en.wikipedia.org/wiki/Matrix_(mathematics)]matrix[/url] used to represent 3D rotation, scale, and shear. It is frequently used within a [Transform3D].
8 A [Basis] is composed by 3 axis vectors, each representing a column of the matrix: [member x], [member y], and [member z]. The length of each axis ([method Vector3.length]) influences the basis's scale, while the direction of all axes influence the rotation. Usually, these axes are perpendicular to one another. However, when you rotate any axis individually, the basis becomes sheared. Applying a sheared basis to a 3D model will make the model appear distorted.
9 A [Basis] is:
10 - [b]Orthogonal[/b] if its axes are perpendicular to each other.
11 - [b]Normalized[/b] if the length of every axis is [code]1.0[/code].
12 - [b]Uniform[/b] if all axes share the same length (see [method get_scale]).
13 - [b]Orthonormal[/b] if it is both orthogonal and normalized, which allows it to only represent rotations (see [method orthonormalized]).
14 - [b]Conformal[/b] if it is both orthogonal and uniform, which ensures it is not distorted.
15 For a general introduction, see the [url=$DOCS_URL/tutorials/math/matrices_and_transforms.html]Matrices and transforms[/url] tutorial.
16 [b]Note:[/b] Godot uses a [url=https://en.wikipedia.org/wiki/Right-hand_rule]right-handed coordinate system[/url], which is a common standard. For directions, the convention for built-in types like [Camera3D] is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/model_export_considerations.html#d-asset-direction-conventions]3D asset direction conventions[/url] tutorial.
17 [b]Note:[/b] The basis matrices are exposed as [url=https://www.mindcontrol.org/~hplus/graphics/matrix-layout.html]column-major[/url] order, which is the same as OpenGL. However, they are stored internally in row-major order, which is the same as DirectX.
18 </description>
19 <tutorials>
20 <link title="Math documentation index">$DOCS_URL/tutorials/math/index.html</link>
21 <link title="Matrices and transforms">$DOCS_URL/tutorials/math/matrices_and_transforms.html</link>
22 <link title="Using 3D transforms">$DOCS_URL/tutorials/3d/using_transforms.html</link>
23 <link title="Matrix Transform Demo">https://godotengine.org/asset-library/asset/2787</link>
24 <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/2748</link>
25 <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/2755</link>
26 <link title="2.5D Game Demo">https://godotengine.org/asset-library/asset/2783</link>
27 </tutorials>
28 <constructors>
29 <constructor name="Basis">
30 <return type="Basis" />
31 <description>
32 Constructs a [Basis] identical to [constant IDENTITY].
33 [b]Note:[/b] In C#, this constructs a [Basis] with all of its components set to [constant Vector3.ZERO].
34 </description>
35 </constructor>
36 <constructor name="Basis">
37 <return type="Basis" />
38 <param index="0" name="from" type="Basis" />
39 <description>
40 Constructs a [Basis] as a copy of the given [Basis].
41 </description>
42 </constructor>
43 <constructor name="Basis">
44 <return type="Basis" />
45 <param index="0" name="axis" type="Vector3" />
46 <param index="1" name="angle" type="float" />
47 <description>
48 Constructs a [Basis] that only represents rotation, rotated around the [param axis] by the given [param angle], in radians. The axis must be a normalized vector.
49 [b]Note:[/b] This is the same as using [method rotated] on the [constant IDENTITY] basis. With more than one angle consider using [method from_euler], instead.
50 </description>
51 </constructor>
52 <constructor name="Basis">
53 <return type="Basis" />
54 <param index="0" name="from" type="Quaternion" />
55 <description>
56 Constructs a [Basis] that only represents rotation from the given [Quaternion].
57 [b]Note:[/b] Quaternions [i]only[/i] store rotation, not scale. Because of this, conversions from [Basis] to [Quaternion] cannot always be reversed.
58 </description>
59 </constructor>
60 <constructor name="Basis">
61 <return type="Basis" />
62 <param index="0" name="x_axis" type="Vector3" />
63 <param index="1" name="y_axis" type="Vector3" />
64 <param index="2" name="z_axis" type="Vector3" />
65 <description>
66 Constructs a [Basis] from 3 axis vectors. These are the columns of the basis matrix.
67 </description>
68 </constructor>
69 </constructors>
70 <methods>
71 <method name="determinant" qualifiers="const">
72 <return type="float" />
73 <description>
74 Returns the [url=https://en.wikipedia.org/wiki/Determinant]determinant[/url] of this basis's matrix. For advanced math, this number can be used to determine a few attributes:
75 - If the determinant is exactly [code]0.0[/code], the basis is not invertible (see [method inverse]).
76 - If the determinant is a negative number, the basis represents a negative scale.
77 [b]Note:[/b] If the basis's scale is the same for every axis, its determinant is always that scale by the power of 3.
78 </description>
79 </method>
80 <method name="from_euler" qualifiers="static">
81 <return type="Basis" />
82 <param index="0" name="euler" type="Vector3" />
83 <param index="1" name="order" type="int" default="2" />
84 <description>
85 Constructs a new [Basis] that only represents rotation from the given [Vector3] of [url=https://en.wikipedia.org/wiki/Euler_angles]Euler angles[/url], in radians.
86 - The [member Vector3.x] should contain the angle around the [member x] axis (pitch);
87 - The [member Vector3.y] should contain the angle around the [member y] axis (yaw);
88 - The [member Vector3.z] should contain the angle around the [member z] axis (roll).
89 [codeblocks]
90 [gdscript]
91 # Creates a Basis whose z axis points down.
92 var my_basis = Basis.from_euler(Vector3(TAU / 4, 0, 0))
93
94 print(my_basis.z) # Prints (0.0, -1.0, 0.0)
95 [/gdscript]
96 [csharp]
97 // Creates a Basis whose z axis points down.
98 var myBasis = Basis.FromEuler(new Vector3(Mathf.Tau / 4.0f, 0.0f, 0.0f));
99
100 GD.Print(myBasis.Z); // Prints (0, -1, 0)
101 [/csharp]
102 [/codeblocks]
103 The order of each consecutive rotation can be changed with [param order] (see [enum EulerOrder] constants). By default, the YXZ convention is used ([constant EULER_ORDER_YXZ]): the basis rotates first around the Y axis (yaw), then X (pitch), and lastly Z (roll). When using the opposite method [method get_euler], this order is reversed.
104 </description>
105 </method>
106 <method name="from_scale" qualifiers="static">
107 <return type="Basis" />
108 <param index="0" name="scale" type="Vector3" />
109 <description>
110 Constructs a new [Basis] that only represents scale, with no rotation or shear, from the given [param scale] vector.
111 [codeblocks]
112 [gdscript]
113 var my_basis = Basis.from_scale(Vector3(2, 4, 8))
114
115 print(my_basis.x) # Prints (2.0, 0.0, 0.0)
116 print(my_basis.y) # Prints (0.0, 4.0, 0.0)
117 print(my_basis.z) # Prints (0.0, 0.0, 8.0)
118 [/gdscript]
119 [csharp]
120 var myBasis = Basis.FromScale(new Vector3(2.0f, 4.0f, 8.0f));
121
122 GD.Print(myBasis.X); // Prints (2, 0, 0)
123 GD.Print(myBasis.Y); // Prints (0, 4, 0)
124 GD.Print(myBasis.Z); // Prints (0, 0, 8)
125 [/csharp]
126 [/codeblocks]
127 [b]Note:[/b] In linear algebra, the matrix of this basis is also known as a [url=https://en.wikipedia.org/wiki/Diagonal_matrix]diagonal matrix[/url].
128 </description>
129 </method>
130 <method name="get_euler" qualifiers="const">
131 <return type="Vector3" />
132 <param index="0" name="order" type="int" default="2" />
133 <description>
134 Returns this basis's rotation as a [Vector3] of [url=https://en.wikipedia.org/wiki/Euler_angles]Euler angles[/url], in radians. For the returned value:
135 - The [member Vector3.x] contains the angle around the [member x] axis (pitch);
136 - The [member Vector3.y] contains the angle around the [member y] axis (yaw);
137 - The [member Vector3.z] contains the angle around the [member z] axis (roll).
138 The order of each consecutive rotation can be changed with [param order] (see [enum EulerOrder] constants). By default, the YXZ convention is used ([constant EULER_ORDER_YXZ]): Z (roll) is calculated first, then X (pitch), and lastly Y (yaw). When using the opposite method [method from_euler], this order is reversed.
139 [b]Note:[/b] For this method to return correctly, the basis needs to be [i]orthonormal[/i] (see [method orthonormalized]).
140 [b]Note:[/b] Euler angles are much more intuitive but are not suitable for 3D math. Because of this, consider using the [method get_rotation_quaternion] method instead, which returns a [Quaternion].
141 [b]Note:[/b] In the Inspector dock, a basis's rotation is often displayed in Euler angles (in degrees), as is the case with the [member Node3D.rotation] property.
142 </description>
143 </method>
144 <method name="get_rotation_quaternion" qualifiers="const">
145 <return type="Quaternion" />
146 <description>
147 Returns this basis's rotation as a [Quaternion].
148 [b]Note:[/b] Quaternions are much more suitable for 3D math but are less intuitive. For user interfaces, consider using the [method get_euler] method, which returns Euler angles.
149 </description>
150 </method>
151 <method name="get_scale" qualifiers="const">
152 <return type="Vector3" />
153 <description>
154 Returns the length of each axis of this basis, as a [Vector3]. If the basis is not sheared, this value is the scaling factor. It is not affected by rotation.
155 [codeblocks]
156 [gdscript]
157 var my_basis = Basis(
158 Vector3(2, 0, 0),
159 Vector3(0, 4, 0),
160 Vector3(0, 0, 8)
161 )
162 # Rotating the Basis in any way preserves its scale.
163 my_basis = my_basis.rotated(Vector3.UP, TAU / 2)
164 my_basis = my_basis.rotated(Vector3.RIGHT, TAU / 4)
165
166 print(my_basis.get_scale()) # Prints (2.0, 4.0, 8.0)
167 [/gdscript]
168 [csharp]
169 var myBasis = new Basis(
170 Vector3(2.0f, 0.0f, 0.0f),
171 Vector3(0.0f, 4.0f, 0.0f),
172 Vector3(0.0f, 0.0f, 8.0f)
173 );
174 // Rotating the Basis in any way preserves its scale.
175 myBasis = myBasis.Rotated(Vector3.Up, Mathf.Tau / 2.0f);
176 myBasis = myBasis.Rotated(Vector3.Right, Mathf.Tau / 4.0f);
177
178 GD.Print(myBasis.Scale); // Prints (2, 4, 8)
179 [/csharp]
180 [/codeblocks]
181 [b]Note:[/b] If the value returned by [method determinant] is negative, the scale is also negative.
182 </description>
183 </method>
184 <method name="inverse" qualifiers="const">
185 <return type="Basis" />
186 <description>
187 Returns the [url=https://en.wikipedia.org/wiki/Invertible_matrix]inverse of this basis's matrix[/url].
188 </description>
189 </method>
190 <method name="is_conformal" qualifiers="const">
191 <return type="bool" />
192 <description>
193 Returns [code]true[/code] if this basis is conformal. A conformal basis is both [i]orthogonal[/i] (the axes are perpendicular to each other) and [i]uniform[/i] (the axes share the same length). This method can be especially useful during physics calculations.
194 </description>
195 </method>
196 <method name="is_equal_approx" qualifiers="const">
197 <return type="bool" />
198 <param index="0" name="b" type="Basis" />
199 <description>
200 Returns [code]true[/code] if this basis and [param b] are approximately equal, by calling [method @GlobalScope.is_equal_approx] on all vector components.
201 </description>
202 </method>
203 <method name="is_finite" qualifiers="const">
204 <return type="bool" />
205 <description>
206 Returns [code]true[/code] if this basis is finite, by calling [method @GlobalScope.is_finite] on all vector components.
207 </description>
208 </method>
209 <method name="looking_at" qualifiers="static">
210 <return type="Basis" />
211 <param index="0" name="target" type="Vector3" />
212 <param index="1" name="up" type="Vector3" default="Vector3(0, 1, 0)" />
213 <param index="2" name="use_model_front" type="bool" default="false" />
214 <description>
215 Creates a new [Basis] with a rotation such that the forward axis (-Z) points towards the [param target] position.
216 By default, the -Z axis (camera forward) is treated as forward (implies +X is right). If [param use_model_front] is [code]true[/code], the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the [param target] position.
217 The up axis (+Y) points as close to the [param up] vector as possible while staying perpendicular to the forward axis. The returned basis is orthonormalized (see [method orthonormalized]).
218 The [param target] and the [param up] cannot be [constant Vector3.ZERO], and shouldn't be colinear to avoid unintended rotation around local Z axis.
219 </description>
220 </method>
221 <method name="orthonormalized" qualifiers="const">
222 <return type="Basis" />
223 <description>
224 Returns the orthonormalized version of this basis. An orthonormal basis is both [i]orthogonal[/i] (the axes are perpendicular to each other) and [i]normalized[/i] (the axes have a length of [code]1.0[/code]), which also means it can only represent a rotation.
225 It is often useful to call this method to avoid rounding errors on a rotating basis:
226 [codeblocks]
227 [gdscript]
228 # Rotate this Node3D every frame.
229 func _process(delta):
230 basis = basis.rotated(Vector3.UP, TAU * delta)
231 basis = basis.rotated(Vector3.RIGHT, TAU * delta)
232 basis = basis.orthonormalized()
233 [/gdscript]
234 [csharp]
235 // Rotate this Node3D every frame.
236 public override void _Process(double delta)
237 {
238 Basis = Basis.Rotated(Vector3.Up, Mathf.Tau * (float)delta)
239 .Rotated(Vector3.Right, Mathf.Tau * (float)delta)
240 .Orthonormalized();
241 }
242 [/csharp]
243 [/codeblocks]
244 </description>
245 </method>
246 <method name="rotated" qualifiers="const">
247 <return type="Basis" />
248 <param index="0" name="axis" type="Vector3" />
249 <param index="1" name="angle" type="float" />
250 <description>
251 Returns a copy of this basis rotated around the given [param axis] by the given [param angle] (in radians).
252 The [param axis] must be a normalized vector (see [method Vector3.normalized]). If [param angle] is positive, the basis is rotated counter-clockwise around the axis.
253 [codeblocks]
254 [gdscript]
255 var my_basis = Basis.IDENTITY
256 var angle = TAU / 2
257
258 my_basis = my_basis.rotated(Vector3.UP, angle) # Rotate around the up axis (yaw).
259 my_basis = my_basis.rotated(Vector3.RIGHT, angle) # Rotate around the right axis (pitch).
260 my_basis = my_basis.rotated(Vector3.BACK, angle) # Rotate around the back axis (roll).
261 [/gdscript]
262 [csharp]
263 var myBasis = Basis.Identity;
264 var angle = Mathf.Tau / 2.0f;
265
266 myBasis = myBasis.Rotated(Vector3.Up, angle); // Rotate around the up axis (yaw).
267 myBasis = myBasis.Rotated(Vector3.Right, angle); // Rotate around the right axis (pitch).
268 myBasis = myBasis.Rotated(Vector3.Back, angle); // Rotate around the back axis (roll).
269 [/csharp]
270 [/codeblocks]
271 </description>
272 </method>
273 <method name="scaled" qualifiers="const">
274 <return type="Basis" />
275 <param index="0" name="scale" type="Vector3" />
276 <description>
277 Returns this basis with each axis's components scaled by the given [param scale]'s components.
278 The basis matrix's rows are multiplied by [param scale]'s components. This operation is a global scale (relative to the parent).
279 [codeblocks]
280 [gdscript]
281 var my_basis = Basis(
282 Vector3(1, 1, 1),
283 Vector3(2, 2, 2),
284 Vector3(3, 3, 3)
285 )
286 my_basis = my_basis.scaled(Vector3(0, 2, -2))
287
288 print(my_basis.x) # Prints (0.0, 2.0, -2.0)
289 print(my_basis.y) # Prints (0.0, 4.0, -4.0)
290 print(my_basis.z) # Prints (0.0, 6.0, -6.0)
291 [/gdscript]
292 [csharp]
293 var myBasis = new Basis(
294 new Vector3(1.0f, 1.0f, 1.0f),
295 new Vector3(2.0f, 2.0f, 2.0f),
296 new Vector3(3.0f, 3.0f, 3.0f)
297 );
298 myBasis = myBasis.Scaled(new Vector3(0.0f, 2.0f, -2.0f));
299
300 GD.Print(myBasis.X); // Prints (0, 2, -2)
301 GD.Print(myBasis.Y); // Prints (0, 4, -4)
302 GD.Print(myBasis.Z); // Prints (0, 6, -6)
303 [/csharp]
304 [/codeblocks]
305 </description>
306 </method>
307 <method name="scaled_local" qualifiers="const">
308 <return type="Basis" />
309 <param index="0" name="scale" type="Vector3" />
310 <description>
311 Returns this basis with each axis scaled by the corresponding component in the given [param scale].
312 The basis matrix's columns are multiplied by [param scale]'s components. This operation is a local scale (relative to self).
313 [codeblocks]
314 [gdscript]
315 var my_basis = Basis(
316 Vector3(1, 1, 1),
317 Vector3(2, 2, 2),
318 Vector3(3, 3, 3)
319 )
320 my_basis = my_basis.scaled_local(Vector3(0, 2, -2))
321
322 print(my_basis.x) # Prints (0.0, 0.0, 0.0)
323 print(my_basis.y) # Prints (4.0, 4.0, 4.0)
324 print(my_basis.z) # Prints (-6.0, -6.0, -6.0)
325 [/gdscript]
326 [csharp]
327 var myBasis = new Basis(
328 new Vector3(1.0f, 1.0f, 1.0f),
329 new Vector3(2.0f, 2.0f, 2.0f),
330 new Vector3(3.0f, 3.0f, 3.0f)
331 );
332 myBasis = myBasis.ScaledLocal(new Vector3(0.0f, 2.0f, -2.0f));
333
334 GD.Print(myBasis.X); // Prints (0, 0, 0)
335 GD.Print(myBasis.Y); // Prints (4, 4, 4)
336 GD.Print(myBasis.Z); // Prints (-6, -6, -6)
337 [/csharp]
338 [/codeblocks]
339 </description>
340 </method>
341 <method name="slerp" qualifiers="const" keywords="interpolate">
342 <return type="Basis" />
343 <param index="0" name="to" type="Basis" />
344 <param index="1" name="weight" type="float" />
345 <description>
346 Performs a spherical-linear interpolation with the [param to] basis, given a [param weight]. Both this basis and [param to] should represent a rotation.
347 [b]Example:[/b] Smoothly rotate a [Node3D] to the target basis over time, with a [Tween]:
348 [codeblock]
349 var start_basis = Basis.IDENTITY
350 var target_basis = Basis.IDENTITY.rotated(Vector3.UP, TAU / 2)
351
352 func _ready():
353 create_tween().tween_method(interpolate, 0.0, 1.0, 5.0).set_trans(Tween.TRANS_EXPO)
354
355 func interpolate(weight):
356 basis = start_basis.slerp(target_basis, weight)
357 [/codeblock]
358 </description>
359 </method>
360 <method name="tdotx" qualifiers="const">
361 <return type="float" />
362 <param index="0" name="with" type="Vector3" />
363 <description>
364 Returns the transposed dot product between [param with] and the [member x] axis (see [method transposed]).
365 This is equivalent to [code]basis.x.dot(vector)[/code].
366 </description>
367 </method>
368 <method name="tdoty" qualifiers="const">
369 <return type="float" />
370 <param index="0" name="with" type="Vector3" />
371 <description>
372 Returns the transposed dot product between [param with] and the [member y] axis (see [method transposed]).
373 This is equivalent to [code]basis.y.dot(vector)[/code].
374 </description>
375 </method>
376 <method name="tdotz" qualifiers="const">
377 <return type="float" />
378 <param index="0" name="with" type="Vector3" />
379 <description>
380 Returns the transposed dot product between [param with] and the [member z] axis (see [method transposed]).
381 This is equivalent to [code]basis.z.dot(vector)[/code].
382 </description>
383 </method>
384 <method name="transposed" qualifiers="const">
385 <return type="Basis" />
386 <description>
387 Returns the transposed version of this basis. This turns the basis matrix's columns into rows, and its rows into columns.
388 [codeblocks]
389 [gdscript]
390 var my_basis = Basis(
391 Vector3(1, 2, 3),
392 Vector3(4, 5, 6),
393 Vector3(7, 8, 9)
394 )
395 my_basis = my_basis.transposed()
396
397 print(my_basis.x) # Prints (1.0, 4.0, 7.0)
398 print(my_basis.y) # Prints (2.0, 5.0, 8.0)
399 print(my_basis.z) # Prints (3.0, 6.0, 9.0)
400 [/gdscript]
401 [csharp]
402 var myBasis = new Basis(
403 new Vector3(1.0f, 2.0f, 3.0f),
404 new Vector3(4.0f, 5.0f, 6.0f),
405 new Vector3(7.0f, 8.0f, 9.0f)
406 );
407 myBasis = myBasis.Transposed();
408
409 GD.Print(myBasis.X); // Prints (1, 4, 7)
410 GD.Print(myBasis.Y); // Prints (2, 5, 8)
411 GD.Print(myBasis.Z); // Prints (3, 6, 9)
412 [/csharp]
413 [/codeblocks]
414 </description>
415 </method>
416 </methods>
417 <members>
418 <member name="x" type="Vector3" setter="" getter="" default="Vector3(1, 0, 0)">
419 The basis's X axis, and the column [code]0[/code] of the matrix.
420 On the identity basis, this vector points right ([constant Vector3.RIGHT]).
421 </member>
422 <member name="y" type="Vector3" setter="" getter="" default="Vector3(0, 1, 0)">
423 The basis's Y axis, and the column [code]1[/code] of the matrix.
424 On the identity basis, this vector points up ([constant Vector3.UP]).
425 </member>
426 <member name="z" type="Vector3" setter="" getter="" default="Vector3(0, 0, 1)">
427 The basis's Z axis, and the column [code]2[/code] of the matrix.
428 On the identity basis, this vector points back ([constant Vector3.BACK]).
429 </member>
430 </members>
431 <constants>
432 <constant name="IDENTITY" value="Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)">
433 The identity [Basis]. This is an orthonormal basis with no rotation, no shear, and a scale of [constant Vector3.ONE]. This also means that:
434 - The [member x] points right ([constant Vector3.RIGHT]);
435 - The [member y] points up ([constant Vector3.UP]);
436 - The [member z] points back ([constant Vector3.BACK]).
437 [codeblock]
438 var basis = Basis.IDENTITY
439 print("| X | Y | Z")
440 print("| %.f | %.f | %.f" % [basis.x.x, basis.y.x, basis.z.x])
441 print("| %.f | %.f | %.f" % [basis.x.y, basis.y.y, basis.z.y])
442 print("| %.f | %.f | %.f" % [basis.x.z, basis.y.z, basis.z.z])
443 # Prints:
444 # | X | Y | Z
445 # | 1 | 0 | 0
446 # | 0 | 1 | 0
447 # | 0 | 0 | 1
448 [/codeblock]
449 If a [Vector3] or another [Basis] is transformed (multiplied) by this constant, no transformation occurs.
450 [b]Note:[/b] In GDScript, this constant is equivalent to creating a [constructor Basis] without any arguments. It can be used to make your code clearer, and for consistency with C#.
451 </constant>
452 <constant name="FLIP_X" value="Basis(-1, 0, 0, 0, 1, 0, 0, 0, 1)">
453 When any basis is multiplied by [constant FLIP_X], it negates all components of the [member x] axis (the X column).
454 When [constant FLIP_X] is multiplied by any basis, it negates the [member Vector3.x] component of all axes (the X row).
455 </constant>
456 <constant name="FLIP_Y" value="Basis(1, 0, 0, 0, -1, 0, 0, 0, 1)">
457 When any basis is multiplied by [constant FLIP_Y], it negates all components of the [member y] axis (the Y column).
458 When [constant FLIP_Y] is multiplied by any basis, it negates the [member Vector3.y] component of all axes (the Y row).
459 </constant>
460 <constant name="FLIP_Z" value="Basis(1, 0, 0, 0, 1, 0, 0, 0, -1)">
461 When any basis is multiplied by [constant FLIP_Z], it negates all components of the [member z] axis (the Z column).
462 When [constant FLIP_Z] is multiplied by any basis, it negates the [member Vector3.z] component of all axes (the Z row).
463 </constant>
464 </constants>
465 <operators>
466 <operator name="operator !=">
467 <return type="bool" />
468 <param index="0" name="right" type="Basis" />
469 <description>
470 Returns [code]true[/code] if the components of both [Basis] matrices are not equal.
471 [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
472 </description>
473 </operator>
474 <operator name="operator *">
475 <return type="Basis" />
476 <param index="0" name="right" type="Basis" />
477 <description>
478 Transforms (multiplies) the [param right] basis by this basis.
479 This is the operation performed between parent and child [Node3D]s.
480 </description>
481 </operator>
482 <operator name="operator *">
483 <return type="Vector3" />
484 <param index="0" name="right" type="Vector3" />
485 <description>
486 Transforms (multiplies) the [param right] vector by this basis, returning a [Vector3].
487 [codeblocks]
488 [gdscript]
489 # Basis that swaps the X/Z axes and doubles the scale.
490 var my_basis = Basis(Vector3(0, 2, 0), Vector3(2, 0, 0), Vector3(0, 0, 2))
491 print(my_basis * Vector3(1, 2, 3)) # Prints (4.0, 2.0, 6.0)
492 [/gdscript]
493 [csharp]
494 // Basis that swaps the X/Z axes and doubles the scale.
495 var myBasis = new Basis(new Vector3(0, 2, 0), new Vector3(2, 0, 0), new Vector3(0, 0, 2));
496 GD.Print(myBasis * new Vector3(1, 2, 3)); // Prints (4, 2, 6)
497 [/csharp]
498 [/codeblocks]
499 </description>
500 </operator>
501 <operator name="operator *">
502 <return type="Basis" />
503 <param index="0" name="right" type="float" />
504 <description>
505 Multiplies all components of the [Basis] by the given [float]. This affects the basis's scale uniformly, resizing all 3 axes by the [param right] value.
506 </description>
507 </operator>
508 <operator name="operator *">
509 <return type="Basis" />
510 <param index="0" name="right" type="int" />
511 <description>
512 Multiplies all components of the [Basis] by the given [int]. This affects the basis's scale uniformly, resizing all 3 axes by the [param right] value.
513 </description>
514 </operator>
515 <operator name="operator /">
516 <return type="Basis" />
517 <param index="0" name="right" type="float" />
518 <description>
519 Divides all components of the [Basis] by the given [float]. This affects the basis's scale uniformly, resizing all 3 axes by the [param right] value.
520 </description>
521 </operator>
522 <operator name="operator /">
523 <return type="Basis" />
524 <param index="0" name="right" type="int" />
525 <description>
526 Divides all components of the [Basis] by the given [int]. This affects the basis's scale uniformly, resizing all 3 axes by the [param right] value.
527 </description>
528 </operator>
529 <operator name="operator ==">
530 <return type="bool" />
531 <param index="0" name="right" type="Basis" />
532 <description>
533 Returns [code]true[/code] if the components of both [Basis] matrices are exactly equal.
534 [b]Note:[/b] Due to floating-point precision errors, consider using [method is_equal_approx] instead, which is more reliable.
535 </description>
536 </operator>
537 <operator name="operator []">
538 <return type="Vector3" />
539 <param index="0" name="index" type="int" />
540 <description>
541 Accesses each axis (column) of this basis by their index. Index [code]0[/code] is the same as [member x], index [code]1[/code] is the same as [member y], and index [code]2[/code] is the same as [member z].
542 [b]Note:[/b] In C++, this operator accesses the rows of the basis matrix, [i]not[/i] the columns. For the same behavior as scripting languages, use the [code]set_column[/code] and [code]get_column[/code] methods.
543 </description>
544 </operator>
545 </operators>
546 </class>