hytopia 0.2.1 → 0.2.3
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/docs/server.matrix2._constructor_.md +89 -0
- package/docs/server.matrix2.add.md +55 -0
- package/docs/server.matrix2.adjoint.md +19 -0
- package/docs/server.matrix2.clone.md +19 -0
- package/docs/server.matrix2.copy.md +55 -0
- package/docs/server.matrix2.create.md +19 -0
- package/docs/server.matrix2.determinant.md +13 -0
- package/docs/server.matrix2.equals.md +55 -0
- package/docs/server.matrix2.exactequals.md +55 -0
- package/docs/server.matrix2.frobeniusnormal.md +13 -0
- package/docs/server.matrix2.fromrotation.md +55 -0
- package/docs/server.matrix2.fromscaling.md +55 -0
- package/docs/server.matrix2.identity.md +19 -0
- package/docs/server.matrix2.invert.md +19 -0
- package/docs/server.matrix2.md +383 -0
- package/docs/server.matrix2.multiply.md +55 -0
- package/docs/server.matrix2.multiplyscalar.md +55 -0
- package/docs/server.matrix2.rotate.md +55 -0
- package/docs/server.matrix2.subtract.md +55 -0
- package/docs/server.matrix2.tostring.md +19 -0
- package/docs/server.matrix2.transpose.md +19 -0
- package/docs/server.matrix3._constructor_.md +159 -0
- package/docs/server.matrix3.add.md +55 -0
- package/docs/server.matrix3.adjoint.md +19 -0
- package/docs/server.matrix3.clone.md +19 -0
- package/docs/server.matrix3.copy.md +55 -0
- package/docs/server.matrix3.create.md +19 -0
- package/docs/server.matrix3.determinant.md +13 -0
- package/docs/server.matrix3.equals.md +55 -0
- package/docs/server.matrix3.exactequals.md +55 -0
- package/docs/server.matrix3.frobeniusnormal.md +13 -0
- package/docs/server.matrix3.frommatrix4.md +55 -0
- package/docs/server.matrix3.fromquaternion.md +55 -0
- package/docs/server.matrix3.fromrotation.md +55 -0
- package/docs/server.matrix3.fromscaling.md +55 -0
- package/docs/server.matrix3.fromtranslation.md +55 -0
- package/docs/server.matrix3.identity.md +19 -0
- package/docs/server.matrix3.invert.md +19 -0
- package/docs/server.matrix3.md +445 -0
- package/docs/server.matrix3.multiply.md +55 -0
- package/docs/server.matrix3.multiplyscalar.md +55 -0
- package/docs/server.matrix3.projection.md +71 -0
- package/docs/server.matrix3.rotate.md +55 -0
- package/docs/server.matrix3.subtract.md +55 -0
- package/docs/server.matrix3.tostring.md +19 -0
- package/docs/server.matrix3.transpose.md +19 -0
- package/docs/server.matrix4._constructor_.md +257 -0
- package/docs/server.matrix4.add.md +55 -0
- package/docs/server.matrix4.adjoint.md +19 -0
- package/docs/server.matrix4.clone.md +19 -0
- package/docs/server.matrix4.copy.md +55 -0
- package/docs/server.matrix4.create.md +19 -0
- package/docs/server.matrix4.determinant.md +13 -0
- package/docs/server.matrix4.equals.md +55 -0
- package/docs/server.matrix4.exactequals.md +55 -0
- package/docs/server.matrix4.frobeniusnormal.md +13 -0
- package/docs/server.matrix4.fromquaternion.md +55 -0
- package/docs/server.matrix4.fromrotation.md +71 -0
- package/docs/server.matrix4.fromrotationtranslation.md +71 -0
- package/docs/server.matrix4.fromrotationtranslationscale.md +87 -0
- package/docs/server.matrix4.fromrotationtranslationscaleorigin.md +103 -0
- package/docs/server.matrix4.fromscaling.md +55 -0
- package/docs/server.matrix4.fromtranslation.md +55 -0
- package/docs/server.matrix4.fromxrotation.md +55 -0
- package/docs/server.matrix4.fromyrotation.md +55 -0
- package/docs/server.matrix4.fromzrotation.md +55 -0
- package/docs/server.matrix4.frustrum.md +135 -0
- package/docs/server.matrix4.identity.md +19 -0
- package/docs/server.matrix4.invert.md +19 -0
- package/docs/server.matrix4.lookat.md +87 -0
- package/docs/server.matrix4.md +651 -0
- package/docs/server.matrix4.multiply.md +55 -0
- package/docs/server.matrix4.multiplyscalar.md +55 -0
- package/docs/server.matrix4.orthogonal.md +135 -0
- package/docs/server.matrix4.perspective.md +103 -0
- package/docs/server.matrix4.rotate.md +71 -0
- package/docs/server.matrix4.rotatex.md +55 -0
- package/docs/server.matrix4.rotatey.md +55 -0
- package/docs/server.matrix4.rotatez.md +55 -0
- package/docs/server.matrix4.scale.md +55 -0
- package/docs/server.matrix4.subtract.md +55 -0
- package/docs/server.matrix4.targetto.md +87 -0
- package/docs/server.matrix4.tostring.md +19 -0
- package/docs/server.matrix4.translate.md +55 -0
- package/docs/server.matrix4.transpose.md +19 -0
- package/docs/server.md +66 -0
- package/docs/server.quaternion.identity.md +19 -0
- package/docs/server.quaternion.length.md +13 -0
- package/docs/server.quaternion.logarithm.md +19 -0
- package/docs/server.quaternion.magnitude.md +1 -1
- package/docs/server.quaternion.md +114 -2
- package/docs/server.quaternion.power.md +55 -0
- package/docs/server.quaternion.randomize.md +19 -0
- package/docs/server.quaternion.setaxisangle.md +71 -0
- package/docs/server.quaternion.squaredlength.md +13 -0
- package/docs/server.quaternion.squaredmagnitude.md +1 -1
- package/docs/server.vector2._constructor_.md +61 -0
- package/docs/server.vector2.add.md +55 -0
- package/docs/server.vector2.angle.md +55 -0
- package/docs/server.vector2.ceil.md +19 -0
- package/docs/server.vector2.clone.md +19 -0
- package/docs/server.vector2.copy.md +55 -0
- package/docs/server.vector2.create.md +19 -0
- package/docs/server.vector2.cross.md +55 -0
- package/docs/server.vector2.distance.md +55 -0
- package/docs/server.vector2.divide.md +55 -0
- package/docs/server.vector2.dot.md +55 -0
- package/docs/server.vector2.equals.md +55 -0
- package/docs/server.vector2.exactequals.md +55 -0
- package/docs/server.vector2.floor.md +19 -0
- package/docs/server.vector2.invert.md +19 -0
- package/docs/server.vector2.length.md +13 -0
- package/docs/server.vector2.lerp.md +71 -0
- package/docs/server.vector2.magnitude.md +13 -0
- package/docs/server.vector2.max.md +55 -0
- package/docs/server.vector2.md +657 -0
- package/docs/server.vector2.min.md +55 -0
- package/docs/server.vector2.multiply.md +55 -0
- package/docs/server.vector2.negate.md +19 -0
- package/docs/server.vector2.normalize.md +19 -0
- package/docs/server.vector2.randomize.md +55 -0
- package/docs/server.vector2.rotate.md +71 -0
- package/docs/server.vector2.round.md +19 -0
- package/docs/server.vector2.scale.md +55 -0
- package/docs/server.vector2.scaleandadd.md +71 -0
- package/docs/server.vector2.squaredlength.md +13 -0
- package/docs/server.vector2.squaredmagnitude.md +13 -0
- package/docs/server.vector2.subtract.md +55 -0
- package/docs/server.vector2.tostring.md +19 -0
- package/docs/server.vector2.transformmatrix2.md +55 -0
- package/docs/server.vector2.transformmatrix3.md +55 -0
- package/docs/server.vector2.transformmatrix4.md +55 -0
- package/docs/server.vector2.x.md +15 -0
- package/docs/server.vector2.y.md +15 -0
- package/docs/server.vector2.zero.md +19 -0
- package/docs/server.vector2boolean.md +72 -0
- package/docs/server.vector2boolean.x.md +11 -0
- package/docs/server.vector2boolean.y.md +11 -0
- package/docs/server.vector2like.md +72 -0
- package/docs/server.vector2like.x.md +11 -0
- package/docs/server.vector2like.y.md +11 -0
- package/docs/server.vector3.create.md +19 -0
- package/docs/server.vector3.length.md +13 -0
- package/docs/server.vector3.magnitude.md +1 -1
- package/docs/server.vector3.md +144 -2
- package/docs/server.vector3.randomize.md +55 -0
- package/docs/server.vector3.scaleandadd.md +71 -0
- package/docs/server.vector3.squaredlength.md +13 -0
- package/docs/server.vector3.squaredmagnitude.md +1 -1
- package/docs/server.vector3.transformmatrix3.md +55 -0
- package/docs/server.vector3.transformmatrix4.md +55 -0
- package/docs/server.vector3.transformquaternion.md +55 -0
- package/docs/server.vector3.zero.md +19 -0
- package/examples/zombies-fps/classes/GameManager.ts +5 -3
- package/package.json +1 -1
- package/server.api.json +14293 -7345
- package/server.d.ts +917 -4
- package/server.js +89 -89
- package/examples/ai-agents/bun.lockb +0 -0
- package/examples/big-world/bun.lockb +0 -0
- package/examples/block-entity/bun.lockb +0 -0
- package/examples/child-entity/bun.lockb +0 -0
- package/examples/child-entity/package-lock.json +0 -30
- package/examples/custom-ui/bun.lockb +0 -0
- package/examples/entity-controller/bun.lockb +0 -0
- package/examples/entity-spawn/bun.lockb +0 -0
- package/examples/hole-in-wall-game/bun.lockb +0 -0
- package/examples/lighting/bun.lockb +0 -0
- package/examples/pathfinding/bun.lockb +0 -0
- package/examples/payload-game/bun.lockb +0 -0
- package/examples/wall-dodge-game/bun.lockb +0 -0
- package/examples/zombies-fps/bun.lockb +0 -0
package/server.d.ts
CHANGED
@@ -2119,6 +2119,579 @@ export declare enum LightType {
|
|
2119
2119
|
SPOTLIGHT = 1
|
2120
2120
|
}
|
2121
2121
|
|
2122
|
+
/**
|
2123
|
+
* Represents a 2x2 matrix.
|
2124
|
+
*
|
2125
|
+
* @remarks
|
2126
|
+
* All matrix methods result in mutation of the matrix instance.
|
2127
|
+
* This class extends `Float32Array` to provide an efficient way to
|
2128
|
+
* create and manipulate a 2x2 matrix. Various convenience methods are
|
2129
|
+
* provided for common matrix operations.
|
2130
|
+
*
|
2131
|
+
* @public
|
2132
|
+
*/
|
2133
|
+
export declare class Matrix2 extends Float32Array {
|
2134
|
+
constructor(m00: number, m01: number, m10: number, m11: number);
|
2135
|
+
/** The determinant of the matrix. */
|
2136
|
+
get determinant(): number;
|
2137
|
+
/** The frobenius normal of the matrix. */
|
2138
|
+
get frobeniusNormal(): number;
|
2139
|
+
/**
|
2140
|
+
* Creates a new `Matrix2` instance.
|
2141
|
+
*
|
2142
|
+
* @returns A new `Matrix2` instance.
|
2143
|
+
*/
|
2144
|
+
static create(): Matrix2;
|
2145
|
+
/**
|
2146
|
+
* Creates a new `Matrix2` instance from a rotation of identity matrix.
|
2147
|
+
*
|
2148
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2149
|
+
* @returns A new `Matrix2` instance.
|
2150
|
+
*/
|
2151
|
+
static fromRotation(angle: number): Matrix2;
|
2152
|
+
/**
|
2153
|
+
* Creates a new `Matrix2` instance from a scale of identity matrix.
|
2154
|
+
*
|
2155
|
+
* @param scale - The scale of the matrix.
|
2156
|
+
* @returns A new `Matrix2` instance.
|
2157
|
+
*/
|
2158
|
+
static fromScaling(scale: Vector2): Matrix2;
|
2159
|
+
/**
|
2160
|
+
* Adds a matrix to the current matrix.
|
2161
|
+
*
|
2162
|
+
* @param matrix2 - The matrix to add to the current matrix.
|
2163
|
+
* @returns The current matrix.
|
2164
|
+
*/
|
2165
|
+
add(matrix2: Matrix2): Matrix2;
|
2166
|
+
/**
|
2167
|
+
* Sets the adjugate of the current matrix.
|
2168
|
+
*
|
2169
|
+
* @returns The current matrix.
|
2170
|
+
*/
|
2171
|
+
adjoint(): Matrix2;
|
2172
|
+
/**
|
2173
|
+
* Clones the current matrix.
|
2174
|
+
*
|
2175
|
+
* @returns A clone of the current matrix.
|
2176
|
+
*/
|
2177
|
+
clone(): Matrix2;
|
2178
|
+
/**
|
2179
|
+
* Copies a matrix to the current matrix.
|
2180
|
+
*
|
2181
|
+
* @param matrix2 - The matrix2 to copy to the current matrix.
|
2182
|
+
* @returns The current matrix.
|
2183
|
+
*/
|
2184
|
+
copy(matrix2: Matrix2): Matrix2;
|
2185
|
+
/**
|
2186
|
+
* Checks if the current matrix is approximately equal to another matrix.
|
2187
|
+
*
|
2188
|
+
* @param matrix2 - The matrix to compare to the current matrix.
|
2189
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2190
|
+
*/
|
2191
|
+
equals(matrix2: Matrix2): boolean;
|
2192
|
+
/**
|
2193
|
+
* Checks if the current matrix is exactly equal to another matrix.
|
2194
|
+
*
|
2195
|
+
* @param matrix2 - The matrix to compare to the current matrix.
|
2196
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2197
|
+
*/
|
2198
|
+
exactEquals(matrix2: Matrix2): boolean;
|
2199
|
+
/**
|
2200
|
+
* Sets the current matrix to the identity matrix.
|
2201
|
+
*
|
2202
|
+
* @returns The current matrix.
|
2203
|
+
*/
|
2204
|
+
identity(): Matrix2;
|
2205
|
+
/**
|
2206
|
+
* Inverts the current matrix.
|
2207
|
+
*
|
2208
|
+
* @returns The current matrix.
|
2209
|
+
*/
|
2210
|
+
invert(): Matrix2;
|
2211
|
+
/**
|
2212
|
+
* Multiplies the current matrix by another matrix.
|
2213
|
+
*
|
2214
|
+
* @param matrix2 - The matrix to multiply the current matrix by.
|
2215
|
+
* @returns The current matrix.
|
2216
|
+
*/
|
2217
|
+
multiply(matrix2: Matrix2): Matrix2;
|
2218
|
+
/**
|
2219
|
+
* Multiplies each element of the current matrix by a scalar value.
|
2220
|
+
*
|
2221
|
+
* @param scalar - The scalar value to multiply the current matrix elements by.
|
2222
|
+
* @returns The current matrix.
|
2223
|
+
*/
|
2224
|
+
multiplyScalar(scalar: number): Matrix2;
|
2225
|
+
/**
|
2226
|
+
* Rotates the current matrix by an angle in radians.
|
2227
|
+
*
|
2228
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2229
|
+
* @returns The current matrix.
|
2230
|
+
*/
|
2231
|
+
rotate(angle: number): Matrix2;
|
2232
|
+
/**
|
2233
|
+
* Subtracts a matrix from the current matrix.
|
2234
|
+
*
|
2235
|
+
* @param matrix2 - The matrix to subtract from the current matrix.
|
2236
|
+
* @returns The current matrix.
|
2237
|
+
*/
|
2238
|
+
subtract(matrix2: Matrix2): Matrix2;
|
2239
|
+
/**
|
2240
|
+
* Returns a string representation of the current matrix.
|
2241
|
+
*
|
2242
|
+
* @returns A string representation of the current matrix.
|
2243
|
+
*/
|
2244
|
+
toString(): string;
|
2245
|
+
/**
|
2246
|
+
* Transposes the current matrix.
|
2247
|
+
*
|
2248
|
+
* @returns The current matrix.
|
2249
|
+
*/
|
2250
|
+
transpose(): Matrix2;
|
2251
|
+
}
|
2252
|
+
|
2253
|
+
/**
|
2254
|
+
* Represents a 3x3 matrix.
|
2255
|
+
*
|
2256
|
+
* @remarks
|
2257
|
+
* All matrix methods result in mutation of the matrix instance.
|
2258
|
+
* This class extends `Float32Array` to provide an efficient way to
|
2259
|
+
* create and manipulate a 3x3 matrix. Various convenience methods are
|
2260
|
+
* provided for common matrix operations.
|
2261
|
+
*
|
2262
|
+
* @public
|
2263
|
+
*/
|
2264
|
+
export declare class Matrix3 extends Float32Array {
|
2265
|
+
constructor(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number);
|
2266
|
+
/** The determinant of the matrix. */
|
2267
|
+
get determinant(): number;
|
2268
|
+
/** The frobenius normal of the matrix. */
|
2269
|
+
get frobeniusNormal(): number;
|
2270
|
+
/**
|
2271
|
+
* Creates a new `Matrix3` instance.
|
2272
|
+
*
|
2273
|
+
* @returns A new `Matrix3` instance.
|
2274
|
+
*/
|
2275
|
+
static create(): Matrix3;
|
2276
|
+
/**
|
2277
|
+
* Creates a new `Matrix3` instance from a `Matrix4` instance.
|
2278
|
+
*
|
2279
|
+
* @param matrix4 - The `Matrix4` instance to create the `Matrix3` instance from.
|
2280
|
+
* @returns A new `Matrix3` instance.
|
2281
|
+
*/
|
2282
|
+
static fromMatrix4(matrix4: Matrix4): Matrix3;
|
2283
|
+
/**
|
2284
|
+
* Creates a new `Matrix3` instance from a `Quaternion` instance.
|
2285
|
+
*
|
2286
|
+
* @param quaternion - The `Quaternion` instance to create the `Matrix3` instance from.
|
2287
|
+
* @returns A new `Matrix3` instance.
|
2288
|
+
*/
|
2289
|
+
static fromQuaternion(quaternion: Quaternion): Matrix3;
|
2290
|
+
/**
|
2291
|
+
* Creates a new `Matrix3` instance from a rotation of identity matrix.
|
2292
|
+
*
|
2293
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2294
|
+
* @returns A new `Matrix3` instance.
|
2295
|
+
*/
|
2296
|
+
static fromRotation(angle: number): Matrix3;
|
2297
|
+
/**
|
2298
|
+
* Creates a new `Matrix3` instance from a scale of identity matrix.
|
2299
|
+
*
|
2300
|
+
* @param scale - The scale of the matrix.
|
2301
|
+
* @returns A new `Matrix3` instance.
|
2302
|
+
*/
|
2303
|
+
static fromScaling(scale: Vector3): Matrix3;
|
2304
|
+
/**
|
2305
|
+
* Creates a new `Matrix3` instance from a translation of identity matrix.
|
2306
|
+
*
|
2307
|
+
* @param translation - The translation of the matrix.
|
2308
|
+
* @returns A new `Matrix3` instance.
|
2309
|
+
*/
|
2310
|
+
static fromTranslation(translation: Vector3): Matrix3;
|
2311
|
+
/**
|
2312
|
+
* Adds a matrix to the current matrix.
|
2313
|
+
*
|
2314
|
+
* @param matrix3 - The matrix to add to the current matrix.
|
2315
|
+
* @returns The current matrix.
|
2316
|
+
*/
|
2317
|
+
add(matrix3: Matrix3): Matrix3;
|
2318
|
+
/**
|
2319
|
+
* Sets the adjugate of the current matrix.
|
2320
|
+
*
|
2321
|
+
* @returns The current matrix.
|
2322
|
+
*/
|
2323
|
+
adjoint(): Matrix3;
|
2324
|
+
/**
|
2325
|
+
* Clones the current matrix.
|
2326
|
+
*
|
2327
|
+
* @returns A clone of the current matrix.
|
2328
|
+
*/
|
2329
|
+
clone(): Matrix3;
|
2330
|
+
/**
|
2331
|
+
* Copies a matrix to the current matrix.
|
2332
|
+
*
|
2333
|
+
* @param matrix3 - The matrix to copy to the current matrix.
|
2334
|
+
* @returns The current matrix.
|
2335
|
+
*/
|
2336
|
+
copy(matrix3: Matrix3): Matrix3;
|
2337
|
+
/**
|
2338
|
+
* Checks if the current matrix is approximately equal to another matrix.
|
2339
|
+
*
|
2340
|
+
* @param matrix3 - The matrix to compare to the current matrix.
|
2341
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2342
|
+
*/
|
2343
|
+
equals(matrix3: Matrix3): boolean;
|
2344
|
+
/**
|
2345
|
+
* Checks if the current matrix is exactly equal to another matrix.
|
2346
|
+
*
|
2347
|
+
* @param matrix3 - The matrix to compare to the current matrix.
|
2348
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2349
|
+
*/
|
2350
|
+
exactEquals(matrix3: Matrix3): boolean;
|
2351
|
+
/**
|
2352
|
+
* Sets the current matrix to the identity matrix.
|
2353
|
+
*
|
2354
|
+
* @returns The current matrix.
|
2355
|
+
*/
|
2356
|
+
identity(): Matrix3;
|
2357
|
+
/**
|
2358
|
+
* Inverts the current matrix.
|
2359
|
+
*
|
2360
|
+
* @returns The current matrix.
|
2361
|
+
*/
|
2362
|
+
invert(): Matrix3;
|
2363
|
+
/**
|
2364
|
+
* Multiplies the current matrix by another matrix.
|
2365
|
+
*
|
2366
|
+
* @param matrix3 - The matrix to multiply the current matrix by.
|
2367
|
+
* @returns The current matrix.
|
2368
|
+
*/
|
2369
|
+
multiply(matrix3: Matrix3): Matrix3;
|
2370
|
+
/**
|
2371
|
+
* Multiplies each element of the current matrix by a scalar value.
|
2372
|
+
*
|
2373
|
+
* @param scalar - The scalar value to multiply the current matrix elements by.
|
2374
|
+
* @returns The current matrix.
|
2375
|
+
*/
|
2376
|
+
multiplyScalar(scalar: number): Matrix3;
|
2377
|
+
/**
|
2378
|
+
* Sets the current matrix to a projection matrix with the given bounds.
|
2379
|
+
*
|
2380
|
+
* @param width - The width of the projection.
|
2381
|
+
* @param height - The height of the projection.
|
2382
|
+
* @returns The current matrix.
|
2383
|
+
*/
|
2384
|
+
projection(width: number, height: number): Matrix3;
|
2385
|
+
/**
|
2386
|
+
* Rotates the current matrix by an angle in radians.
|
2387
|
+
*
|
2388
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2389
|
+
* @returns The current matrix.
|
2390
|
+
*/
|
2391
|
+
rotate(angle: number): Matrix3;
|
2392
|
+
/**
|
2393
|
+
* Subtracts a matrix from the current matrix.
|
2394
|
+
*
|
2395
|
+
* @param matrix3 - The matrix to subtract from the current matrix.
|
2396
|
+
* @returns The current matrix.
|
2397
|
+
*/
|
2398
|
+
subtract(matrix3: Matrix3): Matrix3;
|
2399
|
+
/**
|
2400
|
+
* Returns a string representation of the current matrix.
|
2401
|
+
*
|
2402
|
+
* @returns A string representation of the current matrix.
|
2403
|
+
*/
|
2404
|
+
toString(): string;
|
2405
|
+
/**
|
2406
|
+
* Transposes the current matrix.
|
2407
|
+
*
|
2408
|
+
* @returns The current matrix.
|
2409
|
+
*/
|
2410
|
+
transpose(): Matrix3;
|
2411
|
+
}
|
2412
|
+
|
2413
|
+
/**
|
2414
|
+
* Represents a 4x4 matrix.
|
2415
|
+
*
|
2416
|
+
* @remarks
|
2417
|
+
* All matrix methods result in mutation of the matrix instance.
|
2418
|
+
* This class extends `Float32Array` to provide an efficient way to
|
2419
|
+
* create and manipulate a 4x4 matrix. Various convenience methods are
|
2420
|
+
* provided for common matrix operations.
|
2421
|
+
*
|
2422
|
+
* @public
|
2423
|
+
*/
|
2424
|
+
export declare class Matrix4 extends Float32Array {
|
2425
|
+
constructor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number);
|
2426
|
+
/** The determinant of the matrix. */
|
2427
|
+
get determinant(): number;
|
2428
|
+
/** The frobenius normal of the matrix. */
|
2429
|
+
get frobeniusNormal(): number;
|
2430
|
+
/**
|
2431
|
+
* Creates a new `Matrix4` instance.
|
2432
|
+
*
|
2433
|
+
* @returns A new `Matrix4` instance.
|
2434
|
+
*/
|
2435
|
+
static create(): Matrix4;
|
2436
|
+
/**
|
2437
|
+
* Creates a new `Matrix4` instance from a `Quaternion` object.
|
2438
|
+
*
|
2439
|
+
* @param quaternion - The `Quaternion` object to create the `Matrix4` instance from.
|
2440
|
+
* @returns A new `Matrix4` instance.
|
2441
|
+
*/
|
2442
|
+
static fromQuaternion(quaternion: Quaternion): Matrix4;
|
2443
|
+
/**
|
2444
|
+
* Creates a new `Matrix4` instance from an angle and axis.
|
2445
|
+
*
|
2446
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2447
|
+
* @param axis - The axis to rotate the matrix around.
|
2448
|
+
* @returns A new `Matrix4` instance.
|
2449
|
+
*/
|
2450
|
+
static fromRotation(angle: number, axis: Vector3): Matrix4;
|
2451
|
+
/**
|
2452
|
+
* Creates a new `Matrix4` instance from a rotation and translation.
|
2453
|
+
*
|
2454
|
+
* @param rotation - The rotation of the matrix.
|
2455
|
+
* @param translation - The translation of the matrix.
|
2456
|
+
* @returns A new `Matrix4` instance.
|
2457
|
+
*/
|
2458
|
+
static fromRotationTranslation(rotation: Quaternion, translation: Vector3): Matrix4;
|
2459
|
+
/**
|
2460
|
+
* Creates a new `Matrix4` instance from a rotation, translation, and scale.
|
2461
|
+
*
|
2462
|
+
* @param rotation - The rotation of the matrix.
|
2463
|
+
* @param translation - The translation of the matrix.
|
2464
|
+
* @param scale - The scale of the matrix.
|
2465
|
+
* @returns A new `Matrix4` instance.
|
2466
|
+
*/
|
2467
|
+
static fromRotationTranslationScale(rotation: Quaternion, translation: Vector3, scale: Vector3): Matrix4;
|
2468
|
+
/**
|
2469
|
+
* Creates a new `Matrix4` instance from a rotation, translation, scale, and origin.
|
2470
|
+
*
|
2471
|
+
* @param rotation - The rotation of the matrix.
|
2472
|
+
* @param translation - The translation of the matrix.
|
2473
|
+
* @param scale - The scale of the matrix.
|
2474
|
+
* @param origin - The origin of the matrix.
|
2475
|
+
* @returns A new `Matrix4` instance.
|
2476
|
+
*/
|
2477
|
+
static fromRotationTranslationScaleOrigin(rotation: Quaternion, translation: Vector3, scale: Vector3, origin: Vector3): Matrix4;
|
2478
|
+
/**
|
2479
|
+
* Creates a new `Matrix4` instance from a scale of identity matrix.
|
2480
|
+
*
|
2481
|
+
* @param scale - The scale of the matrix.
|
2482
|
+
* @returns A new `Matrix4` instance.
|
2483
|
+
*/
|
2484
|
+
static fromScaling(scale: Vector3): Matrix4;
|
2485
|
+
/**
|
2486
|
+
* Creates a new `Matrix4` instance from a translation of identity matrix.
|
2487
|
+
*
|
2488
|
+
* @param translation - The translation of the matrix.
|
2489
|
+
* @returns A new `Matrix4` instance.
|
2490
|
+
*/
|
2491
|
+
static fromTranslation(translation: Vector3): Matrix4;
|
2492
|
+
/**
|
2493
|
+
* Creates a new `Matrix4` instance from an x-rotation of identity matrix.
|
2494
|
+
*
|
2495
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2496
|
+
* @returns A new `Matrix4` instance.
|
2497
|
+
*/
|
2498
|
+
static fromXRotation(angle: number): Matrix4;
|
2499
|
+
/**
|
2500
|
+
* Creates a new `Matrix4` instance from a y-rotation of identity matrix.
|
2501
|
+
*
|
2502
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2503
|
+
* @returns A new `Matrix4` instance.
|
2504
|
+
*/
|
2505
|
+
static fromYRotation(angle: number): Matrix4;
|
2506
|
+
/**
|
2507
|
+
* Creates a new `Matrix4` instance from a z-rotation of identity matrix.
|
2508
|
+
*
|
2509
|
+
* @param angle - The angle in radians to rotate the matrix by.
|
2510
|
+
* @returns A new `Matrix4` instance.
|
2511
|
+
*/
|
2512
|
+
static fromZRotation(angle: number): Matrix4;
|
2513
|
+
/**
|
2514
|
+
* Adds a matrix to the current matrix.
|
2515
|
+
*
|
2516
|
+
* @param matrix4 - The matrix to add to the current matrix.
|
2517
|
+
* @returns The current matrix.
|
2518
|
+
*/
|
2519
|
+
add(matrix4: Matrix4): Matrix4;
|
2520
|
+
/**
|
2521
|
+
* Sets the adjugate of the current matrix.
|
2522
|
+
*
|
2523
|
+
* @returns The current matrix.
|
2524
|
+
*/
|
2525
|
+
adjoint(): Matrix4;
|
2526
|
+
/**
|
2527
|
+
* Clones the current matrix.
|
2528
|
+
*
|
2529
|
+
* @returns A clone of the current matrix.
|
2530
|
+
*/
|
2531
|
+
clone(): Matrix4;
|
2532
|
+
/**
|
2533
|
+
* Copies a matrix to the current matrix.
|
2534
|
+
*
|
2535
|
+
* @param matrix4 - The matrix to copy to the current matrix.
|
2536
|
+
* @returns The current matrix.
|
2537
|
+
*/
|
2538
|
+
copy(matrix4: Matrix4): Matrix4;
|
2539
|
+
/**
|
2540
|
+
* Checks if the current matrix is approximately equal to another matrix.
|
2541
|
+
*
|
2542
|
+
* @param matrix4 - The matrix to compare to the current matrix.
|
2543
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2544
|
+
*/
|
2545
|
+
equals(matrix4: Matrix4): boolean;
|
2546
|
+
/**
|
2547
|
+
* Checks if the current matrix is exactly equal to another matrix.
|
2548
|
+
*
|
2549
|
+
* @param matrix4 - The matrix to compare to the current matrix.
|
2550
|
+
* @returns `true` if the current matrix is equal to the provided matrix, `false` otherwise.
|
2551
|
+
*/
|
2552
|
+
exactEquals(matrix4: Matrix4): boolean;
|
2553
|
+
/**
|
2554
|
+
* Sets the current matrix to a frustrum matrix with the given bounds.
|
2555
|
+
*
|
2556
|
+
* @param left - The left bound of the projection.
|
2557
|
+
* @param right - The right bound of the projection.
|
2558
|
+
* @param bottom - The bottom bound of the projection.
|
2559
|
+
* @param top - The top bound of the projection.
|
2560
|
+
* @param near - The near bound of the projection.
|
2561
|
+
* @param far - The far bound of the projection.
|
2562
|
+
* @returns The current matrix.
|
2563
|
+
*/
|
2564
|
+
frustrum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
|
2565
|
+
/**
|
2566
|
+
* Sets the current matrix to the identity matrix.
|
2567
|
+
*
|
2568
|
+
* @returns The current matrix.
|
2569
|
+
*/
|
2570
|
+
identity(): Matrix4;
|
2571
|
+
/**
|
2572
|
+
* Inverts the current matrix.
|
2573
|
+
*
|
2574
|
+
* @returns The current matrix.
|
2575
|
+
*/
|
2576
|
+
invert(): Matrix4;
|
2577
|
+
/**
|
2578
|
+
* Sets the current matrix to a look-at matrix with the given eye, center, and up vectors.
|
2579
|
+
*
|
2580
|
+
* @param eye - The eye vector of the camera.
|
2581
|
+
* @param center - The center vector of the camera.
|
2582
|
+
* @param up - The up vector of the camera.
|
2583
|
+
* @returns The current matrix.
|
2584
|
+
*/
|
2585
|
+
lookAt(eye: Vector3, center: Vector3, up: Vector3): Matrix4;
|
2586
|
+
/**
|
2587
|
+
* Multiplies the current matrix by another matrix.
|
2588
|
+
*
|
2589
|
+
* @param matrix4 - The matrix to multiply the current matrix by.
|
2590
|
+
* @returns The current matrix.
|
2591
|
+
*/
|
2592
|
+
multiply(matrix4: Matrix4): Matrix4;
|
2593
|
+
/**
|
2594
|
+
* Multiplies each element of the current matrix by a scalar value.
|
2595
|
+
*
|
2596
|
+
* @param scalar - The scalar value to multiply the current matrix elements by.
|
2597
|
+
* @returns The current matrix.
|
2598
|
+
*/
|
2599
|
+
multiplyScalar(scalar: number): Matrix4;
|
2600
|
+
/**
|
2601
|
+
* Sets the current matrix to an orthogonal matrix with the given bounds.
|
2602
|
+
*
|
2603
|
+
* @param left - The left bound of the projection.
|
2604
|
+
* @param right - The right bound of the projection.
|
2605
|
+
* @param bottom - The bottom bound of the projection.
|
2606
|
+
* @param top - The top bound of the projection.
|
2607
|
+
* @param near - The near bound of the projection.
|
2608
|
+
* @param far - The far bound of the projection.
|
2609
|
+
* @returns The current matrix.
|
2610
|
+
*/
|
2611
|
+
orthogonal(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
|
2612
|
+
/**
|
2613
|
+
* Sets the current matrix to a perspective matrix with the given field of view, aspect ratio, and near and far bounds.
|
2614
|
+
*
|
2615
|
+
* @param fovy - The field of view of the projection.
|
2616
|
+
* @param aspect - The aspect ratio of the projection.
|
2617
|
+
* @param near - The near bound of the projection.
|
2618
|
+
* @param far - The far bound of the projection.
|
2619
|
+
* @returns The current matrix.
|
2620
|
+
*/
|
2621
|
+
perspective(fovy: number, aspect: number, near: number, far: number): Matrix4;
|
2622
|
+
/**
|
2623
|
+
* Rotates the current matrix by an angle in radians around an axis.
|
2624
|
+
*
|
2625
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2626
|
+
* @param axis - The axis to rotate the current matrix around.
|
2627
|
+
* @returns The current matrix.
|
2628
|
+
*/
|
2629
|
+
rotate(angle: number, axis: Vector3): Matrix4;
|
2630
|
+
/**
|
2631
|
+
* Rotates the current matrix by an angle in radians around the x-axis.
|
2632
|
+
*
|
2633
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2634
|
+
* @returns The current matrix.
|
2635
|
+
*/
|
2636
|
+
rotateX(angle: number): Matrix4;
|
2637
|
+
/**
|
2638
|
+
* Rotates the current matrix by an angle in radians around the y-axis.
|
2639
|
+
*
|
2640
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2641
|
+
* @returns The current matrix.
|
2642
|
+
*/
|
2643
|
+
rotateY(angle: number): Matrix4;
|
2644
|
+
/**
|
2645
|
+
* Rotates the current matrix by an angle in radians around the z-axis.
|
2646
|
+
*
|
2647
|
+
* @param angle - The angle in radians to rotate the current matrix by.
|
2648
|
+
* @returns The current matrix.
|
2649
|
+
*/
|
2650
|
+
rotateZ(angle: number): Matrix4;
|
2651
|
+
/**
|
2652
|
+
* Scales the current matrix by a vector.
|
2653
|
+
*
|
2654
|
+
* @param vector3 - The vector to scale the current matrix by.
|
2655
|
+
* @returns The current matrix.
|
2656
|
+
*/
|
2657
|
+
scale(vector3: Vector3): Matrix4;
|
2658
|
+
/**
|
2659
|
+
* Subtracts a matrix from the current matrix.
|
2660
|
+
*
|
2661
|
+
* @param matrix4 - The matrix to subtract from the current matrix.
|
2662
|
+
* @returns The current matrix.
|
2663
|
+
*/
|
2664
|
+
subtract(matrix4: Matrix4): Matrix4;
|
2665
|
+
/**
|
2666
|
+
* Sets the current matrix to a matrix that looks at a target.
|
2667
|
+
*
|
2668
|
+
* @param eye - The eye vector of the camera.
|
2669
|
+
* @param center - The center vector of the camera.
|
2670
|
+
* @param up - The up vector of the camera.
|
2671
|
+
* @returns The current matrix.
|
2672
|
+
*/
|
2673
|
+
targetTo(eye: Vector3, center: Vector3, up: Vector3): Matrix4;
|
2674
|
+
/**
|
2675
|
+
* Returns a string representation of the current matrix.
|
2676
|
+
*
|
2677
|
+
* @returns A string representation of the current matrix.
|
2678
|
+
*/
|
2679
|
+
toString(): string;
|
2680
|
+
/**
|
2681
|
+
* Translates the current matrix by a vector.
|
2682
|
+
*
|
2683
|
+
* @param vector3 - The vector to translate the current matrix by.
|
2684
|
+
* @returns The current matrix.
|
2685
|
+
*/
|
2686
|
+
translate(vector3: Vector3): Matrix4;
|
2687
|
+
/**
|
2688
|
+
* Transposes the current matrix.
|
2689
|
+
*
|
2690
|
+
* @returns The current matrix.
|
2691
|
+
*/
|
2692
|
+
transpose(): Matrix4;
|
2693
|
+
}
|
2694
|
+
|
2122
2695
|
/** A bounding box for a model. @public */
|
2123
2696
|
declare type ModelBoundingBox = {
|
2124
2697
|
min: Vector3Like;
|
@@ -2953,9 +3526,13 @@ export declare const PORT: string | 8080;
|
|
2953
3526
|
*/
|
2954
3527
|
export declare class Quaternion extends Float32Array implements QuaternionLike {
|
2955
3528
|
constructor(x: number, y: number, z: number, w: number);
|
2956
|
-
/** The
|
3529
|
+
/** The length of the quaternion. */
|
3530
|
+
get length(): number;
|
3531
|
+
/** The squared length of the quaternion. */
|
3532
|
+
get squaredLength(): number;
|
3533
|
+
/** The magnitude of the quaternion. Alias for `.length`. */
|
2957
3534
|
get magnitude(): number;
|
2958
|
-
/** The squared magnitude of the quaternion.
|
3535
|
+
/** The squared magnitude of the quaternion. Alias for `.squaredLength`. */
|
2959
3536
|
get squaredMagnitude(): number;
|
2960
3537
|
/** The x-component of the quaternion. */
|
2961
3538
|
get x(): number;
|
@@ -3036,6 +3613,12 @@ export declare class Quaternion extends Float32Array implements QuaternionLike {
|
|
3036
3613
|
* @returns The angle in degrees.
|
3037
3614
|
*/
|
3038
3615
|
getAngle(quaternion: Quaternion): number;
|
3616
|
+
/**
|
3617
|
+
* Sets the current quaternion to the identity quaternion.
|
3618
|
+
*
|
3619
|
+
* @returns The current quaternion.
|
3620
|
+
*/
|
3621
|
+
identity(): Quaternion;
|
3039
3622
|
/**
|
3040
3623
|
* Inverts each component of the quaternion.
|
3041
3624
|
*
|
@@ -3050,6 +3633,12 @@ export declare class Quaternion extends Float32Array implements QuaternionLike {
|
|
3050
3633
|
* @returns The current quaternion.
|
3051
3634
|
*/
|
3052
3635
|
lerp(quaternion: Quaternion, t: number): Quaternion;
|
3636
|
+
/**
|
3637
|
+
* Sets the current quaternion to its natural logarithm.
|
3638
|
+
*
|
3639
|
+
* @returns The current quaternion.
|
3640
|
+
*/
|
3641
|
+
logarithm(): Quaternion;
|
3053
3642
|
/**
|
3054
3643
|
* Multiplies the quaternion by another quaternion.
|
3055
3644
|
*
|
@@ -3063,6 +3652,19 @@ export declare class Quaternion extends Float32Array implements QuaternionLike {
|
|
3063
3652
|
* @returns The current quaternion.
|
3064
3653
|
*/
|
3065
3654
|
normalize(): Quaternion;
|
3655
|
+
/**
|
3656
|
+
* Raises the current quaternion to a power.
|
3657
|
+
*
|
3658
|
+
* @param exponent - The exponent to raise the quaternion to.
|
3659
|
+
* @returns The current quaternion.
|
3660
|
+
*/
|
3661
|
+
power(exponent: number): Quaternion;
|
3662
|
+
/**
|
3663
|
+
* Randomizes the current quaternion.
|
3664
|
+
*
|
3665
|
+
* @returns The current quaternion.
|
3666
|
+
*/
|
3667
|
+
randomize(): Quaternion;
|
3066
3668
|
/**
|
3067
3669
|
* Rotates the quaternion around the x-axis.
|
3068
3670
|
*
|
@@ -3091,6 +3693,14 @@ export declare class Quaternion extends Float32Array implements QuaternionLike {
|
|
3091
3693
|
* @returns The current quaternion.
|
3092
3694
|
*/
|
3093
3695
|
scale(scale: number): Quaternion;
|
3696
|
+
/**
|
3697
|
+
* Sets the current quaternion to the angle and rotation axis.
|
3698
|
+
*
|
3699
|
+
* @param axis - The axis to rotate around.
|
3700
|
+
* @param angle - The angle to rotate in radians.
|
3701
|
+
* @returns The current quaternion.
|
3702
|
+
*/
|
3703
|
+
setAxisAngle(axis: Vector3, angle: number): Quaternion;
|
3094
3704
|
/**
|
3095
3705
|
* Spherically interpolates between the current quaternion and another quaternion.
|
3096
3706
|
*
|
@@ -3886,6 +4496,257 @@ export declare function startServer(init: (world: World) => void): void;
|
|
3886
4496
|
/** The input keys that are included in the PlayerInput. @public */
|
3887
4497
|
export declare const SUPPORTED_INPUT_KEYS: readonly ["w", "a", "s", "d", "sp", "sh", "tb", "ml", "mr", "q", "e", "r", "f", "z", "x", "c", "v", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
|
3888
4498
|
|
4499
|
+
/**
|
4500
|
+
* Represents a 2D vector.
|
4501
|
+
*
|
4502
|
+
* @remarks
|
4503
|
+
* All vector methods result in mutation of the vector instance.
|
4504
|
+
* This class extends `Float32Array` to provide an efficient way to
|
4505
|
+
* create and manipulate a 2-dimensional vector. Various convenience
|
4506
|
+
* methods are provided for common vector operations.
|
4507
|
+
*
|
4508
|
+
* @public
|
4509
|
+
*/
|
4510
|
+
export declare class Vector2 extends Float32Array implements Vector2Like {
|
4511
|
+
constructor(x: number, y: number);
|
4512
|
+
/** The length of the vector. */
|
4513
|
+
get length(): number;
|
4514
|
+
/** The squared length of the vector. */
|
4515
|
+
get squaredLength(): number;
|
4516
|
+
/** The magnitude of the vector. Alias for `length`. */
|
4517
|
+
get magnitude(): number;
|
4518
|
+
/** The squared magnitude of the vector. Alias for `squaredLength`. */
|
4519
|
+
get squaredMagnitude(): number;
|
4520
|
+
/** The x-component of the vector. */
|
4521
|
+
get x(): number;
|
4522
|
+
set x(value: number);
|
4523
|
+
/** The y-component of the vector. */
|
4524
|
+
get y(): number;
|
4525
|
+
set y(value: number);
|
4526
|
+
/**
|
4527
|
+
* Creates a new `Vector2` instance.
|
4528
|
+
*
|
4529
|
+
* @returns A new `Vector2` instance.
|
4530
|
+
*/
|
4531
|
+
static create(): Vector2;
|
4532
|
+
/**
|
4533
|
+
* Adds a vector to the current vector.
|
4534
|
+
*
|
4535
|
+
* @param vector2 - The vector to add to the current vector.
|
4536
|
+
* @returns The current vector.
|
4537
|
+
*/
|
4538
|
+
add(vector2: Vector2): Vector2;
|
4539
|
+
/**
|
4540
|
+
* Returns the angle between two vectors.
|
4541
|
+
*
|
4542
|
+
* @param vector2 - The vector to compare to the current vector.
|
4543
|
+
* @returns The angle between the two vectors.
|
4544
|
+
*/
|
4545
|
+
angle(vector2: Vector2): number;
|
4546
|
+
/**
|
4547
|
+
* Rounds each component of the vector up to the nearest integer.
|
4548
|
+
*
|
4549
|
+
* @returns The current vector.
|
4550
|
+
*/
|
4551
|
+
ceil(): Vector2;
|
4552
|
+
/**
|
4553
|
+
* Returns a new vector with the same components as the current vector.
|
4554
|
+
*
|
4555
|
+
* @returns A new `Vector2` instance.
|
4556
|
+
*/
|
4557
|
+
clone(): Vector2;
|
4558
|
+
/**
|
4559
|
+
* Copies the components of a vector to the current vector.
|
4560
|
+
*
|
4561
|
+
* @param vector2 - The vector to copy the components from.
|
4562
|
+
* @returns The current vector.
|
4563
|
+
*/
|
4564
|
+
copy(vector2: Vector2): Vector2;
|
4565
|
+
/**
|
4566
|
+
* Calculates the cross product of the current vector and another vector.
|
4567
|
+
*
|
4568
|
+
* @param vector2 - The vector to calculate the cross product with.
|
4569
|
+
* @returns The cross product of the two vector 2s as a vector3.
|
4570
|
+
*/
|
4571
|
+
cross(vector2: Vector2): Vector3;
|
4572
|
+
/**
|
4573
|
+
* Calculates the distance between the current vector and another vector.
|
4574
|
+
*
|
4575
|
+
* @param vector2 - The vector to calculate the distance to.
|
4576
|
+
* @returns The distance between the two vectors.
|
4577
|
+
*/
|
4578
|
+
distance(vector2: Vector2): number;
|
4579
|
+
/**
|
4580
|
+
* Divides the current vector by another vector.
|
4581
|
+
*
|
4582
|
+
* @param vector2 - The vector to divide the current vector by.
|
4583
|
+
* @returns The current vector.
|
4584
|
+
*/
|
4585
|
+
divide(vector2: Vector2): Vector2;
|
4586
|
+
/**
|
4587
|
+
* Calculates the dot product of the current vector and another vector.
|
4588
|
+
*
|
4589
|
+
* @param vector2 - The vector to calculate the dot product with.
|
4590
|
+
* @returns The dot product of the two vectors.
|
4591
|
+
*/
|
4592
|
+
dot(vector2: Vector2): number;
|
4593
|
+
/**
|
4594
|
+
* Checks if the current vector is approximately equal to another vector.
|
4595
|
+
*
|
4596
|
+
* @param vector2 - The vector to compare to the current vector.
|
4597
|
+
* @returns `true` if the two vectors are equal, `false` otherwise.
|
4598
|
+
*/
|
4599
|
+
equals(vector2: Vector2): boolean;
|
4600
|
+
/**
|
4601
|
+
* Checks if the current vector is exactly equal to another vector.
|
4602
|
+
*
|
4603
|
+
* @param vector2 - The vector to compare to the current vector.
|
4604
|
+
* @returns `true` if the two vectors are equal, `false` otherwise.
|
4605
|
+
*/
|
4606
|
+
exactEquals(vector2: Vector2): boolean;
|
4607
|
+
/**
|
4608
|
+
* Rounds each component of the vector down to the nearest integer.
|
4609
|
+
*
|
4610
|
+
* @returns The current vector.
|
4611
|
+
*/
|
4612
|
+
floor(): Vector2;
|
4613
|
+
/**
|
4614
|
+
* Inverts the components of the current vector.
|
4615
|
+
*
|
4616
|
+
* @returns The current vector.
|
4617
|
+
*/
|
4618
|
+
invert(): Vector2;
|
4619
|
+
/**
|
4620
|
+
* Linearly interpolates between the current vector and another vector.
|
4621
|
+
*
|
4622
|
+
* @param vector2 - The vector to interpolate to.
|
4623
|
+
* @param t - The interpolation factor. A value between 0 and 1.
|
4624
|
+
* @returns The current vector.
|
4625
|
+
*/
|
4626
|
+
lerp(vector2: Vector2, t: number): Vector2;
|
4627
|
+
/**
|
4628
|
+
* Sets each component of the vector to the maximum of the current vector and another vector.
|
4629
|
+
*
|
4630
|
+
* @param vector2 - The vector to compare to the current vector.
|
4631
|
+
* @returns The current vector.
|
4632
|
+
*/
|
4633
|
+
max(vector2: Vector2): Vector2;
|
4634
|
+
/**
|
4635
|
+
* Sets each component of the vector to the minimum of the current vector and another vector.
|
4636
|
+
*
|
4637
|
+
* @param vector2 - The vector to compare to the current vector.
|
4638
|
+
* @returns The current vector.
|
4639
|
+
*/
|
4640
|
+
min(vector2: Vector2): Vector2;
|
4641
|
+
/**
|
4642
|
+
* Multiplies each component of the current vector by the corresponding component of another vector.
|
4643
|
+
*
|
4644
|
+
* @param vector2 - The vector to multiply the current vector by.
|
4645
|
+
* @returns The current vector.
|
4646
|
+
*/
|
4647
|
+
multiply(vector2: Vector2): Vector2;
|
4648
|
+
/**
|
4649
|
+
* Negates each component of the vector.
|
4650
|
+
*
|
4651
|
+
* @returns The current vector.
|
4652
|
+
*/
|
4653
|
+
negate(): Vector2;
|
4654
|
+
/**
|
4655
|
+
* Normalizes the current vector.
|
4656
|
+
*
|
4657
|
+
* @returns The current vector.
|
4658
|
+
*/
|
4659
|
+
normalize(): Vector2;
|
4660
|
+
/**
|
4661
|
+
* Randomizes the components of the current vector.
|
4662
|
+
*
|
4663
|
+
* @param scale - The scale of the resulting vector.
|
4664
|
+
* @returns The current vector.
|
4665
|
+
*/
|
4666
|
+
randomize(scale?: number): Vector2;
|
4667
|
+
/**
|
4668
|
+
* Rotates the current vector around an origin.
|
4669
|
+
*
|
4670
|
+
* @param vector2 - The vector to rotate around.
|
4671
|
+
* @param angle - The angle to rotate the vector by.
|
4672
|
+
* @returns The current vector.
|
4673
|
+
*/
|
4674
|
+
rotate(vector2: Vector2, angle: number): Vector2;
|
4675
|
+
/**
|
4676
|
+
* Rounds each component of the vector to the nearest integer.
|
4677
|
+
*
|
4678
|
+
* @returns The current vector.
|
4679
|
+
*/
|
4680
|
+
round(): Vector2;
|
4681
|
+
/**
|
4682
|
+
* Scales the current vector by a scalar value.
|
4683
|
+
*
|
4684
|
+
* @param scale - The scalar value to scale the vector by.
|
4685
|
+
* @returns The current vector.
|
4686
|
+
*/
|
4687
|
+
scale(scale: number): Vector2;
|
4688
|
+
/**
|
4689
|
+
* Scales the current vector by a scalar value and adds the result to another vector.
|
4690
|
+
*
|
4691
|
+
* @param vector2 - The vector to add the scaled vector to.
|
4692
|
+
* @param scale - The scalar value to scale the vector by.
|
4693
|
+
* @returns The current vector.
|
4694
|
+
*/
|
4695
|
+
scaleAndAdd(vector2: Vector2, scale: number): Vector2;
|
4696
|
+
/**
|
4697
|
+
* Subtracts a vector from the current vector.
|
4698
|
+
*
|
4699
|
+
* @param vector2 - The vector to subtract from the current vector.
|
4700
|
+
* @returns The current vector.
|
4701
|
+
*/
|
4702
|
+
subtract(vector2: Vector2): Vector2;
|
4703
|
+
/**
|
4704
|
+
* Returns a string representation of the vector in x,y format.
|
4705
|
+
*
|
4706
|
+
* @returns A string representation of the vector in the format x,y.
|
4707
|
+
*/
|
4708
|
+
toString(): string;
|
4709
|
+
/**
|
4710
|
+
* Transforms the current vector by a matrix2.
|
4711
|
+
*
|
4712
|
+
* @param matrix2 - The matrix2 to transform the vector by.
|
4713
|
+
* @returns The current vector.
|
4714
|
+
*/
|
4715
|
+
transformMatrix2(matrix2: Matrix2): Vector2;
|
4716
|
+
/**
|
4717
|
+
* Transforms the current vector by a matrix3.
|
4718
|
+
*
|
4719
|
+
* @param matrix3 - The matrix3 to transform the vector by.
|
4720
|
+
* @returns The current vector.
|
4721
|
+
*/
|
4722
|
+
transformMatrix3(matrix3: Matrix3): Vector2;
|
4723
|
+
/**
|
4724
|
+
* Transforms the current vector by a matrix4.
|
4725
|
+
*
|
4726
|
+
* @param matrix4 - The matrix4 to transform the vector by.
|
4727
|
+
* @returns The current vector.
|
4728
|
+
*/
|
4729
|
+
transformMatrix4(matrix4: Matrix4): Vector2;
|
4730
|
+
/**
|
4731
|
+
* Sets each component of the vector to zero.
|
4732
|
+
*
|
4733
|
+
* @returns The current vector.
|
4734
|
+
*/
|
4735
|
+
zero(): Vector2;
|
4736
|
+
}
|
4737
|
+
|
4738
|
+
/** A 2-dimensional vector of boolean values. @public */
|
4739
|
+
export declare interface Vector2Boolean {
|
4740
|
+
x: boolean;
|
4741
|
+
y: boolean;
|
4742
|
+
}
|
4743
|
+
|
4744
|
+
/** A 2-dimensional vector. @public */
|
4745
|
+
export declare interface Vector2Like {
|
4746
|
+
x: number;
|
4747
|
+
y: number;
|
4748
|
+
}
|
4749
|
+
|
3889
4750
|
/**
|
3890
4751
|
* Represents a 3-dimensional vector.
|
3891
4752
|
*
|
@@ -3899,9 +4760,13 @@ export declare const SUPPORTED_INPUT_KEYS: readonly ["w", "a", "s", "d", "sp", "
|
|
3899
4760
|
*/
|
3900
4761
|
export declare class Vector3 extends Float32Array implements Vector3Like {
|
3901
4762
|
constructor(x: number, y: number, z: number);
|
3902
|
-
/** The
|
4763
|
+
/** The length of the vector. */
|
4764
|
+
get length(): number;
|
4765
|
+
/** The squared length of the vector. */
|
4766
|
+
get squaredLength(): number;
|
4767
|
+
/** The magnitude of the vector. Alias for `length`. */
|
3903
4768
|
get magnitude(): number;
|
3904
|
-
/** The squared magnitude of the vector.
|
4769
|
+
/** The squared magnitude of the vector. Alias for `squaredLength`. */
|
3905
4770
|
get squaredMagnitude(): number;
|
3906
4771
|
/** The x-component of the vector. */
|
3907
4772
|
get x(): number;
|
@@ -3912,6 +4777,12 @@ export declare class Vector3 extends Float32Array implements Vector3Like {
|
|
3912
4777
|
/** The z-component of the vector. */
|
3913
4778
|
get z(): number;
|
3914
4779
|
set z(value: number);
|
4780
|
+
/**
|
4781
|
+
* Creates a new `Vector3` instance.
|
4782
|
+
*
|
4783
|
+
* @returns A new `Vector3` instance.
|
4784
|
+
*/
|
4785
|
+
static create(): Vector3;
|
3915
4786
|
/**
|
3916
4787
|
* Creates a new `Vector3` instance from a `Vector3Like` object.
|
3917
4788
|
*
|
@@ -4033,6 +4904,13 @@ export declare class Vector3 extends Float32Array implements Vector3Like {
|
|
4033
4904
|
* @returns The current vector.
|
4034
4905
|
*/
|
4035
4906
|
normalize(): Vector3;
|
4907
|
+
/**
|
4908
|
+
* Randomizes the vector.
|
4909
|
+
*
|
4910
|
+
* @param scale - Length of the resulting vector, if omitted a unit vector is set.
|
4911
|
+
* @returns The current vector.
|
4912
|
+
*/
|
4913
|
+
randomize(scale?: number): Vector3;
|
4036
4914
|
/**
|
4037
4915
|
* Rotates the vector around the x-axis.
|
4038
4916
|
*
|
@@ -4070,6 +4948,14 @@ export declare class Vector3 extends Float32Array implements Vector3Like {
|
|
4070
4948
|
* @returns The current vector.
|
4071
4949
|
*/
|
4072
4950
|
scale(scale: number): Vector3;
|
4951
|
+
/**
|
4952
|
+
* Adds 2 vectors together after scaling the provided vector by a scalar value.
|
4953
|
+
*
|
4954
|
+
* @param vector3 - The vector to add the scaled vector to.
|
4955
|
+
* @param scale - The scalar value to scale the current vector by.
|
4956
|
+
* @returns The current vector.
|
4957
|
+
*/
|
4958
|
+
scaleAndAdd(vector3: Vector3, scale: number): Vector3;
|
4073
4959
|
/**
|
4074
4960
|
* Subtracts a vector from the current vector.
|
4075
4961
|
*
|
@@ -4083,6 +4969,33 @@ export declare class Vector3 extends Float32Array implements Vector3Like {
|
|
4083
4969
|
* @returns A string representation of the vector in the format x,y,z.
|
4084
4970
|
*/
|
4085
4971
|
toString(): string;
|
4972
|
+
/**
|
4973
|
+
* Transforms the vector by a matrix3.
|
4974
|
+
*
|
4975
|
+
* @param matrix3 - The matrix3 to transform the vector by.
|
4976
|
+
* @returns The current vector.
|
4977
|
+
*/
|
4978
|
+
transformMatrix3(matrix3: Matrix3): Vector3;
|
4979
|
+
/**
|
4980
|
+
* Transforms the vector by a matrix4.
|
4981
|
+
*
|
4982
|
+
* @param matrix4 - The matrix4 to transform the vector by.
|
4983
|
+
* @returns The current vector.
|
4984
|
+
*/
|
4985
|
+
transformMatrix4(matrix4: Matrix4): Vector3;
|
4986
|
+
/**
|
4987
|
+
* Transforms the vector by a quaternion.
|
4988
|
+
*
|
4989
|
+
* @param quaternion - The quaternion to transform the vector by.
|
4990
|
+
* @returns The current vector.
|
4991
|
+
*/
|
4992
|
+
transformQuaternion(quaternion: Quaternion): Vector3;
|
4993
|
+
/**
|
4994
|
+
* Sets each component of the vector to zero.
|
4995
|
+
*
|
4996
|
+
* @returns The current vector.
|
4997
|
+
*/
|
4998
|
+
zero(): Vector3;
|
4086
4999
|
}
|
4087
5000
|
|
4088
5001
|
/** A 3-dimensional vector of boolean values. @public */
|