@ringozz/godot 4.7.2-583 → 4.7.2-592
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -1
- package/gen/classes/ArrayOccluder3D.ts +1 -1
- package/gen/classes/CPUParticles2D.ts +3 -3
- package/gen/classes/CPUParticles3D.ts +3 -3
- package/gen/classes/CSGPolygon3D.ts +1 -1
- package/gen/classes/CollisionPolygon2D.ts +1 -1
- package/gen/classes/CollisionPolygon3D.ts +1 -1
- package/gen/classes/ColorPalette.ts +1 -1
- package/gen/classes/ConcavePolygonShape2D.ts +1 -1
- package/gen/classes/ConcavePolygonShape3D.ts +1 -1
- package/gen/classes/ConvexPolygonShape2D.ts +1 -1
- package/gen/classes/ConvexPolygonShape3D.ts +1 -1
- package/gen/classes/FontVariation.ts +1 -1
- package/gen/classes/Gradient.ts +1 -1
- package/gen/classes/Line2D.ts +1 -1
- package/gen/classes/MultiMesh.ts +4 -4
- package/gen/classes/NavigationMesh.ts +1 -1
- package/gen/classes/NavigationObstacle2D.ts +1 -1
- package/gen/classes/NavigationObstacle3D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult2D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult3D.ts +1 -1
- package/gen/classes/NavigationPolygon.ts +1 -1
- package/gen/classes/OccluderPolygon2D.ts +1 -1
- package/gen/classes/Polygon2D.ts +3 -3
- package/gen/classes/PolygonOccluder3D.ts +1 -1
- package/gen/classes/Window.ts +1 -1
- package/gen/index.ts +0 -3
- package/gen/utility-functions.ts +114 -114
- package/gen/value-types/AABB.ts +267 -277
- package/gen/value-types/Basis.ts +313 -264
- package/gen/value-types/Color.ts +398 -268
- package/gen/value-types/Plane.ts +121 -125
- package/gen/value-types/Projection.ts +178 -126
- package/gen/value-types/Quaternion.ts +180 -179
- package/gen/value-types/Rect2.ts +169 -171
- package/gen/value-types/Rect2i.ts +148 -150
- package/gen/value-types/Transform2D.ts +192 -194
- package/gen/value-types/Transform3D.ts +133 -126
- package/gen/value-types/Vector2.ts +370 -354
- package/gen/value-types/Vector2i.ts +192 -191
- package/gen/value-types/Vector3.ts +354 -354
- package/gen/value-types/Vector3i.ts +187 -192
- package/gen/value-types/Vector4.ts +263 -274
- package/gen/value-types/Vector4i.ts +187 -198
- package/gen/value-types/index.ts +16 -16
- package/package.json +20 -4
- package/src/debug.ts +30 -27
- package/src/index.ts +0 -2
- package/src/runtime.ts +16 -7
package/gen/value-types/Basis.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Auto-generated from extension_api.json - DO NOT EDIT
|
|
2
2
|
// Generated by dev/codegen.ts
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { _V } from '../../src/runtime.ts';
|
|
5
5
|
import type { GodotArray, GodotDictionary, Variant } from '../heap-types/index.ts';
|
|
6
|
-
import type { Quaternion, Vector3 } from '
|
|
6
|
+
import type { Quaternion, Vector3 } from './index.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The {@link Basis} built-in {@link Variant} type is a 3×3 [matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics)) used to represent 3D rotation, scale, and shear. It is frequently used within a {@link Transform3D}.
|
|
@@ -19,265 +19,314 @@ import type { Quaternion, Vector3 } from '../value-types/index.ts';
|
|
|
19
19
|
* **Note:** The basis matrices are exposed as [column-major](https://www.mindcontrol.org/~hplus/graphics/matrix-layout.html) order, which is the same as OpenGL. However, they are stored internally in row-major order, which is the same as DirectX.
|
|
20
20
|
* **Note:** In a boolean context, a basis will evaluate to `false` if it's equal to {@link IDENTITY}. Otherwise, a basis will always evaluate to `true`.
|
|
21
21
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
22
|
+
export type Basis = [x: Vector3, y: Vector3, z: Vector3];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns the [inverse of this basis's matrix](https://en.wikipedia.org/wiki/Invertible_matrix).
|
|
26
|
+
*/
|
|
27
|
+
export function inverse(self: Basis): Basis { return _V(17, 7714, self) as Basis; }
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the transposed version of this basis. This turns the basis matrix's columns into rows, and its rows into columns.
|
|
31
|
+
*
|
|
32
|
+
*
|
|
33
|
+
* ```gdscript
|
|
34
|
+
*
|
|
35
|
+
* var my_basis = Basis(
|
|
36
|
+
* Vector3(1, 2, 3),
|
|
37
|
+
* Vector3(4, 5, 6),
|
|
38
|
+
* Vector3(7, 8, 9)
|
|
39
|
+
* )
|
|
40
|
+
* my_basis = my_basis.transposed()
|
|
41
|
+
*
|
|
42
|
+
* print(my_basis.x) # Prints (1.0, 4.0, 7.0)
|
|
43
|
+
* print(my_basis.y) # Prints (2.0, 5.0, 8.0)
|
|
44
|
+
* print(my_basis.z) # Prints (3.0, 6.0, 9.0)
|
|
45
|
+
*
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function transposed(self: Basis): Basis { return _V(17, 14405, self) as Basis; }
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the orthonormalized version of this basis. An orthonormal basis is both *orthogonal* (the axes are perpendicular to each other) and *normalized* (the axes have a length of `1.0`), which also means it can only represent a rotation.
|
|
52
|
+
* It is often useful to call this method to avoid rounding errors on a rotating basis:
|
|
53
|
+
*
|
|
54
|
+
*
|
|
55
|
+
* ```gdscript
|
|
56
|
+
*
|
|
57
|
+
* # Rotate this Node3D every frame.
|
|
58
|
+
* func _process(delta):
|
|
59
|
+
* basis = basis.rotated(Vector3.UP, TAU * delta)
|
|
60
|
+
* basis = basis.rotated(Vector3.RIGHT, TAU * delta)
|
|
61
|
+
* basis = basis.orthonormalized()
|
|
62
|
+
*
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export function orthonormalized(self: Basis): Basis { return _V(17, 9230, self) as Basis; }
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Returns the [determinant](https://en.wikipedia.org/wiki/Determinant) of this basis's matrix. For advanced math, this number can be used to determine a few attributes:
|
|
69
|
+
* - If the determinant is exactly `0.0`, the basis is not invertible (see {@link inverse}).
|
|
70
|
+
* - If the determinant is a negative number, the basis represents a negative scale.
|
|
71
|
+
* **Note:** If the basis's scale is the same for every axis, its determinant is always that scale by the power of 3.
|
|
72
|
+
*/
|
|
73
|
+
export function determinant(self: Basis): number { return _V(17, 2773, self) as number; }
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns a copy of this basis rotated around the given `axis` by the given `angle` (in radians).
|
|
77
|
+
* The `axis` must be a normalized vector (see {@link Vector3.normalized}). If `angle` is positive, the basis is rotated counter-clockwise around the axis.
|
|
78
|
+
*
|
|
79
|
+
*
|
|
80
|
+
* ```gdscript
|
|
81
|
+
*
|
|
82
|
+
* var my_basis = Basis.IDENTITY
|
|
83
|
+
* var angle = TAU / 2
|
|
84
|
+
*
|
|
85
|
+
* my_basis = my_basis.rotated(Vector3.UP, angle) # Rotate around the up axis (yaw).
|
|
86
|
+
* my_basis = my_basis.rotated(Vector3.RIGHT, angle) # Rotate around the right axis (pitch).
|
|
87
|
+
* my_basis = my_basis.rotated(Vector3.BACK, angle) # Rotate around the back axis (roll).
|
|
88
|
+
*
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export function rotated(self: Basis, axis: Vector3, angle: number): Basis { return _V(17, 10144, self, axis, angle) as Basis; }
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Returns this basis with each axis's components scaled by the given `scale`'s components.
|
|
95
|
+
* The basis matrix's rows are multiplied by `scale`'s components. This operation is a global scale (relative to the parent).
|
|
96
|
+
*
|
|
97
|
+
*
|
|
98
|
+
* ```gdscript
|
|
99
|
+
*
|
|
100
|
+
* var my_basis = Basis(
|
|
101
|
+
* Vector3(1, 1, 1),
|
|
102
|
+
* Vector3(2, 2, 2),
|
|
103
|
+
* Vector3(3, 3, 3)
|
|
104
|
+
* )
|
|
105
|
+
* my_basis = my_basis.scaled(Vector3(0, 2, -2))
|
|
106
|
+
*
|
|
107
|
+
* print(my_basis.x) # Prints (0.0, 2.0, -2.0)
|
|
108
|
+
* print(my_basis.y) # Prints (0.0, 4.0, -4.0)
|
|
109
|
+
* print(my_basis.z) # Prints (0.0, 6.0, -6.0)
|
|
110
|
+
*
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export function scaled(self: Basis, scale: Vector3): Basis { return _V(17, 10232, self, scale) as Basis; }
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns this basis with each axis scaled by the corresponding component in the given `scale`.
|
|
117
|
+
* The basis matrix's columns are multiplied by `scale`'s components. This operation is a local scale (relative to self).
|
|
118
|
+
*
|
|
119
|
+
*
|
|
120
|
+
* ```gdscript
|
|
121
|
+
*
|
|
122
|
+
* var my_basis = Basis(
|
|
123
|
+
* Vector3(1, 1, 1),
|
|
124
|
+
* Vector3(2, 2, 2),
|
|
125
|
+
* Vector3(3, 3, 3)
|
|
126
|
+
* )
|
|
127
|
+
* my_basis = my_basis.scaled_local(Vector3(0, 2, -2))
|
|
128
|
+
*
|
|
129
|
+
* print(my_basis.x) # Prints (0.0, 0.0, 0.0)
|
|
130
|
+
* print(my_basis.y) # Prints (4.0, 4.0, 4.0)
|
|
131
|
+
* print(my_basis.z) # Prints (-6.0, -6.0, -6.0)
|
|
132
|
+
*
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export function scaledLocal(self: Basis, scale: Vector3): Basis { return _V(17, 10233, self, scale) as Basis; }
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Returns the length of each axis of this basis, as a {@link Vector3}. If the basis is not sheared, this value is the scaling factor. It is not affected by rotation.
|
|
139
|
+
*
|
|
140
|
+
*
|
|
141
|
+
* ```gdscript
|
|
142
|
+
*
|
|
143
|
+
* var my_basis = Basis(
|
|
144
|
+
* Vector3(2, 0, 0),
|
|
145
|
+
* Vector3(0, 4, 0),
|
|
146
|
+
* Vector3(0, 0, 8)
|
|
147
|
+
* )
|
|
148
|
+
* # Rotating the Basis in any way preserves its scale.
|
|
149
|
+
* my_basis = my_basis.rotated(Vector3.UP, TAU / 2)
|
|
150
|
+
* my_basis = my_basis.rotated(Vector3.RIGHT, TAU / 4)
|
|
151
|
+
*
|
|
152
|
+
* print(my_basis.get_scale()) # Prints (2.0, 4.0, 8.0)
|
|
153
|
+
*
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
*
|
|
157
|
+
*
|
|
158
|
+
* **Note:** If the value returned by {@link determinant} is negative, the scale is also negative.
|
|
159
|
+
*/
|
|
160
|
+
export function getScale(self: Basis): Vector3 { return _V(17, 6236, self) as Vector3; }
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Returns this basis's rotation as a {@link Vector3} of [Euler angles](https://en.wikipedia.org/wiki/Euler_angles), in radians. For the returned value:
|
|
164
|
+
* - The {@link Vector3.x} contains the angle around the {@link x} axis (pitch);
|
|
165
|
+
* - The {@link Vector3.y} contains the angle around the {@link y} axis (yaw);
|
|
166
|
+
* - The {@link Vector3.z} contains the angle around the {@link z} axis (roll).
|
|
167
|
+
* The order of each consecutive rotation can be changed with `order` (see {@link EulerOrder} constants). In Godot, Euler angles always use intrinsic order. By default, the intrinsic YXZ convention is used ({@link EULER_ORDER_YXZ}): since we are decomposing, local Z (roll) is calculated first, then local X (pitch), and lastly local Y (yaw). When using the opposite method {@link fromEuler} to compose a rotation, this order is reversed.
|
|
168
|
+
* **Note:** For this method to return correctly, the basis needs to be *orthonormal* (see {@link orthonormalized}).
|
|
169
|
+
* **Note:** Euler angles are much more intuitive but are not suitable for 3D math. Because of this, consider using the {@link getRotationQuaternion} method instead, which returns a {@link Quaternion}.
|
|
170
|
+
* **Note:** In the Inspector dock, a basis's rotation is often displayed in Euler angles (in degrees), as is the case with the {@link Node3D.rotation} property.
|
|
171
|
+
*/
|
|
172
|
+
export function getEuler(self: Basis, order?: number /* = 2 */): Vector3 { return _V(17, 4689, self, order) as Vector3; }
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Returns the transposed dot product between `with` and the {@link x} axis (see {@link transposed}).
|
|
176
|
+
* This is equivalent to `basis.x.dot(vector)`.
|
|
177
|
+
*/
|
|
178
|
+
export function tdotx(self: Basis, _with: Vector3): number { return _V(17, 14141, self, _with) as number; }
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns the transposed dot product between `with` and the {@link y} axis (see {@link transposed}).
|
|
182
|
+
* This is equivalent to `basis.y.dot(vector)`.
|
|
183
|
+
*/
|
|
184
|
+
export function tdoty(self: Basis, _with: Vector3): number { return _V(17, 14142, self, _with) as number; }
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the transposed dot product between `with` and the {@link z} axis (see {@link transposed}).
|
|
188
|
+
* This is equivalent to `basis.z.dot(vector)`.
|
|
189
|
+
*/
|
|
190
|
+
export function tdotz(self: Basis, _with: Vector3): number { return _V(17, 14143, self, _with) as number; }
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Performs a spherical-linear interpolation with the `to` basis, given a `weight`. Both this basis and `to` should represent a rotation.
|
|
194
|
+
* **Example:** Smoothly rotate a {@link Node3D} to the target basis over time, with a {@link Tween}:
|
|
195
|
+
*
|
|
196
|
+
* ```text
|
|
197
|
+
*
|
|
198
|
+
* var start_basis = Basis.IDENTITY
|
|
199
|
+
* var target_basis = Basis.IDENTITY.rotated(Vector3.UP, TAU / 2)
|
|
200
|
+
*
|
|
201
|
+
* func _ready():
|
|
202
|
+
* create_tween().tween_method(interpolate, 0.0, 1.0, 5.0).set_trans(Tween.TRANS_EXPO)
|
|
203
|
+
*
|
|
204
|
+
* func interpolate(weight):
|
|
205
|
+
* basis = start_basis.slerp(target_basis, weight)
|
|
206
|
+
*
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function slerp(self: Basis, to: Basis, weight: number): Basis { return _V(17, 13656, self, to, weight) as Basis; }
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns `true` if this basis is conformal. A conformal basis is both *orthogonal* (the axes are perpendicular to each other) and *uniform* (the axes share the same length). This method can be especially useful during physics calculations.
|
|
213
|
+
*/
|
|
214
|
+
export function isConformal(self: Basis): boolean { return _V(17, 7854, self) as boolean; }
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Returns `true` if this basis and `b` are approximately equal, by calling {@link isEqualApprox} on all vector components.
|
|
218
|
+
*/
|
|
219
|
+
export function isEqualApprox(self: Basis, b: Basis): boolean { return _V(17, 7938, self, b) as boolean; }
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Returns `true` if this basis is finite, by calling {@link isFinite} on all vector components.
|
|
223
|
+
*/
|
|
224
|
+
export function isFinite(self: Basis): boolean { return _V(17, 7951, self) as boolean; }
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Returns `true` if this basis is orthonormal. An orthonormal basis is both *orthogonal* (the axes are perpendicular to each other) and *normalized* (the length of every axis is `1.0`). This method can be especially useful during physics calculations.
|
|
228
|
+
*/
|
|
229
|
+
export function isOrthonormal(self: Basis): boolean { return _V(17, 8158, self) as boolean; }
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Returns this basis's rotation as a {@link Quaternion}.
|
|
233
|
+
* **Note:** Quaternions are much more suitable for 3D math but are less intuitive. For user interfaces, consider using the {@link getEuler} method, which returns Euler angles.
|
|
234
|
+
*/
|
|
235
|
+
export function getRotationQuaternion(self: Basis): Quaternion { return _V(17, 6214, self) as Quaternion; }
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Creates a new {@link Basis} with a rotation such that the forward axis (-Z) points towards the `target` position.
|
|
239
|
+
* By default, the -Z axis (camera forward) is treated as forward (implies +X is right). If `useModelFront` is `true`, the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the `target` position.
|
|
240
|
+
* The up axis (+Y) points as close to the `up` vector as possible while staying perpendicular to the forward axis. The returned basis is orthonormalized (see {@link orthonormalized}).
|
|
241
|
+
* The `target` and the `up` cannot be {@link Vector3.ZERO}, and shouldn't be colinear to avoid unintended rotation around local Z axis.
|
|
242
|
+
*/
|
|
243
|
+
export function lookingAt(target: Vector3, up?: Vector3 /* = Vector3(0, 1, 0) */, useModelFront?: boolean /* = false */): Basis { return _V(17, 8708, undefined, target, up, useModelFront) as Basis; }
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Constructs a new {@link Basis} that only represents scale, with no rotation or shear, from the given `scale` vector.
|
|
247
|
+
*
|
|
248
|
+
*
|
|
249
|
+
* ```gdscript
|
|
250
|
+
*
|
|
251
|
+
* var my_basis = Basis.from_scale(Vector3(2, 4, 8))
|
|
252
|
+
*
|
|
253
|
+
* print(my_basis.x) # Prints (2.0, 0.0, 0.0)
|
|
254
|
+
* print(my_basis.y) # Prints (0.0, 4.0, 0.0)
|
|
255
|
+
* print(my_basis.z) # Prints (0.0, 0.0, 8.0)
|
|
256
|
+
*
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
*
|
|
260
|
+
*
|
|
261
|
+
* **Note:** In linear algebra, the matrix of this basis is also known as a [diagonal matrix](https://en.wikipedia.org/wiki/Diagonal_matrix).
|
|
262
|
+
*/
|
|
263
|
+
export function fromScale(scale: Vector3): Basis { return _V(17, 3604, undefined, scale) as Basis; }
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Constructs a new {@link Basis} that only represents rotation from the given {@link Vector3} of [Euler angles](https://en.wikipedia.org/wiki/Euler_angles), in radians.
|
|
267
|
+
* - The {@link Vector3.x} should contain the angle around the {@link x} axis (pitch);
|
|
268
|
+
* - The {@link Vector3.y} should contain the angle around the {@link y} axis (yaw);
|
|
269
|
+
* - The {@link Vector3.z} should contain the angle around the {@link z} axis (roll).
|
|
270
|
+
*
|
|
271
|
+
*
|
|
272
|
+
* ```gdscript
|
|
273
|
+
*
|
|
274
|
+
* # Creates a Basis whose z axis points down.
|
|
275
|
+
* var my_basis = Basis.from_euler(Vector3(TAU / 4, 0, 0))
|
|
276
|
+
*
|
|
277
|
+
* print(my_basis.z) # Prints (0.0, -1.0, 0.0)
|
|
278
|
+
*
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
*
|
|
282
|
+
*
|
|
283
|
+
* The order of each consecutive rotation can be changed with `order` (see {@link EulerOrder} constants). In Godot, Euler angles always use intrinsic order. By default, the intrinsic YXZ convention is used ({@link EULER_ORDER_YXZ}): the basis rotates first around the local Y axis (yaw), then local X (pitch), and lastly local Z (roll). When using the opposite method {@link getEuler} to decompose a rotation, this order is reversed.
|
|
284
|
+
*/
|
|
285
|
+
export function fromEuler(euler: Vector3, order?: number /* = 2 */): Basis { return _V(17, 3595, undefined, euler, order) as Basis; }
|
|
286
|
+
|
|
287
|
+
export function equals(a: Basis, b: Variant | Basis): boolean { return _V(17, -1, a, b) as boolean; }
|
|
288
|
+
|
|
289
|
+
export function notEquals(a: Basis, b: Variant | Basis): boolean { return _V(17, -2, a, b) as boolean; }
|
|
290
|
+
|
|
291
|
+
export function not(self: Basis): boolean { return _V(17, -24, self, undefined) as boolean; }
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Multiplies all components of the {@link Basis} by the given {@link int}. This affects the basis's scale uniformly, resizing all 3 axes by the `right` value.
|
|
295
|
+
*/
|
|
296
|
+
export function mul(a: Basis, b: number | Vector3 | Basis): Basis { return _V(17, -9, a, b) as Basis; }
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Divides all components of the {@link Basis} by the given {@link int}. This affects the basis's scale uniformly, resizing all 3 axes by the `right` value.
|
|
300
|
+
*/
|
|
301
|
+
export function div(a: Basis, b: number): Basis { return _V(17, -10, a, b) as Basis; }
|
|
302
|
+
|
|
303
|
+
export function contains(a: Basis, b: GodotDictionary | GodotArray): boolean { return _V(17, -25, a, b) as boolean; }
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Constructs a {@link Basis} identical to {@link IDENTITY}.
|
|
307
|
+
* **Note:** In C#, this constructs a {@link Basis} with all of its components set to {@link Vector3.ZERO}.
|
|
308
|
+
*/
|
|
309
|
+
export function create(): Basis { return _V(17, -4096, 0) as Basis; }
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Constructs a {@link Basis} as a copy of the given {@link Basis}.
|
|
313
|
+
*/
|
|
314
|
+
export function fromBasis(from: Basis): Basis { return _V(17, -4096, 1, from) as Basis; }
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Constructs a {@link Basis} that only represents rotation from the given {@link Quaternion}.
|
|
318
|
+
* **Note:** Quaternions *only* store rotation, not scale. Because of this, conversions from {@link Basis} to {@link Quaternion} cannot always be reversed.
|
|
319
|
+
*/
|
|
320
|
+
export function fromQuaternion(from: Quaternion): Basis { return _V(17, -4096, 2, from) as Basis; }
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Constructs a {@link Basis} that only represents rotation, rotated around the `axis` by the given `angle`, in radians. The axis must be a normalized vector.
|
|
324
|
+
* **Note:** This is the same as using {@link rotated} on the {@link IDENTITY} basis. With more than one angle consider using {@link fromEuler}, instead.
|
|
325
|
+
*/
|
|
326
|
+
export function fromAxisAngle(axis: Vector3, angle: number): Basis { return _V(17, -4096, 3, axis, angle) as Basis; }
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Constructs a {@link Basis} from 3 axis vectors. These are the columns of the basis matrix.
|
|
330
|
+
*/
|
|
331
|
+
export function fromXAxisYAxisZAxis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Basis { return _V(17, -4096, 4, xAxis, yAxis, zAxis) as Basis; }
|
|
332
|
+
|