@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
|
@@ -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, PackedVector3Array, Variant } from '../heap-types/index.ts';
|
|
6
|
-
import type { Basis, Quaternion, Transform3D, Vector2, Vector3i } from '
|
|
6
|
+
import type { Basis, Quaternion, Transform3D, Vector2, Vector3i } from './index.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A 3-element structure that can be used to represent 3D coordinates or any other triplet of numeric values.
|
|
@@ -11,355 +11,355 @@ import type { Basis, Quaternion, Transform3D, Vector2, Vector3i } from '../value
|
|
|
11
11
|
* See {@link Vector3i} for its integer counterpart.
|
|
12
12
|
* **Note:** In a boolean context, a Vector3 will evaluate to `false` if it's equal to `Vector3(0, 0, 0)`. Otherwise, a Vector3 will always evaluate to `true`.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
14
|
+
export type Vector3 = [x: number, y: number, z: number];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the axis of the vector's lowest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_Z}.
|
|
18
|
+
*/
|
|
19
|
+
export function minAxisIndex(self: Vector3): number { return _V(9, 8911, self) as number; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns the axis of the vector's highest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_X}.
|
|
23
|
+
*/
|
|
24
|
+
export function maxAxisIndex(self: Vector3): number { return _V(9, 8806, self) as number; }
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns the unsigned minimum angle to the given vector, in radians.
|
|
28
|
+
*/
|
|
29
|
+
export function angleTo(self: Vector3, to: Vector3): number { return _V(9, 1453, self, to) as number; }
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 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 `axis`.
|
|
33
|
+
*/
|
|
34
|
+
export function signedAngleTo(self: Vector3, to: Vector3, axis: Vector3): number { return _V(9, 13598, self, to, axis) as number; }
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns the normalized vector pointing from this vector to `to`. This is equivalent to using `(b - a).normalized()`.
|
|
38
|
+
*/
|
|
39
|
+
export function directionTo(self: Vector3, to: Vector3): Vector3 { return _V(9, 2792, self, to) as Vector3; }
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns the [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
|
|
43
|
+
*/
|
|
44
|
+
export function distanceTo(self: Vector3, to: Vector3): number { return _V(9, 2850, self, to) as number; }
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Returns the squared [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
|
|
48
|
+
* This method runs faster than {@link distanceTo}, so prefer it if you need to compare vectors or need the squared distance for some formula.
|
|
49
|
+
*/
|
|
50
|
+
export function distanceSquaredTo(self: Vector3, to: Vector3): number { return _V(9, 2849, self, to) as number; }
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the length (magnitude) of this vector.
|
|
54
|
+
*/
|
|
55
|
+
export function length(self: Vector3): number { return _V(9, 8546, self) as number; }
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns the squared length (squared magnitude) of this vector.
|
|
59
|
+
* This method runs faster than {@link length}, so prefer it if you need to compare vectors or need the squared distance for some formula.
|
|
60
|
+
*/
|
|
61
|
+
export function lengthSquared(self: Vector3): number { return _V(9, 8547, self) as number; }
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns the vector with a maximum length by limiting its length to `length`. If the vector is non-finite, the result is undefined.
|
|
65
|
+
*/
|
|
66
|
+
export function limitLength(self: Vector3, length?: number /* = 1.0 */): Vector3 { return _V(9, 8615, self, length) as Vector3; }
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns the result of scaling the vector to unit length. Equivalent to `v / v.length()`. Returns `(0, 0, 0)` if `v.length() == 0`. See also {@link isNormalized}.
|
|
70
|
+
* **Note:** This function may return incorrect values if the input vector length is near zero.
|
|
71
|
+
*/
|
|
72
|
+
export function normalized(self: Vector3): Vector3 { return _V(9, 9103, self) as Vector3; }
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns `true` if the vector is normalized, i.e. its length is approximately equal to 1.
|
|
76
|
+
*/
|
|
77
|
+
export function isNormalized(self: Vector3): boolean { return _V(9, 8138, self) as boolean; }
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Returns `true` if this vector and `to` are approximately equal, by running {@link isEqualApprox} on each component.
|
|
81
|
+
*/
|
|
82
|
+
export function isEqualApprox(self: Vector3, to: Vector3): boolean { return _V(9, 7938, self, to) as boolean; }
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns `true` if this vector's values are approximately zero, by running {@link isZeroApprox} on each component.
|
|
86
|
+
* This method is faster than using {@link isEqualApprox} with one value as a zero vector.
|
|
87
|
+
*/
|
|
88
|
+
export function isZeroApprox(self: Vector3): boolean { return _V(9, 8459, self) as boolean; }
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns `true` if this vector is finite, by calling {@link isFinite} on each component.
|
|
92
|
+
*/
|
|
93
|
+
export function isFinite(self: Vector3): boolean { return _V(9, 7951, self) as boolean; }
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Returns the inverse of the vector. This is the same as `Vector3(1.0 / v.x, 1.0 / v.y, 1.0 / v.z)`.
|
|
97
|
+
*/
|
|
98
|
+
export function inverse(self: Vector3): Vector3 { return _V(9, 7714, self) as Vector3; }
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Returns a new vector with all components clamped between the components of `min` and `max`, by running {@link clamp} on each component.
|
|
102
|
+
*/
|
|
103
|
+
export function clamp(self: Vector3, min: Vector3, max: Vector3): Vector3 { return _V(9, 2202, self, min, max) as Vector3; }
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Returns a new vector with all components clamped between `min` and `max`, by running {@link clamp} on each component.
|
|
107
|
+
*/
|
|
108
|
+
export function clampf(self: Vector3, min: number, max: number): Vector3 { return _V(9, 2205, self, min, max) as Vector3; }
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns a new vector with each component snapped to the nearest multiple of the corresponding component in `step`. This can also be used to round the components to an arbitrary number of decimals.
|
|
112
|
+
*/
|
|
113
|
+
export function snapped(self: Vector3, step: Vector3): Vector3 { return _V(9, 13674, self, step) as Vector3; }
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Returns a new vector with each component snapped to the nearest multiple of `step`. This can also be used to round the components to an arbitrary number of decimals.
|
|
117
|
+
*/
|
|
118
|
+
export function snappedf(self: Vector3, step: number): Vector3 { return _V(9, 13675, self, step) as Vector3; }
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Returns the result of rotating this vector around a given axis by `angle` (in radians). The axis must be a normalized vector. See also {@link degToRad}.
|
|
122
|
+
*/
|
|
123
|
+
export function rotated(self: Vector3, axis: Vector3, angle: number): Vector3 { return _V(9, 10144, self, axis, angle) as Vector3; }
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Returns the result of the linear interpolation between this vector and `to` by amount `weight`. `weight` is on the range of `0.0` to `1.0`, representing the amount of interpolation.
|
|
127
|
+
*/
|
|
128
|
+
export function lerp(self: Vector3, to: Vector3, weight: number): Vector3 { return _V(9, 8548, self, to, weight) as Vector3; }
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns the result of spherical linear interpolation between this vector and `to`, by amount `weight`. `weight` is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
|
132
|
+
* 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 {@link lerp}.
|
|
133
|
+
*/
|
|
134
|
+
export function slerp(self: Vector3, to: Vector3, weight: number): Vector3 { return _V(9, 13656, self, to, weight) as Vector3; }
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Performs a cubic interpolation between this vector and `b` using `preA` and `postB` as handles, and returns the result at position `weight`. `weight` is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
|
138
|
+
*/
|
|
139
|
+
export function cubicInterpolate(self: Vector3, b: Vector3, preA: Vector3, postB: Vector3, weight: number): Vector3 { return _V(9, 2590, self, b, preA, postB, weight) as Vector3; }
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Performs a cubic interpolation between this vector and `b` using `preA` and `postB` as handles, and returns the result at position `weight`. `weight` is on the range of 0.0 to 1.0, representing the amount of interpolation.
|
|
143
|
+
* It can perform smoother interpolation than {@link cubicInterpolate} by the time values.
|
|
144
|
+
*/
|
|
145
|
+
export function cubicInterpolateInTime(self: Vector3, b: Vector3, preA: Vector3, postB: Vector3, weight: number, bT: number, preAT: number, postBT: number): Vector3 { return _V(9, 2593, self, b, preA, postB, weight, bT, preAT, postBT) as Vector3; }
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Returns the point at the given `t` on the [Bézier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) defined by this vector and the given `control1`, `control2`, and `end` points.
|
|
149
|
+
*/
|
|
150
|
+
export function bezierInterpolate(self: Vector3, control1: Vector3, control2: Vector3, end: Vector3, t: number): Vector3 { return _V(9, 1757, self, control1, control2, end, t) as Vector3; }
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Returns the derivative at the given `t` on the [Bézier curve](https://en.wikipedia.org/wiki/B%C3%A9zier_curve) defined by this vector and the given `control1`, `control2`, and `end` points.
|
|
154
|
+
*/
|
|
155
|
+
export function bezierDerivative(self: Vector3, control1: Vector3, control2: Vector3, end: Vector3, t: number): Vector3 { return _V(9, 1756, self, control1, control2, end, t) as Vector3; }
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Returns a new vector moved toward `to` by the fixed `delta` amount. Will not go past the final value.
|
|
159
|
+
*/
|
|
160
|
+
export function moveToward(self: Vector3, to: Vector3, delta: number): Vector3 { return _V(9, 9004, self, to, delta) as Vector3; }
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Returns the dot product of this vector and `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.
|
|
164
|
+
* The dot product will be `0` 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.
|
|
165
|
+
* When using unit (normalized) vectors, the result will always be between `-1.0` (180 degree angle) when the vectors are facing opposite directions, and `1.0` (0 degree angle) when the vectors are aligned.
|
|
166
|
+
* **Note:** `a.dot(b)` is equivalent to `b.dot(a)`.
|
|
167
|
+
*/
|
|
168
|
+
export function dot(self: Vector3, _with: Vector3): number { return _V(9, 2871, self, _with) as number; }
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Returns the cross product of this vector and `with`.
|
|
172
|
+
* This returns a vector perpendicular to both this and `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.
|
|
173
|
+
*/
|
|
174
|
+
export function cross(self: Vector3, _with: Vector3): Vector3 { return _V(9, 2586, self, _with) as Vector3; }
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Returns the outer product with `with`.
|
|
178
|
+
*/
|
|
179
|
+
export function outer(self: Vector3, _with: Vector3): Basis { return _V(9, 9232, self, _with) as Basis; }
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Returns a new vector with all components in absolute values (i.e. positive).
|
|
183
|
+
*/
|
|
184
|
+
export function abs(self: Vector3): Vector3 { return _V(9, 1053, self) as Vector3; }
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns a new vector with all components rounded down (towards negative infinity).
|
|
188
|
+
*/
|
|
189
|
+
export function floor(self: Vector3): Vector3 { return _V(9, 3335, self) as Vector3; }
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns a new vector with all components rounded up (towards positive infinity).
|
|
193
|
+
*/
|
|
194
|
+
export function ceil(self: Vector3): Vector3 { return _V(9, 2156, self) as Vector3; }
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Returns a new vector with all components rounded to the nearest integer, with halfway cases rounded away from zero.
|
|
198
|
+
*/
|
|
199
|
+
export function round(self: Vector3): Vector3 { return _V(9, 10166, self) as Vector3; }
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Returns a vector composed of the {@link fposmod} of this vector's components and `mod`.
|
|
203
|
+
*/
|
|
204
|
+
export function posmod(self: Vector3, mod: number): Vector3 { return _V(9, 9518, self, mod) as Vector3; }
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Returns a vector composed of the {@link fposmod} of this vector's components and `modv`'s components.
|
|
208
|
+
*/
|
|
209
|
+
export function posmodv(self: Vector3, modv: Vector3): Vector3 { return _V(9, 9519, self, modv) as Vector3; }
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns a new vector resulting from projecting this vector onto the given vector `b`. The resulting new vector is parallel to `b`. See also {@link slide}.
|
|
213
|
+
* **Note:** If the vector `b` is a zero vector, the components of the resulting new vector will be `NAN`.
|
|
214
|
+
*/
|
|
215
|
+
export function project(self: Vector3, b: Vector3): Vector3 { return _V(9, 9589, self, b) as Vector3; }
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Returns a new vector resulting from sliding this vector along a plane with normal `n`. The resulting new vector is perpendicular to `n`, and is equivalent to this vector minus its projection on `n`. See also {@link project}.
|
|
219
|
+
* **Note:** The vector `n` must be normalized. See also {@link normalized}.
|
|
220
|
+
*/
|
|
221
|
+
export function slide(self: Vector3, n: Vector3): Vector3 { return _V(9, 13659, self, n) as Vector3; }
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Returns the vector "bounced off" from a plane defined by the given normal `n`.
|
|
225
|
+
* **Note:** {@link bounce} performs the operation that most engines and frameworks call {@link code skip-lint}reflect()[/code].
|
|
226
|
+
*/
|
|
227
|
+
export function bounce(self: Vector3, n: Vector3): Vector3 { return _V(9, 1902, self, n) as Vector3; }
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Returns the result of reflecting the vector through a plane defined by the given normal vector `n`.
|
|
231
|
+
* **Note:** {@link reflect} differs from what other engines and frameworks call {@link code skip-lint}reflect()[/code]. In other engines, {@link 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 {@link bounce} which does what most engines call {@link code skip-lint}reflect()[/code].
|
|
232
|
+
*/
|
|
233
|
+
export function reflect(self: Vector3, n: Vector3): Vector3 { return _V(9, 9776, self, n) as Vector3; }
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Returns a new vector with each component set to `1.0` if it's positive, `-1.0` if it's negative, and `0.0` if it's zero. The result is identical to calling {@link sign} on each component.
|
|
237
|
+
*/
|
|
238
|
+
export function sign(self: Vector3): Vector3 { return _V(9, 13597, self) as Vector3; }
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Returns the octahedral-encoded (oct32) form of this {@link Vector3} as a {@link Vector2}. Since a {@link Vector2} occupies 1/3 less memory compared to {@link Vector3}, this form of compression can be used to pass greater amounts of {@link normalized} {@link Vector3}s without increasing storage or memory requirements. See also {@link octahedronDecode}.
|
|
242
|
+
* **Note:** {@link octahedronEncode} can only be used for {@link normalized} vectors. {@link octahedronEncode} does *not* check whether this {@link Vector3} is normalized, and will return a value that does not decompress to the original value if the {@link Vector3} is not normalized.
|
|
243
|
+
* **Note:** Octahedral compression is *lossy*, although visual differences are rarely perceptible in real world scenarios.
|
|
244
|
+
*/
|
|
245
|
+
export function octahedronEncode(self: Vector3): Vector2 { return _V(9, 9151, self) as Vector2; }
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Returns the component-wise minimum of this and `with`, equivalent to `Vector3(minf(x, with.x), minf(y, with.y), minf(z, with.z))`.
|
|
249
|
+
*/
|
|
250
|
+
export function min(self: Vector3, _with: Vector3): Vector3 { return _V(9, 8910, self, _with) as Vector3; }
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Returns the component-wise minimum of this and `with`, equivalent to `Vector3(minf(x, with), minf(y, with), minf(z, with))`.
|
|
254
|
+
*/
|
|
255
|
+
export function minf(self: Vector3, _with: number): Vector3 { return _V(9, 8921, self, _with) as Vector3; }
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Returns the component-wise maximum of this and `with`, equivalent to `Vector3(maxf(x, with.x), maxf(y, with.y), maxf(z, with.z))`.
|
|
259
|
+
*/
|
|
260
|
+
export function max(self: Vector3, _with: Vector3): Vector3 { return _V(9, 8804, self, _with) as Vector3; }
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Returns the component-wise maximum of this and `with`, equivalent to `Vector3(maxf(x, with), maxf(y, with), maxf(z, with))`.
|
|
264
|
+
*/
|
|
265
|
+
export function maxf(self: Vector3, _with: number): Vector3 { return _V(9, 8839, self, _with) as Vector3; }
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Returns the {@link Vector3} from an octahedral-compressed form created using {@link octahedronEncode} (stored as a {@link Vector2}).
|
|
269
|
+
*/
|
|
270
|
+
export function octahedronDecode(uv: Vector2): Vector3 { return _V(9, 9150, undefined, uv) as Vector3; }
|
|
271
|
+
|
|
272
|
+
export function equals(a: Vector3, b: Variant | Vector3): boolean { return _V(9, -1, a, b) as boolean; }
|
|
273
|
+
|
|
274
|
+
export function notEquals(a: Vector3, b: Variant | Vector3): boolean { return _V(9, -2, a, b) as boolean; }
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Returns the negative value of the {@link Vector3}. This is the same as writing `Vector3(-v.x, -v.y, -v.z)`. This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative.
|
|
278
|
+
*/
|
|
279
|
+
export function neg(self: Vector3): Vector3 { return _V(9, -11, self, undefined) as Vector3; }
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Returns the same value as if the `+` was not there. Unary `+` does nothing, but sometimes it can make your code more readable.
|
|
283
|
+
*/
|
|
284
|
+
export function pos(self: Vector3): Vector3 { return _V(9, -12, self, undefined) as Vector3; }
|
|
285
|
+
|
|
286
|
+
export function not(self: Vector3): boolean { return _V(9, -24, self, undefined) as boolean; }
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Multiplies each component of the {@link Vector3} by the given {@link int}.
|
|
290
|
+
*/
|
|
291
|
+
export function mul(a: Vector3, b: number | Vector3 | Quaternion | Basis | Transform3D): Vector3 { return _V(9, -9, a, b) as Vector3; }
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Divides each component of the {@link Vector3} by the given {@link int}.
|
|
295
|
+
*/
|
|
296
|
+
export function div(a: Vector3, b: number | Vector3): Vector3 { return _V(9, -10, a, b) as Vector3; }
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Compares two {@link Vector3} vectors by first checking if the X value of the left vector is less than the X value of the `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.
|
|
300
|
+
* **Note:** Vectors with `NAN` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
|
|
301
|
+
*/
|
|
302
|
+
export function lessThan(a: Vector3, b: Vector3): boolean { return _V(9, -3, a, b) as boolean; }
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Compares two {@link Vector3} vectors by first checking if the X value of the left vector is less than or equal to the X value of the `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.
|
|
306
|
+
* **Note:** Vectors with `NAN` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
|
|
307
|
+
*/
|
|
308
|
+
export function lessThanOrEqual(a: Vector3, b: Vector3): boolean { return _V(9, -4, a, b) as boolean; }
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Compares two {@link Vector3} vectors by first checking if the X value of the left vector is greater than the X value of the `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.
|
|
312
|
+
* **Note:** Vectors with `NAN` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
|
|
313
|
+
*/
|
|
314
|
+
export function greaterThan(a: Vector3, b: Vector3): boolean { return _V(9, -5, a, b) as boolean; }
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Compares two {@link Vector3} vectors by first checking if the X value of the left vector is greater than or equal to the X value of the `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.
|
|
318
|
+
* **Note:** Vectors with `NAN` elements don't behave the same as other vectors. Therefore, the results from this operator may not be accurate if NaNs are included.
|
|
319
|
+
*/
|
|
320
|
+
export function greaterThanOrEqual(a: Vector3, b: Vector3): boolean { return _V(9, -6, a, b) as boolean; }
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Adds each component of the {@link Vector3} by the components of the given {@link Vector3}.
|
|
324
|
+
*
|
|
325
|
+
* ```text
|
|
326
|
+
*
|
|
327
|
+
* print(Vector3(10, 20, 30) + Vector3(3, 4, 5)) # Prints (13.0, 24.0, 35.0)
|
|
328
|
+
*
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export function add(a: Vector3, b: Vector3): Vector3 { return _V(9, -7, a, b) as Vector3; }
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Subtracts each component of the {@link Vector3} by the components of the given {@link Vector3}.
|
|
335
|
+
*
|
|
336
|
+
* ```text
|
|
337
|
+
*
|
|
338
|
+
* print(Vector3(10, 20, 30) - Vector3(3, 4, 5)) # Prints (7.0, 16.0, 25.0)
|
|
339
|
+
*
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export function sub(a: Vector3, b: Vector3): Vector3 { return _V(9, -8, a, b) as Vector3; }
|
|
343
|
+
|
|
344
|
+
export function contains(a: Vector3, b: GodotDictionary | GodotArray | PackedVector3Array): boolean { return _V(9, -25, a, b) as boolean; }
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Constructs a default-initialized {@link Vector3} with all components set to `0`.
|
|
348
|
+
*/
|
|
349
|
+
export function create(): Vector3 { return _V(9, -4096, 0) as Vector3; }
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Constructs a {@link Vector3} as a copy of the given {@link Vector3}.
|
|
353
|
+
*/
|
|
354
|
+
export function fromVector3(from: Vector3): Vector3 { return _V(9, -4096, 1, from) as Vector3; }
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Constructs a new {@link Vector3} from {@link Vector3i}.
|
|
358
|
+
*/
|
|
359
|
+
export function fromVector3i(from: Vector3i): Vector3 { return _V(9, -4096, 2, from) as Vector3; }
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Returns a {@link Vector3} with the given components.
|
|
363
|
+
*/
|
|
364
|
+
export function fromXYZ(x: number, y: number, z: number): Vector3 { return _V(9, -4096, 3, x, y, z) as Vector3; }
|
|
365
|
+
|