@newkrok/nape-js 3.7.6 → 3.8.0

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.
@@ -0,0 +1,2690 @@
1
+ /**
2
+ * 2D vector used for positions, velocities, forces, and other 2D quantities.
3
+ *
4
+ * Supports object pooling via `Vec2.get()` / `dispose()`, weak references
5
+ * that auto-dispose after a single use, and immutability guards.
6
+ *
7
+ * Converted from nape-compiled.js lines 23448–27180.
8
+ */
9
+ declare class Vec2 {
10
+ static __name__: string[];
11
+ /**
12
+ * Creates a Vec2 with the given components. Defaults to (0, 0).
13
+ *
14
+ * @param x - The x component (default 0).
15
+ * @param y - The y component (default 0).
16
+ */
17
+ constructor(x?: number, y?: number);
18
+ /**
19
+ * Allocate a Vec2 from the public object pool. If `weak` is true, the vector
20
+ * auto-disposes after a single API call.
21
+ *
22
+ * @param x - The x component (default 0).
23
+ * @param y - The y component (default 0).
24
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
25
+ * @returns A pooled or newly created Vec2.
26
+ * @example
27
+ * const v = Vec2.get(3, 4);
28
+ * // use v ...
29
+ * v.dispose();
30
+ */
31
+ static get(x?: number, y?: number, weak?: boolean): Vec2;
32
+ /**
33
+ * Allocate a weak Vec2 (auto-disposes after a single use).
34
+ *
35
+ * @param x - The x component (default 0).
36
+ * @param y - The y component (default 0).
37
+ * @returns A weak, pooled Vec2 that is automatically disposed after one API call.
38
+ */
39
+ static weak(x?: number, y?: number): Vec2;
40
+ /**
41
+ * Create a Vec2 from polar coordinates (length and angle in radians).
42
+ *
43
+ * @param length - The magnitude of the resulting vector.
44
+ * @param angle - The angle in radians, measured counter-clockwise from the +x axis.
45
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
46
+ * @returns A new Vec2 with components `(length * cos(angle), length * sin(angle))`.
47
+ * @example
48
+ * const v = Vec2.fromPolar(1, Math.PI / 4); // 45-degree unit vector
49
+ */
50
+ static fromPolar(length: number, angle: number, weak?: boolean): Vec2;
51
+ /**
52
+ * Create a unit Vec2 pointing in the given direction (angle in radians).
53
+ * Equivalent to `Vec2.fromPolar(1, radians)`.
54
+ *
55
+ * @param radians - The angle in radians, measured counter-clockwise from the +x axis.
56
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
57
+ * @returns A unit Vec2 at the given angle.
58
+ */
59
+ static fromAngle(radians: number, weak?: boolean): Vec2;
60
+ /**
61
+ * Linearly interpolate between two Vec2s. Returns `a + t * (b - a)`.
62
+ * Disposes weak arguments after use.
63
+ *
64
+ * @param a - The start Vec2 (t = 0).
65
+ * @param b - The end Vec2 (t = 1).
66
+ * @param t - The interpolation factor (typically 0–1, but not clamped).
67
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
68
+ * @returns A new Vec2 at the interpolated position.
69
+ */
70
+ static lerp(a: Vec2, b: Vec2, t: number, weak?: boolean): Vec2;
71
+ /**
72
+ * Check whether two Vec2s are component-wise equal, within an optional epsilon tolerance.
73
+ * Disposes weak arguments after comparison.
74
+ *
75
+ * @param a - The first Vec2.
76
+ * @param b - The second Vec2.
77
+ * @param epsilon - Maximum allowed difference per component (default 0).
78
+ * @returns `true` if both components differ by at most `epsilon`.
79
+ */
80
+ static eq(a: Vec2, b: Vec2, epsilon?: number): boolean;
81
+ /**
82
+ * Squared Euclidean distance between two Vec2s. Avoids a square root when
83
+ * only comparison is needed.
84
+ *
85
+ * @param a - The first Vec2.
86
+ * @param b - The second Vec2.
87
+ * @returns The squared distance `(a.x - b.x)² + (a.y - b.y)²`.
88
+ */
89
+ static dsq(a: Vec2, b: Vec2): number;
90
+ /**
91
+ * Euclidean distance between two Vec2s.
92
+ *
93
+ * @param a - The first Vec2.
94
+ * @param b - The second Vec2.
95
+ * @returns The distance `sqrt((a.x - b.x)² + (a.y - b.y)²)`.
96
+ */
97
+ static distance(a: Vec2, b: Vec2): number;
98
+ /** The x component. */
99
+ get x(): number;
100
+ /** The x component. */
101
+ set x(value: number);
102
+ /** The y component. */
103
+ get y(): number;
104
+ /** The y component. */
105
+ set y(value: number);
106
+ /** Magnitude (Euclidean length) of the vector. */
107
+ get length(): number;
108
+ /**
109
+ * Setting length scales the vector to the given magnitude. Throws if the
110
+ * vector is zero-length.
111
+ *
112
+ * @param value - The desired magnitude. Must not be NaN.
113
+ */
114
+ set length(value: number);
115
+ /**
116
+ * Angle of the vector in radians, measured counter-clockwise from the +x
117
+ * axis. Returns 0 for the zero vector.
118
+ */
119
+ get angle(): number;
120
+ /**
121
+ * Setting angle preserves the vector's magnitude and rotates it to the given
122
+ * angle.
123
+ *
124
+ * @param value - The desired angle in radians. Must not be NaN.
125
+ */
126
+ set angle(value: number);
127
+ /**
128
+ * Returns the squared magnitude. Faster than `length` as it avoids a square
129
+ * root.
130
+ *
131
+ * @returns `x² + y²`.
132
+ */
133
+ lsq(): number;
134
+ /**
135
+ * Copy another Vec2's components into this vector in-place.
136
+ *
137
+ * @param vector - The source Vec2 to copy from.
138
+ * @returns `this` for chaining.
139
+ */
140
+ set(vector: Vec2): this;
141
+ /**
142
+ * Set both components at once in-place.
143
+ *
144
+ * @param x - The new x component.
145
+ * @param y - The new y component.
146
+ * @returns `this` for chaining.
147
+ */
148
+ setxy(x: number, y: number): this;
149
+ /**
150
+ * Return a new Vec2 with the same components. Alias for `copy()`.
151
+ *
152
+ * @returns A new Vec2 with the same x and y values.
153
+ */
154
+ clone(): Vec2;
155
+ /**
156
+ * Check whether this Vec2 is component-wise equal to another, within an optional epsilon tolerance.
157
+ *
158
+ * @param other - The Vec2 to compare against.
159
+ * @param epsilon - Maximum allowed difference per component (default 0).
160
+ * @returns `true` if both components differ by at most `epsilon`.
161
+ */
162
+ equals(other: Vec2, epsilon?: number): boolean;
163
+ /**
164
+ * Return a new Vec2 with the same components.
165
+ *
166
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
167
+ * @returns A copy of this vector.
168
+ */
169
+ copy(weak?: boolean): Vec2;
170
+ /**
171
+ * Rotate this vector by `angle` radians in-place.
172
+ *
173
+ * @param angle - The rotation angle in radians.
174
+ * @returns `this` for chaining.
175
+ */
176
+ rotate(angle: number): this;
177
+ /**
178
+ * Reflect `vec` about this vector as a normal axis.
179
+ *
180
+ * @param vec - The Vec2 to reflect.
181
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
182
+ * @returns A new Vec2 that is the reflection of `vec` about this vector.
183
+ */
184
+ reflect(vec: Vec2, weak?: boolean): Vec2;
185
+ /**
186
+ * Normalise this vector to unit length in-place. Throws for zero-length
187
+ * vectors.
188
+ *
189
+ * @returns `this` for chaining.
190
+ */
191
+ normalise(): this;
192
+ /**
193
+ * Return a new unit-length vector with the same direction. Throws for
194
+ * zero-length vectors.
195
+ *
196
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
197
+ * @returns A normalised copy of this vector.
198
+ */
199
+ unit(weak?: boolean): Vec2;
200
+ /**
201
+ * Return a new Vec2 equal to `this + other`.
202
+ *
203
+ * @param vector - The Vec2 to add.
204
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
205
+ * @returns A new Vec2 with components `(this.x + other.x, this.y + other.y)`.
206
+ */
207
+ add(vector: Vec2, weak?: boolean): Vec2;
208
+ /**
209
+ * Return a new Vec2 equal to `this + other × scalar`.
210
+ *
211
+ * @param vector - The Vec2 to scale and add.
212
+ * @param scalar - The multiplier applied to `vector` before addition.
213
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
214
+ * @returns A new Vec2 with components `(this.x + vector.x * scalar, this.y + vector.y * scalar)`.
215
+ */
216
+ addMul(vector: Vec2, scalar: number, weak?: boolean): Vec2;
217
+ /**
218
+ * Return a new Vec2 equal to `this − other`.
219
+ *
220
+ * @param vector - The Vec2 to subtract.
221
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
222
+ * @returns A new Vec2 with components `(this.x - other.x, this.y - other.y)`.
223
+ */
224
+ sub(vector: Vec2, weak?: boolean): Vec2;
225
+ /**
226
+ * Return a new Vec2 equal to `this × scalar`.
227
+ *
228
+ * @param scalar - The multiplier.
229
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
230
+ * @returns A new Vec2 with components `(this.x * scalar, this.y * scalar)`.
231
+ */
232
+ mul(scalar: number, weak?: boolean): Vec2;
233
+ /**
234
+ * Add another Vec2 to this in-place (`this += other`).
235
+ *
236
+ * @param vector - The Vec2 to add.
237
+ * @returns `this` for chaining.
238
+ */
239
+ addeq(vector: Vec2): this;
240
+ /**
241
+ * Subtract another Vec2 from this in-place (`this -= other`).
242
+ *
243
+ * @param vector - The Vec2 to subtract.
244
+ * @returns `this` for chaining.
245
+ */
246
+ subeq(vector: Vec2): this;
247
+ /**
248
+ * Multiply this Vec2 by a scalar in-place (`this ×= scalar`).
249
+ *
250
+ * @param scalar - The multiplier.
251
+ * @returns `this` for chaining.
252
+ */
253
+ muleq(scalar: number): this;
254
+ /**
255
+ * Dot product of this and another Vec2.
256
+ *
257
+ * @param vector - The other Vec2.
258
+ * @returns `this.x * other.x + this.y * other.y`.
259
+ */
260
+ dot(vector: Vec2): number;
261
+ /**
262
+ * 2D cross product (`this.x × other.y − this.y × other.x`). Returns a
263
+ * scalar.
264
+ *
265
+ * @param vector - The other Vec2.
266
+ * @returns The scalar cross product.
267
+ */
268
+ cross(vector: Vec2): number;
269
+ /**
270
+ * Return the perpendicular vector, rotated 90° counter-clockwise.
271
+ *
272
+ * @param weak - If true, the returned Vec2 is auto-disposed after one use (default false).
273
+ * @returns A new Vec2 with components `(-this.y, this.x)`.
274
+ */
275
+ perp(weak?: boolean): Vec2;
276
+ /**
277
+ * Return this Vec2 to the object pool. Throws if already disposed or
278
+ * immutable.
279
+ */
280
+ dispose(): void;
281
+ /**
282
+ * String representation in the form `{ x: … y: … }`.
283
+ *
284
+ * @returns A human-readable string of this vector's components.
285
+ */
286
+ toString(): string;
287
+ }
288
+ /** Opaque handle for any nape internal object. */
289
+ type NapeInner = any;
290
+
291
+ /**
292
+ * 3D vector used for constraint impulses and other 3-component values.
293
+ *
294
+ * Supports object pooling via `Vec3.get()` / `dispose()`.
295
+ *
296
+ * Converted from nape-compiled.js lines 24120–25040.
297
+ */
298
+ declare class Vec3 {
299
+ static __name__: string[];
300
+ /**
301
+ * Create a Vec3 with the given components. Defaults to (0, 0, 0).
302
+ * @param x - The x component.
303
+ * @param y - The y component.
304
+ * @param z - The z component.
305
+ */
306
+ constructor(x?: number, y?: number, z?: number);
307
+ /**
308
+ * Allocate a Vec3 from the public object pool, or create a new one if the pool is empty.
309
+ * @param x - Initial x component (default 0).
310
+ * @param y - Initial y component (default 0).
311
+ * @param z - Initial z component (default 0).
312
+ * @returns A Vec3 initialised with the given components.
313
+ */
314
+ static get(x?: number, y?: number, z?: number): Vec3;
315
+ /** The x component. */
316
+ get x(): number;
317
+ /** The x component. */
318
+ set x(value: number);
319
+ /** The y component. */
320
+ get y(): number;
321
+ /** The y component. */
322
+ set y(value: number);
323
+ /** The z component. */
324
+ get z(): number;
325
+ /** The z component. */
326
+ set z(value: number);
327
+ /**
328
+ * Magnitude of the 3D vector.
329
+ * @returns The Euclidean length `sqrt(x² + y² + z²)`.
330
+ */
331
+ get length(): number;
332
+ /**
333
+ * Scale the vector to the given magnitude.
334
+ * @throws If the vector has zero length.
335
+ */
336
+ set length(value: number);
337
+ /**
338
+ * Squared magnitude. Faster than `length` as it avoids a square root.
339
+ * @returns `x² + y² + z²`.
340
+ */
341
+ lsq(): number;
342
+ /**
343
+ * Copy another Vec3's components into this one in-place.
344
+ * @param vector - The source Vec3 to copy from.
345
+ * @returns `this` for chaining.
346
+ */
347
+ set(vector: Vec3): this;
348
+ /**
349
+ * Set all three components at once in-place.
350
+ * @param x - The new x component.
351
+ * @param y - The new y component.
352
+ * @param z - The new z component.
353
+ * @returns `this` for chaining.
354
+ */
355
+ setxyz(x: number, y: number, z: number): this;
356
+ /**
357
+ * Check whether this Vec3 is component-wise equal to another, within an optional epsilon tolerance.
358
+ *
359
+ * @param other - The Vec3 to compare against.
360
+ * @param epsilon - Maximum allowed difference per component (default 0).
361
+ * @returns `true` if all three components differ by at most `epsilon`.
362
+ */
363
+ equals(other: Vec3, epsilon?: number): boolean;
364
+ /**
365
+ * Return a new Vec3 with the same components.
366
+ * @returns A copy of this vector.
367
+ */
368
+ clone(): Vec3;
369
+ /**
370
+ * Return the x and y components as a new Vec2.
371
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
372
+ * @returns A new Vec2 containing this vector's x and y components.
373
+ */
374
+ xy(weak?: boolean): Vec2;
375
+ /**
376
+ * Return this Vec3 to the object pool.
377
+ * @throws If this Vec3 has already been disposed.
378
+ */
379
+ dispose(): void;
380
+ /**
381
+ * String representation `{ x: … y: … z: … }`.
382
+ * @returns A human-readable string of the three components.
383
+ */
384
+ toString(): string;
385
+ }
386
+
387
+ /**
388
+ * 2x3 affine transformation matrix [a b tx; c d ty].
389
+ *
390
+ * Converted from nape-compiled.js lines 20507–21760.
391
+ */
392
+ declare class Mat23 {
393
+ static __name__: string[];
394
+ /**
395
+ * Create a Mat23 with the given components. Defaults to the identity matrix `[1 0 0; 0 1 0]`.
396
+ * @param a - Component at row 0, col 0.
397
+ * @param b - Component at row 0, col 1.
398
+ * @param c - Component at row 1, col 0.
399
+ * @param d - Component at row 1, col 1.
400
+ * @param tx - Translation component along x.
401
+ * @param ty - Translation component along y.
402
+ */
403
+ constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
404
+ /**
405
+ * Create a pure rotation matrix for the given angle in radians.
406
+ * @param angle - Rotation angle in radians.
407
+ * @returns A new Mat23 representing the rotation.
408
+ */
409
+ static rotation(angle: number): Mat23;
410
+ /**
411
+ * Create a pure translation matrix.
412
+ * @param tx - Translation along x.
413
+ * @param ty - Translation along y.
414
+ * @returns A new Mat23 representing the translation.
415
+ */
416
+ static translation(tx: number, ty: number): Mat23;
417
+ /**
418
+ * Create a pure scale matrix.
419
+ * @param sx - Scale factor along x.
420
+ * @param sy - Scale factor along y.
421
+ * @returns A new Mat23 representing the scale.
422
+ */
423
+ static scale(sx: number, sy: number): Mat23;
424
+ static _wrap(inner: any): Mat23;
425
+ private _setProp;
426
+ /** Matrix component at row 0, col 0. The matrix layout is `[a b tx; c d ty]`. */
427
+ get a(): number;
428
+ /** Matrix component at row 0, col 0. The matrix layout is `[a b tx; c d ty]`. */
429
+ set a(v: number);
430
+ /** Matrix component at row 0, col 1. The matrix layout is `[a b tx; c d ty]`. */
431
+ get b(): number;
432
+ /** Matrix component at row 0, col 1. The matrix layout is `[a b tx; c d ty]`. */
433
+ set b(v: number);
434
+ /** Matrix component at row 1, col 0. The matrix layout is `[a b tx; c d ty]`. */
435
+ get c(): number;
436
+ /** Matrix component at row 1, col 0. The matrix layout is `[a b tx; c d ty]`. */
437
+ set c(v: number);
438
+ /** Matrix component at row 1, col 1. The matrix layout is `[a b tx; c d ty]`. */
439
+ get d(): number;
440
+ /** Matrix component at row 1, col 1. The matrix layout is `[a b tx; c d ty]`. */
441
+ set d(v: number);
442
+ /** Translation component along x. The matrix layout is `[a b tx; c d ty]`. */
443
+ get tx(): number;
444
+ /** Translation component along x. The matrix layout is `[a b tx; c d ty]`. */
445
+ set tx(v: number);
446
+ /** Translation component along y. The matrix layout is `[a b tx; c d ty]`. */
447
+ get ty(): number;
448
+ /** Translation component along y. The matrix layout is `[a b tx; c d ty]`. */
449
+ set ty(v: number);
450
+ /** The determinant of the linear 2×2 part (ad − bc). */
451
+ get determinant(): number;
452
+ /**
453
+ * Return a new Mat23 with the same components. Alias for `copy()`.
454
+ * @returns A new Mat23 with the same components.
455
+ */
456
+ clone(): Mat23;
457
+ /**
458
+ * Check whether this Mat23 is component-wise equal to another, within an optional epsilon tolerance.
459
+ *
460
+ * @param other - The Mat23 to compare against.
461
+ * @param epsilon - Maximum allowed difference per component (default 0).
462
+ * @returns `true` if all six components differ by at most `epsilon`.
463
+ */
464
+ equals(other: Mat23, epsilon?: number): boolean;
465
+ /**
466
+ * Return a new Mat23 with the same components.
467
+ * @returns A deep copy of this matrix.
468
+ */
469
+ copy(): Mat23;
470
+ /**
471
+ * Copy all components from another Mat23 into this one in-place.
472
+ * @param matrix - The source matrix to copy from.
473
+ * @returns `this` for chaining.
474
+ */
475
+ set(matrix: Mat23): this;
476
+ /**
477
+ * Set all six components at once in-place.
478
+ * @param a - Component at row 0, col 0.
479
+ * @param b - Component at row 0, col 1.
480
+ * @param c - Component at row 1, col 0.
481
+ * @param d - Component at row 1, col 1.
482
+ * @param tx - Translation along x.
483
+ * @param ty - Translation along y.
484
+ * @returns `this` for chaining.
485
+ */
486
+ setAs(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): this;
487
+ /**
488
+ * Reset to the identity matrix in-place.
489
+ * @returns `this` for chaining.
490
+ */
491
+ reset(): this;
492
+ /**
493
+ * Return `true` if the matrix is singular (non-invertible) within the engine's epsilon threshold.
494
+ * @returns `true` when the matrix cannot be safely inverted.
495
+ */
496
+ singular(): boolean;
497
+ /**
498
+ * Return the inverse of this matrix.
499
+ * @returns A new Mat23 that is the inverse of this one.
500
+ * @throws If the matrix is singular.
501
+ */
502
+ inverse(): Mat23;
503
+ /**
504
+ * Return the transpose of this matrix.
505
+ * @returns A new Mat23 that is the transpose of this one.
506
+ */
507
+ transpose(): Mat23;
508
+ /**
509
+ * Return `matrix × this` (apply this matrix first, then `matrix`).
510
+ * @param matrix - The matrix to concatenate on the left.
511
+ * @returns A new Mat23 representing the combined transformation.
512
+ */
513
+ concat(matrix: Mat23): Mat23;
514
+ /**
515
+ * Transform a Vec2 by this matrix. If `noTranslation` is true, only the linear 2×2 part is applied.
516
+ * @param point - The Vec2 to transform.
517
+ * @param noTranslation - When true, the translation components (tx, ty) are ignored.
518
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
519
+ * @returns A new Vec2 with the transformed coordinates.
520
+ */
521
+ transform(point: Vec2, noTranslation?: boolean, weak?: boolean): Vec2;
522
+ /**
523
+ * Apply the inverse transformation to a Vec2. Throws if the matrix is singular.
524
+ * @param point - The Vec2 to transform.
525
+ * @param noTranslation - When true, the translation components (tx, ty) are ignored.
526
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
527
+ * @returns A new Vec2 with the inverse-transformed coordinates.
528
+ */
529
+ inverseTransform(point: Vec2, noTranslation?: boolean, weak?: boolean): Vec2;
530
+ /**
531
+ * Return `true` if the matrix is equiorthogonal (uniform scale, no shear).
532
+ * @returns `true` when the matrix has equal scale on both axes and no shear.
533
+ */
534
+ equiorthogonal(): boolean;
535
+ /**
536
+ * Return `true` if the matrix is orthogonal (unit-scale rotation, no shear).
537
+ * @returns `true` when the column vectors are orthonormal.
538
+ */
539
+ orthogonal(): boolean;
540
+ private _orthogonaliseImpl;
541
+ /**
542
+ * Adjust the matrix in-place to be equiorthogonal (uniform scale, no shear).
543
+ * @returns `this` for chaining.
544
+ */
545
+ equiorthogonalise(): this;
546
+ /**
547
+ * Adjust the matrix in-place to be orthogonal (normalise column vectors).
548
+ * @returns `this` for chaining.
549
+ */
550
+ orthogonalise(): this;
551
+ /**
552
+ * String representation `{ a: … b: … c: … d: … tx: … ty: … }`.
553
+ * @returns A human-readable string of the matrix components.
554
+ */
555
+ toString(): string;
556
+ }
557
+
558
+ /**
559
+ * Axis-aligned bounding box defined by min/max corners or x/y/width/height.
560
+ *
561
+ * Internally wraps a ZPP_AABB and is registered as the public
562
+ * `nape.geom.AABB` class in the compiled namespace.
563
+ *
564
+ * Converted from nape-compiled.js lines 14950–15653.
565
+ */
566
+ declare class AABB {
567
+ static __name__: string[];
568
+ /**
569
+ * Create an AABB at position (x, y) with the given width and height. All
570
+ * values default to 0.
571
+ *
572
+ * @param x - The x position of the left edge (default 0).
573
+ * @param y - The y position of the top edge (default 0).
574
+ * @param width - The width of the box (default 0). Must be ≥ 0.
575
+ * @param height - The height of the box (default 0). Must be ≥ 0.
576
+ */
577
+ constructor(x?: number, y?: number, width?: number, height?: number);
578
+ /**
579
+ * Create the smallest AABB that contains all the given points.
580
+ * Disposes weak Vec2 arguments after use.
581
+ *
582
+ * @param points - An array of Vec2 points to enclose. Must contain at least one point.
583
+ * @returns A new AABB enclosing all the points.
584
+ */
585
+ static fromPoints(points: Vec2[]): AABB;
586
+ /** The x position of the left edge (minx). Setting shifts the box horizontally. */
587
+ get x(): number;
588
+ /** The x position of the left edge (minx). Setting shifts the box horizontally. */
589
+ set x(x: number);
590
+ /** The y position of the top edge (miny). Setting shifts the box vertically. */
591
+ get y(): number;
592
+ /** The y position of the top edge (miny). Setting shifts the box vertically. */
593
+ set y(y: number);
594
+ /** Width of the box (maxx − minx). Must be ≥ 0. */
595
+ get width(): number;
596
+ /** Width of the box (maxx − minx). Must be ≥ 0. */
597
+ set width(width: number);
598
+ /** Height of the box (maxy − miny). Must be ≥ 0. */
599
+ get height(): number;
600
+ /** Height of the box (maxy − miny). Must be ≥ 0. */
601
+ set height(height: number);
602
+ /**
603
+ * The top-left corner as a Vec2 (minx, miny). The returned Vec2 is a live
604
+ * view; mutating it updates the AABB.
605
+ */
606
+ get min(): any;
607
+ /**
608
+ * Set the top-left corner. The new min must not exceed the current max.
609
+ *
610
+ * @param min - A Vec2 whose components become the new (minx, miny).
611
+ */
612
+ set min(min: any);
613
+ /**
614
+ * The bottom-right corner as a Vec2 (maxx, maxy). The returned Vec2 is a
615
+ * live view; mutating it updates the AABB.
616
+ */
617
+ get max(): any;
618
+ /**
619
+ * Set the bottom-right corner. The new max must not be below the current
620
+ * min.
621
+ *
622
+ * @param max - A Vec2 whose components become the new (maxx, maxy).
623
+ */
624
+ set max(max: any);
625
+ /**
626
+ * Return a new AABB with the same bounds. Alias for `copy()`.
627
+ *
628
+ * @returns A new AABB with the same position and dimensions.
629
+ */
630
+ clone(): AABB;
631
+ /**
632
+ * Check whether this AABB is equal to another, within an optional epsilon tolerance.
633
+ *
634
+ * @param other - The AABB to compare against.
635
+ * @param epsilon - Maximum allowed difference per component (default 0).
636
+ * @returns `true` if all four bounds (minx, miny, maxx, maxy) differ by at most `epsilon`.
637
+ */
638
+ equals(other: AABB, epsilon?: number): boolean;
639
+ /**
640
+ * Return a new AABB with the same bounds.
641
+ *
642
+ * @returns A copy of this AABB.
643
+ */
644
+ copy(): AABB;
645
+ /**
646
+ * String representation in the form `{ x: … y: … w: … h: … }`.
647
+ *
648
+ * @returns A human-readable string of this AABB's position and dimensions.
649
+ */
650
+ toString(): string;
651
+ }
652
+
653
+ /**
654
+ * Variable-sized M×N matrix.
655
+ *
656
+ * Converted from nape-compiled.js lines 17261–17395.
657
+ */
658
+ declare class MatMN {
659
+ static __name__: string[];
660
+ /**
661
+ * Create a zero-filled M×N matrix. Both dimensions must be ≥ 1.
662
+ * @param rows - Number of rows (must be ≥ 1).
663
+ * @param cols - Number of columns (must be ≥ 1).
664
+ */
665
+ constructor(rows: number, cols: number);
666
+ /** Number of rows. */
667
+ get rows(): number;
668
+ /** Number of columns. */
669
+ get cols(): number;
670
+ /**
671
+ * Read the element at (row, col). Zero-based indices.
672
+ * @param row - Zero-based row index.
673
+ * @param col - Zero-based column index.
674
+ * @returns The element value at the given position.
675
+ */
676
+ x(row: number, col: number): number;
677
+ /**
678
+ * Write `value` to the element at (row, col). Returns the written value.
679
+ * @param row - Zero-based row index.
680
+ * @param col - Zero-based column index.
681
+ * @param value - The value to write.
682
+ * @returns The written value.
683
+ */
684
+ setx(row: number, col: number, value: number): number;
685
+ /**
686
+ * Check whether this MatMN is element-wise equal to another, within an optional epsilon tolerance.
687
+ * Matrices must have the same dimensions.
688
+ *
689
+ * @param other - The MatMN to compare against.
690
+ * @param epsilon - Maximum allowed difference per element (default 0).
691
+ * @returns `true` if dimensions match and all elements differ by at most `epsilon`.
692
+ */
693
+ equals(other: MatMN, epsilon?: number): boolean;
694
+ /**
695
+ * Return a new MatMN with the same dimensions and element values.
696
+ * @returns A deep copy of this matrix.
697
+ */
698
+ clone(): MatMN;
699
+ /**
700
+ * String representation with rows separated by semicolons.
701
+ * @returns A human-readable string of the matrix elements.
702
+ */
703
+ toString(): string;
704
+ /**
705
+ * Return a new transposed matrix (N×M).
706
+ * @returns A new MatMN that is the transpose of this one.
707
+ */
708
+ transpose(): MatMN;
709
+ /**
710
+ * Return the matrix product `this × matrix`. Column count of this must equal row count of `matrix`.
711
+ * @param matrix - The right-hand matrix to multiply by.
712
+ * @returns A new MatMN representing the product.
713
+ */
714
+ mul(matrix: MatMN): MatMN;
715
+ }
716
+
717
+ /**
718
+ * A ray for raycasting queries.
719
+ *
720
+ * Fully modernized — uses ZPP_Ray directly (extracted to TypeScript).
721
+ */
722
+ declare class Ray {
723
+ static __name__: string[];
724
+ /**
725
+ * Create a Ray from an origin point and a direction vector.
726
+ * Both must be non-null, non-disposed Vec2s.
727
+ * @param origin - The start point of the ray in world coordinates.
728
+ * @param direction - The direction vector (need not be unit length).
729
+ */
730
+ constructor(origin: Vec2, direction: Vec2);
731
+ /**
732
+ * Create a Ray from a line segment.
733
+ * The ray origin is `start`, direction is `end − start`, and `maxDistance` is the segment length.
734
+ * @param start - The start point of the segment.
735
+ * @param end - The end point of the segment.
736
+ * @returns A new Ray spanning the segment.
737
+ */
738
+ static fromSegment(start: Vec2, end: Vec2): Ray;
739
+ /** The ray's start point in world coordinates. */
740
+ get origin(): Vec2;
741
+ /** The ray's start point in world coordinates. */
742
+ set origin(value: Vec2);
743
+ /** The ray's direction vector (need not be unit length; the engine normalises internally). */
744
+ get direction(): Vec2;
745
+ /** The ray's direction vector (need not be unit length; the engine normalises internally). */
746
+ set direction(value: Vec2);
747
+ /** Maximum travel distance for raycasting queries. Defaults to `Infinity`. */
748
+ get maxDistance(): number;
749
+ /** Maximum travel distance for raycasting queries. Defaults to `Infinity`. */
750
+ set maxDistance(value: number);
751
+ /** Arbitrary user data attached to this Ray. */
752
+ get userData(): Record<string, unknown>;
753
+ /**
754
+ * Compute the axis-aligned bounding box that encloses the ray from origin to `maxDistance`.
755
+ * @returns A new AABB wrapping the ray's extent.
756
+ */
757
+ aabb(): AABB;
758
+ /**
759
+ * Return the world-space point at `distance` along the ray.
760
+ * @param distance - Distance from the ray origin along the ray direction.
761
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
762
+ * @returns The point `origin + distance * normalised_direction`.
763
+ */
764
+ at(distance: number, weak?: boolean): Vec2;
765
+ /**
766
+ * Return a new Ray with the same origin, direction, and maxDistance. Alias for `copy()`.
767
+ * @returns A new Ray with the same properties.
768
+ */
769
+ clone(): Ray;
770
+ /**
771
+ * Return a new Ray with the same origin, direction, and maxDistance.
772
+ * @returns A deep copy of this Ray.
773
+ */
774
+ copy(): Ray;
775
+ }
776
+
777
+ /**
778
+ * Generic typed wrapper around Haxe list objects (BodyList, ShapeList, etc.).
779
+ *
780
+ * Provides a modern iterable interface with `for...of`, `length`, `at()`, etc.
781
+ */
782
+ declare class NapeList<T> implements Iterable<T> {
783
+ /** Number of elements in the list. */
784
+ get length(): number;
785
+ /** Get element at index. */
786
+ at(index: number): T;
787
+ /** Add an element to the list. */
788
+ add(item: T & {
789
+ _inner?: NapeInner;
790
+ }): void;
791
+ /** Remove an element from the list. */
792
+ remove(item: T & {
793
+ _inner?: NapeInner;
794
+ }): void;
795
+ /** Check if the list contains an element. */
796
+ has(item: T & {
797
+ _inner?: NapeInner;
798
+ }): boolean;
799
+ /** Remove all elements. */
800
+ clear(): void;
801
+ /** Whether the list is empty. */
802
+ get empty(): boolean;
803
+ /** Push an element to the end. */
804
+ push(item: T & {
805
+ _inner?: NapeInner;
806
+ }): void;
807
+ /** Pop the last element. */
808
+ pop(): T;
809
+ /** Shift the first element. */
810
+ shift(): T;
811
+ /** Unshift an element to the front. */
812
+ unshift(item: T & {
813
+ _inner?: NapeInner;
814
+ }): void;
815
+ /** Iterate over all elements. */
816
+ [Symbol.iterator](): Iterator<T>;
817
+ /** Convert to a plain array. */
818
+ toArray(): T[];
819
+ /** Apply a function to each element. */
820
+ forEach(fn: (item: T, index: number) => void): void;
821
+ toString(): string;
822
+ }
823
+
824
+ /**
825
+ * Hierarchical interaction group for controlling interactions
826
+ * between sets of interactors.
827
+ *
828
+ * Internally wraps a ZPP_InteractionGroup and is registered as
829
+ * the public `nape.dynamics.InteractionGroup` class in the compiled namespace.
830
+ *
831
+ * Converted from nape-compiled.js lines 14641–14733.
832
+ */
833
+ declare class InteractionGroup {
834
+ static __name__: string[];
835
+ constructor(ignore?: boolean);
836
+ get group(): InteractionGroup | null;
837
+ set group(value: InteractionGroup | null);
838
+ get ignore(): boolean;
839
+ set ignore(value: boolean);
840
+ get interactors(): any;
841
+ get groups(): any;
842
+ toString(): string;
843
+ }
844
+
845
+ /**
846
+ * Base class for all interactable physics objects (Body, Shape, Compound).
847
+ *
848
+ * Cannot be instantiated directly — only via Body, Shape, or Compound.
849
+ * Provides shared properties: id, userData, group, cbTypes, and type
850
+ * casting methods (castBody, castShape, castCompound).
851
+ *
852
+ * Fully modernized — all methods use ZPP_Interactor fields directly
853
+ * via `zpp_inner_i` (no compiled prototype delegation).
854
+ */
855
+ declare class Interactor {
856
+ /** Unique numeric identifier for this interactor. */
857
+ get id(): number;
858
+ /** User-defined data storage object. */
859
+ get userData(): Record<string, unknown>;
860
+ /** The interaction group this interactor belongs to. */
861
+ get group(): InteractionGroup | null;
862
+ set group(value: InteractionGroup | null);
863
+ /** Callback types assigned to this interactor. */
864
+ get cbTypes(): any;
865
+ /** Cast to Body — returns the Body wrapper if this is a Body, else null. */
866
+ get castBody(): any;
867
+ /** Cast to Shape — returns the Shape wrapper if this is a Shape, else null. */
868
+ get castShape(): any;
869
+ /** Cast to Compound — returns the Compound wrapper if this is a Compound, else null. */
870
+ get castCompound(): any;
871
+ /** Returns true if this interactor is a Shape. */
872
+ isShape(): boolean;
873
+ /** Returns true if this interactor is a Body. */
874
+ isBody(): boolean;
875
+ /** Returns true if this interactor is a Compound. */
876
+ isCompound(): boolean;
877
+ toString(): string;
878
+ }
879
+
880
+ /**
881
+ * A compound physics object — a hierarchical grouping of Bodies, Constraints,
882
+ * and other Compounds.
883
+ *
884
+ * Fully modernized — uses ZPP_Compound directly (extracted to TypeScript).
885
+ */
886
+ declare class Compound extends Interactor {
887
+ static __name__: string[];
888
+ static __super__: typeof Interactor;
889
+ constructor();
890
+ /** Bodies in this compound. */
891
+ get bodies(): object;
892
+ /** Constraints in this compound. */
893
+ get constraints(): object;
894
+ /** Child compounds in this compound. */
895
+ get compounds(): object;
896
+ /** Parent compound, or null if this is a root compound. */
897
+ get compound(): Compound | null;
898
+ set compound(value: Compound | null);
899
+ /** Space this compound belongs to (only settable on root compounds). */
900
+ get space(): Space | null;
901
+ set space(value: Space | null);
902
+ /** Deep copy of this compound and all its children. */
903
+ copy(): Compound;
904
+ /** Distribute all children to the parent compound or space, then remove. */
905
+ breakApart(): void;
906
+ /** Recursively visit all bodies in this compound and its sub-compounds. */
907
+ visitBodies(lambda: (body: Body) => void): void;
908
+ /** Recursively visit all constraints in this compound and its sub-compounds. */
909
+ visitConstraints(lambda: (constraint: Constraint) => void): void;
910
+ /** Recursively visit all sub-compounds in this compound. */
911
+ visitCompounds(lambda: (compound: Compound) => void): void;
912
+ /** Calculate the center of mass of all bodies in this compound. */
913
+ COM(weak?: boolean): Vec2;
914
+ /** Translate all bodies in this compound by the given vector. */
915
+ translate(translation: Vec2): Compound;
916
+ /** Rotate all bodies in this compound around the given centre point. */
917
+ rotate(centre: Vec2, angle: number): Compound;
918
+ toString(): string;
919
+ }
920
+
921
+ /**
922
+ * Base class for all physics constraints (joints).
923
+ *
924
+ * Constraints restrict the relative motion of two bodies. This class provides
925
+ * properties common to all joint types: `active`, `stiff`, `frequency`,
926
+ * `damping`, `maxForce`, `maxError`, `breakUnderForce`, `breakUnderError`,
927
+ * `removeOnBreak`, `isSleeping`, `space`, `compound`, `cbTypes`, and `userData`.
928
+ *
929
+ * Cannot be instantiated directly — use one of the concrete joint subclasses:
930
+ * {@link AngleJoint}, {@link DistanceJoint}, {@link LineJoint}, {@link MotorJoint},
931
+ * {@link PivotJoint}, {@link PulleyJoint}, {@link WeldJoint}, or {@link UserConstraint}.
932
+ *
933
+ * **Soft vs. stiff constraints:**
934
+ * - `stiff = true` (default): the constraint is enforced rigidly.
935
+ * - `stiff = false`: uses a spring model with `frequency` (Hz) and `damping` (ratio).
936
+ *
937
+ * Fully modernized — uses ZPP_Constraint directly (extracted to TypeScript).
938
+ */
939
+ declare class Constraint {
940
+ static __name__: string[];
941
+ debugDraw: boolean;
942
+ /**
943
+ * The space this constraint belongs to, or `null` if not in a space.
944
+ *
945
+ * Assign to add/remove the constraint from a space:
946
+ * ```ts
947
+ * joint.space = mySpace; // adds to space
948
+ * joint.space = null; // removes from space
949
+ * ```
950
+ * Cannot be set if the constraint belongs to a {@link Compound}.
951
+ */
952
+ get space(): Space | null;
953
+ set space(value: Space | null);
954
+ /**
955
+ * The compound this constraint belongs to, or `null`.
956
+ * When set, the constraint's `space` is managed by the compound.
957
+ */
958
+ get compound(): Compound | null;
959
+ set compound(value: Compound | null);
960
+ /**
961
+ * Whether the constraint is currently active (enforced by the solver).
962
+ *
963
+ * Deactivating a constraint suspends it without removing it from the space.
964
+ * @defaultValue `true`
965
+ */
966
+ get active(): boolean;
967
+ set active(value: boolean);
968
+ /**
969
+ * When `true` the constraint is completely ignored by the engine — bodies are
970
+ * not woken, no impulse is applied, and no callbacks fire.
971
+ * @defaultValue `false`
972
+ */
973
+ get ignore(): boolean;
974
+ set ignore(value: boolean);
975
+ /**
976
+ * When `true` (default) the constraint is stiff/rigid.
977
+ * When `false` the constraint uses a soft spring model driven by
978
+ * `frequency` and `damping`.
979
+ * @defaultValue `true`
980
+ */
981
+ get stiff(): boolean;
982
+ set stiff(value: boolean);
983
+ /**
984
+ * Spring frequency in Hz for soft constraints (`stiff = false`).
985
+ *
986
+ * Higher values make the spring stiffer; lower values make it bouncier.
987
+ * Must be `> 0`. Ignored when `stiff` is `true`.
988
+ * @defaultValue `10`
989
+ */
990
+ get frequency(): number;
991
+ set frequency(value: number);
992
+ /**
993
+ * Damping ratio for soft constraints (`stiff = false`).
994
+ *
995
+ * `0` = undamped (oscillates freely), `1` = critically damped.
996
+ * Values `> 1` are overdamped. Must be `>= 0`. Ignored when `stiff` is `true`.
997
+ * @defaultValue `1`
998
+ */
999
+ get damping(): number;
1000
+ set damping(value: number);
1001
+ /**
1002
+ * Maximum force (in Newtons) the constraint may apply per step.
1003
+ *
1004
+ * When the required force exceeds this value the constraint becomes slack.
1005
+ * If `breakUnderForce` is `true` the constraint breaks instead.
1006
+ * Must be `>= 0`. `Infinity` disables the limit.
1007
+ * @defaultValue `Infinity`
1008
+ */
1009
+ get maxForce(): number;
1010
+ set maxForce(value: number);
1011
+ /**
1012
+ * Maximum positional error (in pixels) allowed before breaking.
1013
+ *
1014
+ * Only meaningful when `breakUnderError` is `true`.
1015
+ * Must be `>= 0`. `Infinity` disables the limit.
1016
+ * @defaultValue `Infinity`
1017
+ */
1018
+ get maxError(): number;
1019
+ set maxError(value: number);
1020
+ /**
1021
+ * When `true`, the constraint breaks (fires a `BREAK` event) if the applied
1022
+ * force exceeds `maxForce` in a single step.
1023
+ * @defaultValue `false`
1024
+ */
1025
+ get breakUnderForce(): boolean;
1026
+ set breakUnderForce(value: boolean);
1027
+ /**
1028
+ * When `true`, the constraint breaks if the positional error exceeds `maxError`.
1029
+ * @defaultValue `false`
1030
+ */
1031
+ get breakUnderError(): boolean;
1032
+ set breakUnderError(value: boolean);
1033
+ /**
1034
+ * When `true` (default), the constraint is automatically removed from its space
1035
+ * when it breaks. Set to `false` to keep it in the space after breaking.
1036
+ * @defaultValue `true`
1037
+ */
1038
+ get removeOnBreak(): boolean;
1039
+ set removeOnBreak(value: boolean);
1040
+ /**
1041
+ * Whether the constraint's simulation component is currently sleeping.
1042
+ *
1043
+ * Only valid when the constraint is active and in a space — throws otherwise.
1044
+ */
1045
+ get isSleeping(): boolean;
1046
+ /**
1047
+ * Arbitrary user data attached to this constraint.
1048
+ * Lazily initialized to `{}` on first access.
1049
+ */
1050
+ get userData(): Record<string, unknown>;
1051
+ /**
1052
+ * The set of {@link CbType}s assigned to this constraint.
1053
+ * Used to filter which listeners respond to this constraint's events.
1054
+ */
1055
+ get cbTypes(): object;
1056
+ /**
1057
+ * The impulse applied by this constraint in the last simulation step.
1058
+ *
1059
+ * The shape of the returned {@link MatMN} depends on the constraint's degrees of
1060
+ * freedom (e.g., 1×1 for AngleJoint/MotorJoint, 2×1 for PivotJoint/LineJoint,
1061
+ * 3×1 for WeldJoint).
1062
+ */
1063
+ impulse(): MatMN | null;
1064
+ /**
1065
+ * The impulse applied to `body` by this constraint in the last simulation step,
1066
+ * expressed as a {@link Vec3} `(fx, fy, torque)`.
1067
+ *
1068
+ * @param _body - Must be one of the bodies linked to this constraint.
1069
+ */
1070
+ bodyImpulse(_body: Body): Vec3 | null;
1071
+ /**
1072
+ * Invokes `fn` once for each distinct body linked to this constraint.
1073
+ *
1074
+ * @param _fn - Function to call for each body.
1075
+ */
1076
+ visitBodies(_fn: (body: Body) => void): void;
1077
+ /**
1078
+ * Creates and returns a copy of this constraint with the same parameters.
1079
+ * The copy is not automatically added to a space.
1080
+ */
1081
+ copy(): Constraint;
1082
+ toString(): string;
1083
+ }
1084
+
1085
+ /**
1086
+ * Bit-mask based interaction filter for controlling which shapes
1087
+ * collide, sense, or interact as fluids.
1088
+ *
1089
+ * Internally wraps a ZPP_InteractionFilter and is registered as
1090
+ * the public `nape.dynamics.InteractionFilter` class in the compiled namespace.
1091
+ *
1092
+ * Converted from nape-compiled.js lines 14361–14640.
1093
+ */
1094
+ declare class InteractionFilter {
1095
+ static __name__: string[];
1096
+ /**
1097
+ * @param collisionGroup - Collision group bits (default 1).
1098
+ * @param collisionMask - Collision mask bits (default -1, all bits set).
1099
+ * @param sensorGroup - Sensor group bits (default 1).
1100
+ * @param sensorMask - Sensor mask bits (default -1, all bits set).
1101
+ * @param fluidGroup - Fluid group bits (default 1).
1102
+ * @param fluidMask - Fluid mask bits (default -1, all bits set).
1103
+ */
1104
+ constructor(collisionGroup?: number, collisionMask?: number, sensorGroup?: number, sensorMask?: number, fluidGroup?: number, fluidMask?: number);
1105
+ /** Bit-mask identifying which collision group(s) this shape belongs to. */
1106
+ get collisionGroup(): number;
1107
+ set collisionGroup(value: number);
1108
+ /** Bit-mask of collision groups this shape will collide with. */
1109
+ get collisionMask(): number;
1110
+ set collisionMask(value: number);
1111
+ /** Bit-mask identifying which sensor group(s) this shape belongs to. */
1112
+ get sensorGroup(): number;
1113
+ set sensorGroup(value: number);
1114
+ /** Bit-mask of sensor groups this shape will sense. */
1115
+ get sensorMask(): number;
1116
+ set sensorMask(value: number);
1117
+ /** Bit-mask identifying which fluid group(s) this shape belongs to. */
1118
+ get fluidGroup(): number;
1119
+ set fluidGroup(value: number);
1120
+ /** Bit-mask of fluid groups this shape will interact with as a fluid. */
1121
+ get fluidMask(): number;
1122
+ set fluidMask(value: number);
1123
+ /** Arbitrary user data attached to this filter. */
1124
+ get userData(): Record<string, unknown>;
1125
+ /** Read-only list of shapes currently using this filter. */
1126
+ get shapes(): any;
1127
+ /**
1128
+ * Test whether two filters allow collision interaction.
1129
+ * @param filter - The other filter to test against.
1130
+ * @returns `true` if the two filters' group/mask bits permit collision.
1131
+ */
1132
+ shouldCollide(filter: InteractionFilter): boolean;
1133
+ /**
1134
+ * Test whether two filters allow sensor interaction.
1135
+ * @param filter - The other filter to test against.
1136
+ * @returns `true` if the two filters' group/mask bits permit sensing.
1137
+ */
1138
+ shouldSense(filter: InteractionFilter): boolean;
1139
+ /**
1140
+ * Test whether two filters allow fluid interaction.
1141
+ * @param filter - The other filter to test against.
1142
+ * @returns `true` if the two filters' group/mask bits permit fluid interaction.
1143
+ */
1144
+ shouldFlow(filter: InteractionFilter): boolean;
1145
+ /** Create a copy of this filter with the same group/mask values. */
1146
+ copy(): InteractionFilter;
1147
+ /** Return a hex-formatted string representation of all group/mask pairs. */
1148
+ toString(): string;
1149
+ }
1150
+
1151
+ /**
1152
+ * Result from a raycast query.
1153
+ *
1154
+ * Provides the contact normal, distance, inside-flag, and shape hit.
1155
+ * Instances are pooled — call `dispose()` when done to return to pool.
1156
+ */
1157
+ declare class RayResult {
1158
+ static __name__: string[];
1159
+ constructor();
1160
+ get normal(): Vec2;
1161
+ get distance(): number;
1162
+ get inner(): boolean;
1163
+ get shape(): Shape;
1164
+ dispose(): void;
1165
+ toString(): string;
1166
+ }
1167
+
1168
+ /**
1169
+ * Broadphase algorithm type for Space collision detection.
1170
+ *
1171
+ * - `DYNAMIC_AABB_TREE` — dynamic AABB tree broadphase
1172
+ * - `SWEEP_AND_PRUNE` — sweep-and-prune broadphase
1173
+ *
1174
+ * Converted from nape-compiled.js lines 30858–30909.
1175
+ */
1176
+ declare class Broadphase {
1177
+ static __name__: string[];
1178
+ constructor();
1179
+ static get DYNAMIC_AABB_TREE(): Broadphase;
1180
+ static get SWEEP_AND_PRUNE(): Broadphase;
1181
+ toString(): string;
1182
+ }
1183
+
1184
+ /**
1185
+ * Enumeration of interaction categories used to filter {@link InteractionListener}
1186
+ * and {@link PreListener} callbacks.
1187
+ *
1188
+ * - `COLLISION` — physical collisions between solid shapes
1189
+ * - `SENSOR` — sensor (trigger) interactions where shapes overlap but don't resolve
1190
+ * - `FLUID` — fluid buoyancy/drag interactions
1191
+ * - `ANY` — all of the above
1192
+ *
1193
+ * Converted from nape-compiled.js lines 1785–1883.
1194
+ */
1195
+ declare class InteractionType {
1196
+ static __name__: string[];
1197
+ constructor();
1198
+ /** Physical collision between solid shapes (default for most shapes). */
1199
+ static get COLLISION(): InteractionType;
1200
+ /** Sensor/trigger overlap — shapes overlap but collision is not resolved. */
1201
+ static get SENSOR(): InteractionType;
1202
+ /** Fluid buoyancy/drag interaction between a fluid shape and a body. */
1203
+ static get FLUID(): InteractionType;
1204
+ /** Matches all interaction types (COLLISION, SENSOR, and FLUID). */
1205
+ static get ANY(): InteractionType;
1206
+ toString(): string;
1207
+ }
1208
+
1209
+ /**
1210
+ * Structural interface for all dynamically-generated Nape list classes
1211
+ * (BodyList, ShapeList, CompoundList, etc.).
1212
+ *
1213
+ * These classes are created at runtime by {@link createListClasses} and placed
1214
+ * in the `nape` namespace, so they cannot be imported directly. Use this
1215
+ * interface as the return type for Space / Body query methods.
1216
+ */
1217
+ interface TypedListLike<T> extends Iterable<T> {
1218
+ /** Number of elements in the list. */
1219
+ readonly length: number;
1220
+ /** Returns element at the given index. */
1221
+ at(index: number): T;
1222
+ /** Returns true if the list contains `obj`. */
1223
+ has(obj: T): boolean;
1224
+ /** Adds `obj` to the end of the list. Returns true if successful. */
1225
+ push(obj: T): boolean;
1226
+ /** Adds `obj` to the front of the list. Returns true if successful. */
1227
+ unshift(obj: T): boolean;
1228
+ /** Removes and returns the last element. */
1229
+ pop(): T;
1230
+ /** Removes and returns the first element. */
1231
+ shift(): T;
1232
+ /** Adds `obj` (anywhere). Returns true if successful. */
1233
+ add(obj: T): boolean;
1234
+ /** Removes `obj`. Returns true if it was present. */
1235
+ remove(obj: T): boolean;
1236
+ /** Removes all elements. */
1237
+ clear(): void;
1238
+ /** Returns true if the list has no elements. */
1239
+ empty(): boolean;
1240
+ /** Returns an iterator over the elements. */
1241
+ iterator(): Iterable<T>;
1242
+ /** Returns a shallow or deep copy of the list. */
1243
+ copy(deep?: boolean): TypedListLike<T>;
1244
+ /** Merge elements of `xs` into this list. */
1245
+ merge(xs: TypedListLike<T>): void;
1246
+ /** Apply `lambda` to every element. */
1247
+ foreach(lambda: (obj: T) => void): void;
1248
+ /** Returns a filtered copy. */
1249
+ filter(lambda: (obj: T) => boolean): TypedListLike<T>;
1250
+ /** Converts to a plain array. */
1251
+ toArray(): T[];
1252
+ }
1253
+
1254
+ /**
1255
+ * Arbiter type classification.
1256
+ *
1257
+ * - `COLLISION` — collision arbiter
1258
+ * - `SENSOR` — sensor arbiter
1259
+ * - `FLUID` — fluid arbiter
1260
+ *
1261
+ * Converted from nape-compiled.js lines 11653–11725.
1262
+ */
1263
+ declare class ArbiterType {
1264
+ static __name__: string[];
1265
+ constructor();
1266
+ static get COLLISION(): ArbiterType;
1267
+ static get SENSOR(): ArbiterType;
1268
+ static get FLUID(): ArbiterType;
1269
+ toString(): string;
1270
+ }
1271
+
1272
+ /**
1273
+ * Physical material properties applied to shapes.
1274
+ *
1275
+ * Controls elasticity (bounciness), friction coefficients, density, and
1276
+ * rolling friction. Internally wraps a ZPP_Material and is registered as
1277
+ * the public `nape.phys.Material` class in the compiled namespace.
1278
+ *
1279
+ * Converted from nape-compiled.js lines 38254–38573.
1280
+ */
1281
+ declare class Material {
1282
+ static __name__: string[];
1283
+ constructor(elasticity?: number, dynamicFriction?: number, staticFriction?: number, density?: number, rollingFriction?: number);
1284
+ get elasticity(): number;
1285
+ set elasticity(value: number);
1286
+ get dynamicFriction(): number;
1287
+ set dynamicFriction(value: number);
1288
+ get staticFriction(): number;
1289
+ set staticFriction(value: number);
1290
+ get density(): number;
1291
+ set density(value: number);
1292
+ get rollingFriction(): number;
1293
+ set rollingFriction(value: number);
1294
+ get userData(): Record<string, unknown>;
1295
+ copy(): Material;
1296
+ toString(): string;
1297
+ static wood(): Material;
1298
+ static steel(): Material;
1299
+ static ice(): Material;
1300
+ static rubber(): Material;
1301
+ static glass(): Material;
1302
+ static sand(): Material;
1303
+ }
1304
+
1305
+ /**
1306
+ * A convex polygon physics shape.
1307
+ */
1308
+ declare class Polygon extends Shape {
1309
+ static __name__: string[];
1310
+ static __super__: any;
1311
+ /**
1312
+ * Create a Polygon from a list of Vec2 vertices. Vertices must form a convex polygon
1313
+ * in counter-clockwise order.
1314
+ * @param localVerts - Vertices as `Array<Vec2>`, `Vec2List`, or `GeomPoly`.
1315
+ * @param material - Material to assign (uses default if omitted).
1316
+ * @param filter - InteractionFilter to assign (uses default if omitted).
1317
+ */
1318
+ constructor(localVerts?: Vec2[] | any, material?: Material, filter?: InteractionFilter);
1319
+ /**
1320
+ * Create an axis-aligned rectangle at the given position.
1321
+ * @param x - Left edge x coordinate.
1322
+ * @param y - Top edge y coordinate.
1323
+ * @param width - Rectangle width.
1324
+ * @param height - Rectangle height.
1325
+ * @param weak - If true, returned Vec2s are marked weak and will be auto-disposed.
1326
+ * @returns Array of four Vec2 corner vertices.
1327
+ */
1328
+ static rect(x: number, y: number, width: number, height: number, weak?: boolean): Vec2[];
1329
+ /**
1330
+ * Create an axis-aligned rectangular polygon centred at the origin.
1331
+ * @param width - Rectangle width.
1332
+ * @param height - Rectangle height (defaults to `width` for a square).
1333
+ * @param weak - If true, returned Vec2s are marked weak and will be auto-disposed.
1334
+ * @returns Array of four Vec2 corner vertices.
1335
+ */
1336
+ static box(width: number, height?: number, weak?: boolean): Vec2[];
1337
+ /**
1338
+ * Create a regular polygon (or ellipse approximation) centred at the origin.
1339
+ * @param xRadius - Horizontal radius of the circumscribed ellipse.
1340
+ * @param yRadius - Vertical radius of the circumscribed ellipse.
1341
+ * @param edgeCount - Number of sides (must be >= 3).
1342
+ * @param angleOffset - Rotation offset in radians applied to all vertices (default 0).
1343
+ * @param weak - If true, returned Vec2s are marked weak and will be auto-disposed.
1344
+ * @returns Array of `edgeCount` Vec2 vertices.
1345
+ */
1346
+ static regular(xRadius: number, yRadius: number, edgeCount: number, angleOffset?: number, weak?: boolean): Vec2[];
1347
+ /** The list of local-space vertices defining this polygon's shape. */
1348
+ get localVerts(): any;
1349
+ /** World-space vertices of this polygon, updated each simulation step. */
1350
+ get worldVerts(): any;
1351
+ /** The list of edges derived from this polygon's vertices. */
1352
+ get edges(): any;
1353
+ /**
1354
+ * Validate the polygon geometry and return a string describing any issues, or
1355
+ * `"valid"` if the polygon is well-formed.
1356
+ * @returns A validation result string from the underlying ZPP_Polygon.
1357
+ */
1358
+ validity(): any;
1359
+ }
1360
+
1361
+ /**
1362
+ * An edge of a polygon shape.
1363
+ *
1364
+ * Edges are read-only and managed by the polygon they belong to.
1365
+ * Cannot be instantiated directly — only obtained from Polygon.edges.
1366
+ *
1367
+ * Fully modernized — all getters access ZPP_Edge directly.
1368
+ */
1369
+ declare class Edge {
1370
+ static __name__: string[];
1371
+ constructor();
1372
+ /** Parent polygon. */
1373
+ get polygon(): Polygon;
1374
+ /** Local-space normal vector (immutable Vec2). */
1375
+ get localNormal(): Vec2;
1376
+ /** World-space normal vector (immutable Vec2). Requires polygon in a body. */
1377
+ get worldNormal(): Vec2;
1378
+ /** Edge length. */
1379
+ get length(): number;
1380
+ /** Local-space projection along the edge normal. */
1381
+ get localProjection(): number;
1382
+ /** World-space projection. Requires polygon in a body. */
1383
+ get worldProjection(): number;
1384
+ /** First local vertex of this edge. */
1385
+ get localVertex1(): Vec2;
1386
+ /** Second local vertex of this edge. */
1387
+ get localVertex2(): Vec2;
1388
+ /** First world vertex. Requires polygon in a body. */
1389
+ get worldVertex1(): Vec2;
1390
+ /** Second world vertex. Requires polygon in a body. */
1391
+ get worldVertex2(): Vec2;
1392
+ toString(): string;
1393
+ /**
1394
+ * Wrap a ZPP_Vec2 vertex into its public Vec2 outer.
1395
+ * Mirrors the compiled vertex wrapping pattern.
1396
+ */
1397
+ private _wrapVert;
1398
+ }
1399
+
1400
+ /**
1401
+ * An arbiter representing a physical collision between two solid shapes.
1402
+ *
1403
+ * Provides access to contact points, collision normal, friction coefficients,
1404
+ * elasticity, and impulse data. Properties marked _mutable in pre-handler_ can
1405
+ * only be set within a {@link PreListener} handler.
1406
+ *
1407
+ * Obtain via {@link Arbiter.collisionArbiter} or by casting from a callback's
1408
+ * arbiter list.
1409
+ *
1410
+ * Fully modernized — uses extracted ZPP_ColArbiter directly.
1411
+ */
1412
+ declare class CollisionArbiter extends Arbiter {
1413
+ static __name__: string[];
1414
+ static __super__: typeof Arbiter;
1415
+ constructor();
1416
+ /**
1417
+ * The list of active contact points between the two shapes.
1418
+ * Contains 1 or 2 {@link Contact} objects depending on the collision geometry.
1419
+ */
1420
+ get contacts(): object;
1421
+ /**
1422
+ * Collision normal vector pointing from `shape1` toward `shape2`.
1423
+ * Read-only; available after the arbiter is active.
1424
+ */
1425
+ get normal(): Vec2;
1426
+ /** Sum of the radii of the two shapes at the collision point. */
1427
+ get radius(): number;
1428
+ /** Reference edge of shape1 (if polygon), or null. */
1429
+ get referenceEdge1(): Edge | null;
1430
+ /** Reference edge of shape2 (if polygon), or null. */
1431
+ get referenceEdge2(): Edge | null;
1432
+ /**
1433
+ * Coefficient of restitution (bounciness).
1434
+ *
1435
+ * Combined from the two shapes' `elasticity` values. Can be overridden
1436
+ * inside a pre-handler. Must be `>= 0`.
1437
+ *
1438
+ * _Mutable in pre-handler only._
1439
+ */
1440
+ get elasticity(): number;
1441
+ set elasticity(value: number);
1442
+ /**
1443
+ * Dynamic (kinetic) friction coefficient — applied when the contact is sliding.
1444
+ * Combined from the two shapes' material values. _Mutable in pre-handler only._
1445
+ */
1446
+ get dynamicFriction(): number;
1447
+ set dynamicFriction(value: number);
1448
+ /**
1449
+ * Static friction coefficient — applied when the contact is at rest.
1450
+ * Combined from the two shapes' material values. _Mutable in pre-handler only._
1451
+ */
1452
+ get staticFriction(): number;
1453
+ set staticFriction(value: number);
1454
+ /**
1455
+ * Rolling friction coefficient — resists rolling motion.
1456
+ * Combined from the two shapes' material values. _Mutable in pre-handler only._
1457
+ */
1458
+ get rollingFriction(): number;
1459
+ set rollingFriction(value: number);
1460
+ /** Whether the first contact point lies on a polygon vertex (poly-circle only). */
1461
+ firstVertex(): boolean;
1462
+ /** Whether the second contact point lies on a polygon vertex (poly-circle only). */
1463
+ secondVertex(): boolean;
1464
+ /**
1465
+ * Impulse applied in the normal (collision) direction, summed over all contacts.
1466
+ * @param body - One of the two bodies, or `null` for the combined value.
1467
+ * @param freshOnly - Only include new contact points. Default `false`.
1468
+ */
1469
+ normalImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
1470
+ /**
1471
+ * Friction impulse applied in the tangent direction, summed over all contacts.
1472
+ * @param body - One of the two bodies, or `null` for the combined value.
1473
+ * @param freshOnly - Only include new contact points. Default `false`.
1474
+ */
1475
+ tangentImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
1476
+ /** Total impulse (normal + tangent + rolling) accumulated across all contacts. */
1477
+ totalImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
1478
+ /**
1479
+ * Rolling impulse applied by this collision.
1480
+ * @param body - One of the two bodies, or `null` for the combined value.
1481
+ * @param freshOnly - Only include new contact points. Default `false`.
1482
+ */
1483
+ rollingImpulse(body?: Body | null, freshOnly?: boolean): number;
1484
+ }
1485
+
1486
+ /**
1487
+ * An arbiter representing a fluid interaction between a fluid shape and a body.
1488
+ *
1489
+ * Provides access to buoyancy and drag impulses, the overlap area, and the
1490
+ * centre of overlap. Properties marked _mutable in pre-handler_ can only be
1491
+ * set within a {@link PreListener} handler.
1492
+ *
1493
+ * Obtain via {@link Arbiter.fluidArbiter} or by casting from a callback arbiter.
1494
+ *
1495
+ * Fully modernized — uses extracted ZPP_FluidArbiter directly.
1496
+ */
1497
+ declare class FluidArbiter extends Arbiter {
1498
+ static __name__: string[];
1499
+ static __super__: typeof Arbiter;
1500
+ constructor();
1501
+ /**
1502
+ * Centre of the overlap region between the fluid and the body shape.
1503
+ * _Mutable in pre-handler only._
1504
+ */
1505
+ get position(): Vec2;
1506
+ set position(value: Vec2);
1507
+ /**
1508
+ * Area of the overlap region in pixels². Used to compute buoyancy force.
1509
+ * Must be strictly positive and finite.
1510
+ * _Mutable in pre-handler only._
1511
+ */
1512
+ get overlap(): number;
1513
+ set overlap(value: number);
1514
+ /**
1515
+ * Buoyancy impulse applied in the last step as `(fx, fy, torque)`.
1516
+ * @param body - One of the two bodies, or `null` for the combined value.
1517
+ */
1518
+ buoyancyImpulse(body?: Body | null): Vec3;
1519
+ /**
1520
+ * Linear and angular drag impulse applied in the last step as `(fx, fy, torque)`.
1521
+ * @param body - One of the two bodies, or `null` for the combined value.
1522
+ */
1523
+ dragImpulse(body?: Body | null): Vec3;
1524
+ /** Total impulse (buoyancy + drag). */
1525
+ totalImpulse(body?: Body | null, _freshOnly?: boolean): Vec3;
1526
+ }
1527
+
1528
+ /**
1529
+ * Return value for {@link PreListener} handlers — controls whether the interaction
1530
+ * is resolved this step and in future steps.
1531
+ *
1532
+ * - `ACCEPT` — resolve the interaction (default if handler returns `null`)
1533
+ * - `IGNORE` — suppress the interaction permanently until the next `BEGIN`
1534
+ * - `ACCEPT_ONCE` — accept this step only, then revert to the previous flag
1535
+ * - `IGNORE_ONCE` — ignore this step only, then revert to the previous flag
1536
+ *
1537
+ * Use `IGNORE`/`ACCEPT` for stateful decisions (e.g., one-way platforms).
1538
+ * Use `*_ONCE` variants for single-step overrides.
1539
+ *
1540
+ * Converted from nape-compiled.js lines 2504–2591.
1541
+ */
1542
+ declare class PreFlag {
1543
+ static __name__: string[];
1544
+ constructor();
1545
+ /** Accept and resolve the interaction normally. */
1546
+ static get ACCEPT(): PreFlag;
1547
+ /** Suppress the interaction permanently until the next `BEGIN` event. */
1548
+ static get IGNORE(): PreFlag;
1549
+ /** Accept this step only; revert to the previous flag next step. */
1550
+ static get ACCEPT_ONCE(): PreFlag;
1551
+ /** Ignore this step only; revert to the previous flag next step. */
1552
+ static get IGNORE_ONCE(): PreFlag;
1553
+ toString(): string;
1554
+ }
1555
+
1556
+ /**
1557
+ * Represents an active interaction between two shapes.
1558
+ *
1559
+ * Arbiters are created and pooled internally by the engine — they cannot be
1560
+ * instantiated directly. Access them via:
1561
+ * - `space.arbiters` — all active arbiters in the simulation
1562
+ * - `body.arbiters` — arbiters involving a specific body
1563
+ * - `InteractionCallback.arbiters` — arbiters in an interaction callback
1564
+ * - `PreCallback.arbiter` — the arbiter in a pre-handler
1565
+ *
1566
+ * Use {@link Arbiter.collisionArbiter} or {@link Arbiter.fluidArbiter} to cast
1567
+ * to a subtype for type-specific properties.
1568
+ *
1569
+ * **Warning:** do not hold references to `Arbiter` objects after the current
1570
+ * simulation step — they are pooled and may be reused.
1571
+ *
1572
+ * Fully modernized — uses extracted ZPP_Arbiter directly.
1573
+ */
1574
+ declare class Arbiter {
1575
+ static __name__: string[];
1576
+ constructor();
1577
+ /**
1578
+ * Whether both interacting bodies are currently sleeping.
1579
+ * Throws if the arbiter is not active.
1580
+ */
1581
+ get isSleeping(): boolean;
1582
+ /**
1583
+ * The interaction type of this arbiter.
1584
+ * @see {@link ArbiterType}
1585
+ */
1586
+ get type(): ArbiterType;
1587
+ /** Cast to CollisionArbiter if this is a collision, else null. */
1588
+ get collisionArbiter(): CollisionArbiter | null;
1589
+ /** Cast to FluidArbiter if this is a fluid interaction, else null. */
1590
+ get fluidArbiter(): FluidArbiter | null;
1591
+ /** First shape (lower id). */
1592
+ get shape1(): Shape;
1593
+ /** Second shape (higher id). */
1594
+ get shape2(): Shape;
1595
+ /** Body of shape1. */
1596
+ get body1(): Body;
1597
+ /** Body of shape2. */
1598
+ get body2(): Body;
1599
+ /** The pre-handler state of this arbiter. */
1600
+ get state(): PreFlag;
1601
+ /** Whether this is a collision arbiter. */
1602
+ isCollisionArbiter(): boolean;
1603
+ /** Whether this is a fluid arbiter. */
1604
+ isFluidArbiter(): boolean;
1605
+ /** Whether this is a sensor arbiter. */
1606
+ isSensorArbiter(): boolean;
1607
+ /**
1608
+ * Total impulse applied by this arbiter in the last step as `(fx, fy, torque)`.
1609
+ *
1610
+ * Pass a `body` to get the impulse applied specifically to that body.
1611
+ * Pass `freshOnly = true` to include only new contact points (not persistent ones).
1612
+ *
1613
+ * Overridden by {@link CollisionArbiter} and {@link FluidArbiter}.
1614
+ *
1615
+ * @param body - One of the two interacting bodies, or `null` for the combined impulse.
1616
+ * @param _freshOnly - When `true`, only count fresh (new) contacts. Default `false`.
1617
+ */
1618
+ totalImpulse(body?: Body | null, _freshOnly?: boolean): Vec3;
1619
+ toString(): string;
1620
+ }
1621
+
1622
+ /**
1623
+ * Enumeration of physics callback event types.
1624
+ *
1625
+ * Use these singletons to specify which phase of an interaction a listener
1626
+ * should respond to:
1627
+ *
1628
+ * - `BEGIN` — fired once when two interactors first make contact
1629
+ * - `ONGOING` — fired every simulation step while the interaction persists
1630
+ * - `END` — fired once when two interactors separate
1631
+ * - `WAKE` — fired when a body or constraint wakes from sleep
1632
+ * - `SLEEP` — fired when a body or constraint falls asleep
1633
+ * - `BREAK` — fired when a constraint exceeds its `maxForce`/`maxError` and breaks
1634
+ * - `PRE` — fired before collision resolution; allows per-step accept/ignore decisions
1635
+ *
1636
+ * Valid events per listener type:
1637
+ * - {@link BodyListener}: `WAKE`, `SLEEP`
1638
+ * - {@link ConstraintListener}: `WAKE`, `SLEEP`, `BREAK`
1639
+ * - {@link InteractionListener}: `BEGIN`, `ONGOING`, `END`
1640
+ * - {@link PreListener}: always `PRE` (set internally)
1641
+ *
1642
+ * Converted from nape-compiled.js lines 516–657.
1643
+ */
1644
+ declare class CbEvent {
1645
+ static __name__: string[];
1646
+ constructor();
1647
+ /** Interaction-start event. Fired once when two interactors first make contact. */
1648
+ static get BEGIN(): CbEvent;
1649
+ /** Interaction-continue event. Fired every step while the interaction persists. */
1650
+ static get ONGOING(): CbEvent;
1651
+ /** Interaction-end event. Fired once when two interactors separate. */
1652
+ static get END(): CbEvent;
1653
+ /** Wake event. Fired when a body or constraint wakes from sleep. */
1654
+ static get WAKE(): CbEvent;
1655
+ /** Sleep event. Fired when a body or constraint falls asleep. */
1656
+ static get SLEEP(): CbEvent;
1657
+ /** Break event. Fired when a constraint exceeds its `maxForce` or `maxError` limit. */
1658
+ static get BREAK(): CbEvent;
1659
+ /** Pre-interaction event. Fired before collision resolution; handler can accept or ignore. */
1660
+ static get PRE(): CbEvent;
1661
+ toString(): string;
1662
+ }
1663
+
1664
+ /**
1665
+ * Listener type classification.
1666
+ *
1667
+ * - `BODY` — body event listener
1668
+ * - `CONSTRAINT` — constraint event listener
1669
+ * - `INTERACTION` — interaction event listener
1670
+ * - `PRE` — pre-interaction listener
1671
+ *
1672
+ * Converted from nape-compiled.js lines 2554–2646.
1673
+ */
1674
+ declare class ListenerType {
1675
+ static __name__: string[];
1676
+ constructor();
1677
+ static get BODY(): ListenerType;
1678
+ static get CONSTRAINT(): ListenerType;
1679
+ static get INTERACTION(): ListenerType;
1680
+ static get PRE(): ListenerType;
1681
+ toString(): string;
1682
+ }
1683
+
1684
+ /**
1685
+ * Listener — Base class for all physics event listeners.
1686
+ *
1687
+ * Provides common properties (type, event, precedence, space) and
1688
+ * toString() for all listener subclasses.
1689
+ *
1690
+ * Fully modernized from nape-compiled.js lines 231–433.
1691
+ */
1692
+
1693
+ /**
1694
+ * Base class for all physics event listeners.
1695
+ *
1696
+ * Cannot be instantiated directly — use one of the concrete subclasses:
1697
+ * {@link BodyListener}, {@link ConstraintListener}, {@link InteractionListener},
1698
+ * or {@link PreListener}.
1699
+ *
1700
+ * Provides common properties (`type`, `event`, `precedence`, `space`) shared
1701
+ * by all listener types.
1702
+ *
1703
+ * Fully modernized from nape-compiled.js lines 231–433.
1704
+ */
1705
+ declare class Listener {
1706
+ static __name__: string[];
1707
+ constructor();
1708
+ /** The type of this listener (BODY, CONSTRAINT, INTERACTION, or PRE). */
1709
+ get type(): ListenerType;
1710
+ /**
1711
+ * The event this listener responds to.
1712
+ *
1713
+ * Valid values depend on the concrete listener type — see {@link CbEvent}.
1714
+ * Changing this while the listener is assigned to a space re-registers it.
1715
+ */
1716
+ get event(): CbEvent;
1717
+ set event(event: CbEvent);
1718
+ /**
1719
+ * Execution priority of this listener relative to other listeners for the
1720
+ * same event. Higher values execute first.
1721
+ *
1722
+ * @defaultValue `0`
1723
+ */
1724
+ get precedence(): number;
1725
+ set precedence(precedence: number);
1726
+ /**
1727
+ * The space this listener is currently registered in, or `null` if not registered.
1728
+ *
1729
+ * Assign to register/unregister the listener in a space:
1730
+ * ```ts
1731
+ * listener.space = mySpace; // register
1732
+ * listener.space = null; // unregister
1733
+ * ```
1734
+ */
1735
+ get space(): Space | null;
1736
+ set space(space: Space | null);
1737
+ toString(): string;
1738
+ }
1739
+
1740
+ /**
1741
+ * Concrete type aliases for all dynamically-generated Nape list classes.
1742
+ *
1743
+ * These aliases use {@link TypedListLike} to give IDE-visible types to the
1744
+ * return values of Space and Body query methods, without requiring the
1745
+ * dynamic list classes to be statically importable.
1746
+ */
1747
+
1748
+ type BodyList = TypedListLike<Body>;
1749
+ type CompoundList = TypedListLike<Compound>;
1750
+ type ShapeList = TypedListLike<Shape>;
1751
+ type ConstraintList = TypedListLike<Constraint>;
1752
+ type ArbiterList = TypedListLike<Arbiter>;
1753
+ type ListenerList = TypedListLike<Listener>;
1754
+ type RayResultList = TypedListLike<RayResult>;
1755
+ type ConvexResultList = TypedListLike<ConvexResult>;
1756
+
1757
+ /**
1758
+ * A minimal 2D point used by {@link DebugDraw} draw callbacks.
1759
+ * Renderer implementations receive read-only snapshots — do NOT store these
1760
+ * references; they may be reused by the engine after the call returns.
1761
+ */
1762
+ interface DebugVec2 {
1763
+ readonly x: number;
1764
+ readonly y: number;
1765
+ }
1766
+ /**
1767
+ * Abstract interface for debug rendering of a physics space.
1768
+ *
1769
+ * Implement this class and pass an instance to `Space.debugDraw()` to visualise
1770
+ * the physics world — shapes, joints, contacts, AABBs, velocities, and
1771
+ * centre-of-mass markers — using any 2D rendering backend (Canvas 2D, PixiJS,
1772
+ * p5.js, Three.js, etc.).
1773
+ *
1774
+ * None of the methods are abstract by language enforcement — they all default
1775
+ * to no-ops so you can override only the primitives your renderer needs.
1776
+ *
1777
+ * @example
1778
+ * ```ts
1779
+ * class CanvasDebugDraw extends DebugDraw {
1780
+ * constructor(private ctx: CanvasRenderingContext2D) { super(); }
1781
+ *
1782
+ * drawSegment(p1: DebugVec2, p2: DebugVec2): void {
1783
+ * this.ctx.beginPath();
1784
+ * this.ctx.moveTo(p1.x, p1.y);
1785
+ * this.ctx.lineTo(p2.x, p2.y);
1786
+ * this.ctx.stroke();
1787
+ * }
1788
+ * // ... other methods ...
1789
+ * }
1790
+ *
1791
+ * space.debugDraw(new CanvasDebugDraw(ctx), DebugDrawFlags.ALL);
1792
+ * ```
1793
+ */
1794
+ declare abstract class DebugDraw {
1795
+ /**
1796
+ * Draw a line segment between two world-space points.
1797
+ * Used for: polygon edges, velocity vectors, joint lines, AABB edges.
1798
+ * @param p1 - Start point (world space).
1799
+ * @param p2 - End point (world space).
1800
+ * @param colour - Optional ARGB colour hint (0xAARRGGBB). Renderers may ignore this.
1801
+ */
1802
+ drawSegment(p1: DebugVec2, p2: DebugVec2, colour?: number): void;
1803
+ /**
1804
+ * Draw a circle outline.
1805
+ * Used for: static/kinematic circle shapes.
1806
+ * @param centre - World-space centre.
1807
+ * @param radius - Circle radius.
1808
+ * @param colour - Optional ARGB colour hint.
1809
+ */
1810
+ drawCircle(centre: DebugVec2, radius: number, colour?: number): void;
1811
+ /**
1812
+ * Draw a filled circle with an orientation indicator segment.
1813
+ * Used for: dynamic circle shapes. The `axis` segment shows body rotation.
1814
+ * @param centre - World-space centre.
1815
+ * @param radius - Circle radius.
1816
+ * @param axis - World-space end-point of the orientation indicator (from centre).
1817
+ * @param colour - Optional ARGB colour hint.
1818
+ */
1819
+ drawSolidCircle(centre: DebugVec2, radius: number, axis: DebugVec2, colour?: number): void;
1820
+ /**
1821
+ * Draw a polygon outline.
1822
+ * Used for: static/kinematic polygon shapes.
1823
+ * @param vertices - World-space vertices in order. Do NOT store this array.
1824
+ * @param colour - Optional ARGB colour hint.
1825
+ */
1826
+ drawPolygon(vertices: DebugVec2[], colour?: number): void;
1827
+ /**
1828
+ * Draw a filled polygon.
1829
+ * Used for: dynamic polygon shapes.
1830
+ * @param vertices - World-space vertices in order. Do NOT store this array.
1831
+ * @param colour - Optional ARGB colour hint.
1832
+ */
1833
+ drawSolidPolygon(vertices: DebugVec2[], colour?: number): void;
1834
+ /**
1835
+ * Draw a point marker.
1836
+ * Used for: contact points, centre-of-mass markers.
1837
+ * @param position - World-space position.
1838
+ * @param colour - Optional ARGB colour hint.
1839
+ */
1840
+ drawPoint(position: DebugVec2, colour?: number): void;
1841
+ }
1842
+
1843
+ /**
1844
+ * The physics world. Add bodies, shapes, and constraints, then call `step()` each frame to advance the simulation.
1845
+ */
1846
+ declare class Space {
1847
+ /**
1848
+ * @param gravity - Initial gravity vector (default (0, 0)).
1849
+ * @param broadphase - Broadphase algorithm to use.
1850
+ */
1851
+ constructor(gravity?: Vec2, broadphase?: Broadphase);
1852
+ /** Arbitrary user data attached to this Space. */
1853
+ get userData(): Record<string, unknown>;
1854
+ /**
1855
+ * World gravity applied to all dynamic bodies each step. Live Vec2.
1856
+ * @throws If set to null or a disposed Vec2.
1857
+ */
1858
+ get gravity(): Vec2;
1859
+ set gravity(value: Vec2);
1860
+ /** The broadphase algorithm currently in use (SWEEP_AND_PRUNE or DYNAMIC_AABB_TREE). */
1861
+ get broadphase(): Broadphase;
1862
+ /** If true, contact points are sorted for determinism. Default: true. */
1863
+ get sortContacts(): boolean;
1864
+ set sortContacts(value: boolean);
1865
+ /**
1866
+ * Global angular drag coefficient applied to all bodies.
1867
+ * @throws If set to NaN.
1868
+ */
1869
+ get worldAngularDrag(): number;
1870
+ set worldAngularDrag(value: number);
1871
+ /**
1872
+ * Global linear drag coefficient applied to all bodies.
1873
+ * @throws If set to NaN.
1874
+ */
1875
+ get worldLinearDrag(): number;
1876
+ set worldLinearDrag(value: number);
1877
+ /** Read-only list of all Compound objects in this space. */
1878
+ get compounds(): CompoundList;
1879
+ /** Read-only list of all Body objects directly in this space. */
1880
+ get bodies(): BodyList;
1881
+ /** Read-only list of bodies that are awake and actively simulated. */
1882
+ get liveBodies(): BodyList;
1883
+ /** Read-only list of all Constraint objects in this space. */
1884
+ get constraints(): ConstraintList;
1885
+ /** Read-only list of active (awake) constraints. */
1886
+ get liveConstraints(): ConstraintList;
1887
+ /** The static world body that acts as an immovable anchor for constraints. */
1888
+ get world(): Body;
1889
+ /** Read-only list of all active collision/fluid arbiters. */
1890
+ get arbiters(): ArbiterList;
1891
+ /** Read-only list of all event listeners registered to this space. */
1892
+ get listeners(): ListenerList;
1893
+ /** Number of `step()` calls made so far. */
1894
+ get timeStamp(): number;
1895
+ /** Cumulative time simulated (sum of all `deltaTime` values passed to `step()`). */
1896
+ get elapsedTime(): number;
1897
+ /**
1898
+ * Advance the simulation by `deltaTime` seconds.
1899
+ * `velocityIterations` and `positionIterations` control solver accuracy (default 10 each).
1900
+ * @param deltaTime - Time step in seconds; must be strictly positive and not NaN.
1901
+ * @param velocityIterations - Number of velocity solver iterations (minimum 1).
1902
+ * @param positionIterations - Number of position solver iterations (minimum 1).
1903
+ * @throws If `deltaTime` is NaN, non-positive, or any iteration count is less than 1.
1904
+ */
1905
+ step(deltaTime: number, velocityIterations?: number, positionIterations?: number): void;
1906
+ /**
1907
+ * Remove all bodies, constraints, and compounds from this space.
1908
+ * @throws If called during a `step()`.
1909
+ */
1910
+ clear(): void;
1911
+ /**
1912
+ * Call `lambda` for every body in the space, including those inside compounds.
1913
+ * @param lambda - Callback invoked with each Body.
1914
+ * @throws If `lambda` is null.
1915
+ */
1916
+ visitBodies(lambda: (body: Body) => void): void;
1917
+ /**
1918
+ * Call `lambda` for every constraint in the space, including those inside compounds.
1919
+ * @param lambda - Callback invoked with each Constraint.
1920
+ * @throws If `lambda` is null.
1921
+ */
1922
+ visitConstraints(lambda: (constraint: Constraint) => void): void;
1923
+ /**
1924
+ * Call `lambda` for every compound in the space (recursively).
1925
+ * @param lambda - Callback invoked with each Compound.
1926
+ * @throws If `lambda` is null.
1927
+ */
1928
+ visitCompounds(lambda: (compound: Compound) => void): void;
1929
+ /**
1930
+ * Determine the type of interaction between two shapes (COLLISION, FLUID, SENSOR, or null if they don't interact).
1931
+ * @param shape1 - The first shape; must belong to a Body.
1932
+ * @param shape2 - The second shape; must belong to a Body.
1933
+ * @returns The InteractionType, or null if the shapes would not interact.
1934
+ * @throws If either shape is null or not attached to a Body.
1935
+ */
1936
+ interactionType(shape1: Shape, shape2: Shape): InteractionType | null;
1937
+ /**
1938
+ * Return all shapes whose geometry contains the given world-space point.
1939
+ * @param point - The world-space point to test.
1940
+ * @param filter - Optional interaction filter to restrict results.
1941
+ * @param output - Optional existing ShapeList to accumulate results into.
1942
+ * @returns A ShapeList of matching shapes.
1943
+ * @throws If `point` is null or disposed.
1944
+ */
1945
+ shapesUnderPoint(point: Vec2, filter?: InteractionFilter | null, output?: ShapeList | null): ShapeList;
1946
+ /**
1947
+ * Return all bodies that have at least one shape containing the given world-space point.
1948
+ * @param point - The world-space point to test.
1949
+ * @param filter - Optional interaction filter to restrict results.
1950
+ * @param output - Optional existing BodyList to accumulate results into.
1951
+ * @returns A BodyList of matching bodies.
1952
+ * @throws If `point` is null or disposed.
1953
+ */
1954
+ bodiesUnderPoint(point: Vec2, filter?: InteractionFilter | null, output?: BodyList | null): BodyList;
1955
+ /**
1956
+ * Return all shapes that overlap with the given AABB.
1957
+ * @param aabb - The axis-aligned bounding box to test against.
1958
+ * @param containment - If true, only shapes fully contained within the AABB are returned.
1959
+ * @param strict - If true, exact shape geometry is tested; otherwise only AABBs are compared.
1960
+ * @param filter - Optional interaction filter to restrict results.
1961
+ * @param output - Optional existing ShapeList to accumulate results into.
1962
+ * @returns A ShapeList of matching shapes.
1963
+ * @throws If `aabb` is null or degenerate (zero width or height).
1964
+ */
1965
+ shapesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilter | null, output?: ShapeList | null): ShapeList;
1966
+ /**
1967
+ * Return all bodies that have at least one shape overlapping the given AABB.
1968
+ * @param aabb - The axis-aligned bounding box to test against.
1969
+ * @param containment - If true, only shapes fully contained within the AABB count.
1970
+ * @param strict - If true, exact shape geometry is tested; otherwise only AABBs are compared.
1971
+ * @param filter - Optional interaction filter to restrict results.
1972
+ * @param output - Optional existing BodyList to accumulate results into.
1973
+ * @returns A BodyList of matching bodies.
1974
+ * @throws If `aabb` is null or degenerate (zero width or height).
1975
+ */
1976
+ bodiesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilter | null, output?: BodyList | null): BodyList;
1977
+ /**
1978
+ * Return all shapes that overlap with a circle defined by `position` and `radius`.
1979
+ * @param position - World-space centre of the query circle.
1980
+ * @param radius - Radius of the query circle; must be strictly positive and not NaN.
1981
+ * @param containment - If true, only shapes fully contained within the circle are returned.
1982
+ * @param filter - Optional interaction filter to restrict results.
1983
+ * @param output - Optional existing ShapeList to accumulate results into.
1984
+ * @returns A ShapeList of matching shapes.
1985
+ * @throws If `position` is null/disposed, or `radius` is NaN or non-positive.
1986
+ */
1987
+ shapesInCircle(position: Vec2, radius: number, containment?: boolean, filter?: InteractionFilter | null, output?: ShapeList | null): ShapeList;
1988
+ /**
1989
+ * Return all bodies that have at least one shape overlapping a query circle.
1990
+ * @param position - World-space centre of the query circle.
1991
+ * @param radius - Radius of the query circle; must be strictly positive and not NaN.
1992
+ * @param containment - If true, only shapes fully contained within the circle count.
1993
+ * @param filter - Optional interaction filter to restrict results.
1994
+ * @param output - Optional existing BodyList to accumulate results into.
1995
+ * @returns A BodyList of matching bodies.
1996
+ * @throws If `position` is null/disposed, or `radius` is NaN or non-positive.
1997
+ */
1998
+ bodiesInCircle(position: Vec2, radius: number, containment?: boolean, filter?: InteractionFilter | null, output?: BodyList | null): BodyList;
1999
+ /**
2000
+ * Return all shapes in the space that overlap with `shape`.
2001
+ * @param shape - The query shape; must be attached to a Body.
2002
+ * @param containment - If true, only shapes fully contained within `shape` are returned.
2003
+ * @param filter - Optional interaction filter to restrict results.
2004
+ * @param output - Optional existing ShapeList to accumulate results into.
2005
+ * @returns A ShapeList of overlapping shapes.
2006
+ * @throws If `shape` is null, not attached to a Body, or is an invalid polygon.
2007
+ */
2008
+ shapesInShape(shape: Shape, containment?: boolean, filter?: InteractionFilter | null, output?: ShapeList | null): ShapeList;
2009
+ /**
2010
+ * Return all bodies in the space that have at least one shape overlapping `shape`.
2011
+ * @param shape - The query shape; must be attached to a Body.
2012
+ * @param containment - If true, only shapes fully contained within `shape` count.
2013
+ * @param filter - Optional interaction filter to restrict results.
2014
+ * @param output - Optional existing BodyList to accumulate results into.
2015
+ * @returns A BodyList of overlapping bodies.
2016
+ * @throws If `shape` is null, not attached to a Body, or is an invalid polygon.
2017
+ */
2018
+ bodiesInShape(shape: Shape, containment?: boolean, filter?: InteractionFilter | null, output?: BodyList | null): BodyList;
2019
+ /**
2020
+ * Return all shapes in the space that overlap with any shape attached to `body`.
2021
+ * Equivalent to calling `shapesInShape` for each of `body`'s shapes and merging results.
2022
+ * @param body - The body whose shapes are used as the query region.
2023
+ * @param filter - Optional interaction filter to restrict results.
2024
+ * @param output - Optional existing ShapeList to accumulate results into.
2025
+ * @returns A ShapeList of overlapping shapes.
2026
+ * @throws If `body` is null.
2027
+ */
2028
+ shapesInBody(body: Body, filter?: InteractionFilter | null, output?: ShapeList | null): ShapeList;
2029
+ /**
2030
+ * Return all bodies in the space that overlap with any shape attached to `body`.
2031
+ * Equivalent to calling `bodiesInShape` for each of `body`'s shapes and merging results.
2032
+ * @param body - The body whose shapes are used as the query region.
2033
+ * @param filter - Optional interaction filter to restrict results.
2034
+ * @param output - Optional existing BodyList to accumulate results into.
2035
+ * @returns A BodyList of overlapping bodies.
2036
+ * @throws If `body` is null.
2037
+ */
2038
+ bodiesInBody(body: Body, filter?: InteractionFilter | null, output?: BodyList | null): BodyList;
2039
+ /**
2040
+ * Sweep `shape` along its current velocity for `deltaTime` seconds and return the first hit.
2041
+ * @param shape - The shape to sweep; must belong to a Body.
2042
+ * @param deltaTime - Duration of the sweep; must be non-negative.
2043
+ * @param liveSweep - If true, other body velocities are considered during the sweep.
2044
+ * @param filter - Optional interaction filter to restrict results.
2045
+ * @returns The first RayResult hit, or null if nothing was struck.
2046
+ * @throws If `shape` is null, not attached to a Body, or `deltaTime` is negative/NaN.
2047
+ */
2048
+ convexCast(shape: Shape, deltaTime: number, liveSweep?: boolean, filter?: InteractionFilter | null): ConvexResult | null;
2049
+ /**
2050
+ * Sweep `shape` along its current velocity for `deltaTime` seconds and return all hits.
2051
+ * @param shape - The shape to sweep; must belong to a Body.
2052
+ * @param deltaTime - Duration of the sweep; must be non-negative.
2053
+ * @param liveSweep - If true, other body velocities are considered during the sweep.
2054
+ * @param filter - Optional interaction filter to restrict results.
2055
+ * @param output - Optional existing RayResultList to accumulate results into.
2056
+ * @returns A RayResultList of all hits encountered during the sweep.
2057
+ * @throws If `shape` is null, not attached to a Body, or `deltaTime` is negative/NaN.
2058
+ */
2059
+ convexMultiCast(shape: Shape, deltaTime: number, liveSweep?: boolean, filter?: InteractionFilter | null, output?: ConvexResultList | null): ConvexResultList;
2060
+ /**
2061
+ * Cast a ray into the space and return the closest hit.
2062
+ * @param ray - The ray to cast.
2063
+ * @param inner - If true, shapes are tested from the inside as well (useful for concave queries).
2064
+ * @param filter - Optional interaction filter to restrict results.
2065
+ * @returns The closest RayResult, or null if nothing was hit.
2066
+ * @throws If `ray` is null.
2067
+ */
2068
+ rayCast(ray: Ray, inner?: boolean, filter?: InteractionFilter | null): RayResult | null;
2069
+ /**
2070
+ * Cast a ray into the space and return all hits.
2071
+ * @param ray - The ray to cast.
2072
+ * @param inner - If true, shapes are tested from the inside as well.
2073
+ * @param filter - Optional interaction filter to restrict results.
2074
+ * @param output - Optional existing RayResultList to accumulate results into.
2075
+ * @returns A RayResultList of all shapes the ray intersected.
2076
+ * @throws If `ray` is null.
2077
+ */
2078
+ rayMultiCast(ray: Ray, inner?: boolean, filter?: InteractionFilter | null, output?: RayResultList | null): RayResultList;
2079
+ /**
2080
+ * Draw the current state of the physics world using a user-supplied renderer.
2081
+ *
2082
+ * Walks all bodies, shapes, constraints, contacts, AABBs, and velocity
2083
+ * vectors and calls the appropriate draw primitives on `drawer`. Only the
2084
+ * layers selected by `flags` are rendered.
2085
+ *
2086
+ * **Performance note:** this method allocates temporary vertex arrays for
2087
+ * polygon shapes on every call. It is intended for development/debug use
2088
+ * only — do not call it in a performance-critical production loop.
2089
+ *
2090
+ * @param drawer - The renderer to use. Must not be null.
2091
+ * @param flags - Bitmask of {@link DebugDrawFlags} layers to render.
2092
+ * Defaults to `DebugDrawFlags.ALL`.
2093
+ *
2094
+ * @example
2095
+ * ```ts
2096
+ * space.debugDraw(myDrawer, DebugDrawFlags.SHAPES | DebugDrawFlags.JOINTS);
2097
+ * ```
2098
+ */
2099
+ debugDraw(drawer: DebugDraw, flags?: number): void;
2100
+ /**
2101
+ * Returns a brief string summary of this space.
2102
+ * @returns A string in the form `Space(bodies=N)`.
2103
+ */
2104
+ toString(): string;
2105
+ }
2106
+
2107
+ /**
2108
+ * Body type enumeration.
2109
+ *
2110
+ * - `STATIC` — immovable, infinite mass (walls, floors)
2111
+ * - `DYNAMIC` — fully simulated (default)
2112
+ * - `KINEMATIC` — moves only via velocity, not affected by forces
2113
+ *
2114
+ * Converted from nape-compiled.js lines 24640–24705.
2115
+ */
2116
+ declare class BodyType {
2117
+ static __name__: string[];
2118
+ constructor();
2119
+ static get STATIC(): BodyType;
2120
+ static get DYNAMIC(): BodyType;
2121
+ static get KINEMATIC(): BodyType;
2122
+ toString(): string;
2123
+ }
2124
+
2125
+ /**
2126
+ * Fluid properties for shapes that act as fluid regions.
2127
+ *
2128
+ * Controls density, viscosity, and per-fluid gravity override.
2129
+ * Internally wraps a ZPP_FluidProperties and is registered as
2130
+ * the public `nape.phys.FluidProperties` class in the compiled namespace.
2131
+ *
2132
+ * Converted from nape-compiled.js lines 37002–37511.
2133
+ */
2134
+ declare class FluidProperties {
2135
+ static __name__: string[];
2136
+ constructor(density?: number, viscosity?: number);
2137
+ get density(): number;
2138
+ set density(value: number);
2139
+ get viscosity(): number;
2140
+ set viscosity(value: number);
2141
+ get gravity(): any;
2142
+ set gravity(gravity: any);
2143
+ get userData(): Record<string, unknown>;
2144
+ get shapes(): any;
2145
+ copy(): FluidProperties;
2146
+ toString(): string;
2147
+ }
2148
+
2149
+ /**
2150
+ * Mass mode for a body.
2151
+ *
2152
+ * - `DEFAULT` — use computed mass from shapes
2153
+ * - `FIXED` — use a fixed mass value
2154
+ *
2155
+ * Converted from nape-compiled.js lines 26966–27013.
2156
+ */
2157
+ declare class MassMode {
2158
+ static __name__: string[];
2159
+ constructor();
2160
+ static get DEFAULT(): MassMode;
2161
+ static get FIXED(): MassMode;
2162
+ toString(): string;
2163
+ }
2164
+
2165
+ /**
2166
+ * Inertia mode for a body.
2167
+ *
2168
+ * - `DEFAULT` — use computed inertia from shapes
2169
+ * - `FIXED` — use a fixed inertia value
2170
+ *
2171
+ * Converted from nape-compiled.js lines 26343–26390.
2172
+ */
2173
+ declare class InertiaMode {
2174
+ static __name__: string[];
2175
+ constructor();
2176
+ static get DEFAULT(): InertiaMode;
2177
+ static get FIXED(): InertiaMode;
2178
+ toString(): string;
2179
+ }
2180
+
2181
+ /**
2182
+ * Gravity mass mode for a body.
2183
+ *
2184
+ * - `DEFAULT` — use computed mass for gravity
2185
+ * - `FIXED` — use a fixed gravity mass value
2186
+ * - `SCALED` — scale the computed gravity mass
2187
+ *
2188
+ * Converted from nape-compiled.js lines 26272–26342.
2189
+ */
2190
+ declare class GravMassMode {
2191
+ static __name__: string[];
2192
+ constructor();
2193
+ static get DEFAULT(): GravMassMode;
2194
+ static get FIXED(): GravMassMode;
2195
+ static get SCALED(): GravMassMode;
2196
+ toString(): string;
2197
+ }
2198
+
2199
+ /**
2200
+ * A rigid body in the physics simulation. Add shapes to give it geometry, then add it to a `Space` to participate in simulation.
2201
+ */
2202
+ declare class Body extends Interactor {
2203
+ static __name__: string[];
2204
+ static __super__: typeof Interactor;
2205
+ /** If true, this body is included in debug rendering. */
2206
+ debugDraw: boolean;
2207
+ /**
2208
+ * @param type - Body type (DYNAMIC by default).
2209
+ * @param position - Initial world-space position (defaults to origin).
2210
+ */
2211
+ constructor(type?: BodyType, position?: Vec2);
2212
+ /** The body type: DYNAMIC, STATIC, or KINEMATIC. Cannot be changed mid-step. */
2213
+ get type(): BodyType;
2214
+ set type(value: BodyType);
2215
+ /** Return true if this body is static. */
2216
+ isStatic(): boolean;
2217
+ /** Return true if this body is dynamic. */
2218
+ isDynamic(): boolean;
2219
+ /** Return true if this body is kinematic. */
2220
+ isKinematic(): boolean;
2221
+ /** World-space position of the body's origin. Live Vec2 — mutating it moves the body. */
2222
+ get position(): Vec2;
2223
+ set position(value: Vec2);
2224
+ /**
2225
+ * Rotation of the body in radians.
2226
+ * @throws If set on a static body that is already in a space.
2227
+ */
2228
+ get rotation(): number;
2229
+ set rotation(value: number);
2230
+ /** Linear velocity in world space (units/s). Live Vec2. Static bodies cannot have velocity. */
2231
+ get velocity(): Vec2;
2232
+ set velocity(value: Vec2);
2233
+ /** Angular velocity in radians per second. */
2234
+ get angularVel(): number;
2235
+ set angularVel(value: number);
2236
+ /** Desired velocity for kinematic bodies; the engine tries to match this each step. */
2237
+ get kinematicVel(): Vec2;
2238
+ set kinematicVel(value: Vec2);
2239
+ /** Desired angular velocity for kinematic bodies. */
2240
+ get kinAngVel(): number;
2241
+ set kinAngVel(value: number);
2242
+ /** Surface velocity used in friction calculations. */
2243
+ get surfaceVel(): Vec2;
2244
+ set surfaceVel(value: Vec2);
2245
+ /** Accumulated force applied to this body for the current step (cleared after each step). */
2246
+ get force(): Vec2;
2247
+ set force(value: Vec2);
2248
+ /** Accumulated torque applied to this body for the current step (only for DYNAMIC bodies). */
2249
+ get torque(): number;
2250
+ set torque(value: number);
2251
+ /**
2252
+ * Mass in kg. Must be finite and > 0. Setting switches massMode to FIXED.
2253
+ * @throws If the body is the world body, or if no shapes are present in DEFAULT mass mode.
2254
+ */
2255
+ get mass(): number;
2256
+ set mass(value: number);
2257
+ /**
2258
+ * Moment of inertia. Must be finite and > 0. Setting switches inertiaMode to FIXED.
2259
+ * @throws If the body is the world body, or if no shapes are present in DEFAULT inertia mode.
2260
+ */
2261
+ get inertia(): number;
2262
+ set inertia(value: number);
2263
+ /** Effective mass used by the constraint solver (accounts for allowMovement). */
2264
+ get constraintMass(): number;
2265
+ /** Effective inertia used by the constraint solver (accounts for allowRotation). */
2266
+ get constraintInertia(): number;
2267
+ /** Gravitational mass. Defaults to the same as `mass`. */
2268
+ get gravMass(): number;
2269
+ set gravMass(value: number);
2270
+ /** Scale factor applied to gravMass relative to the dynamic mass. */
2271
+ get gravMassScale(): number;
2272
+ set gravMassScale(value: number);
2273
+ /** If true, continuous collision detection (CCD) is enabled for this body. */
2274
+ get isBullet(): boolean;
2275
+ set isBullet(value: boolean);
2276
+ /** If true, CCD is disabled even if `isBullet` is set. */
2277
+ get disableCCD(): boolean;
2278
+ set disableCCD(value: boolean);
2279
+ /** If false, translational motion is frozen (infinite effective mass). */
2280
+ get allowMovement(): boolean;
2281
+ set allowMovement(value: boolean);
2282
+ /** If false, rotational motion is frozen (infinite effective inertia). */
2283
+ get allowRotation(): boolean;
2284
+ set allowRotation(value: boolean);
2285
+ /**
2286
+ * True if the body is currently sleeping.
2287
+ * @throws If the body is not in a Space.
2288
+ */
2289
+ get isSleeping(): boolean;
2290
+ /** List of shapes attached to this body. */
2291
+ get shapes(): NapeList<Shape>;
2292
+ /** The Space this body belongs to. Setting adds/removes it from the space. */
2293
+ get space(): Space;
2294
+ set space(value: Space | null);
2295
+ /** The Compound this body belongs to, or null. */
2296
+ get compound(): Compound | null;
2297
+ set compound(value: Compound | null);
2298
+ /**
2299
+ * World-space AABB enclosing all shapes.
2300
+ * @throws If this is the world body.
2301
+ */
2302
+ get bounds(): AABB;
2303
+ /** Constraint-solved velocity (read-only view used by the solver). */
2304
+ get constraintVelocity(): Vec2;
2305
+ /**
2306
+ * Local-space centre of mass (read-only, lazy-computed from shapes).
2307
+ * @throws If this is the world body.
2308
+ */
2309
+ get localCOM(): Vec2;
2310
+ /**
2311
+ * World-space centre of mass (read-only, lazy-computed).
2312
+ * @throws If this is the world body.
2313
+ */
2314
+ get worldCOM(): Vec2;
2315
+ /** Controls how mass is computed: DEFAULT (from shapes) or FIXED (manually set). */
2316
+ get massMode(): MassMode;
2317
+ set massMode(value: MassMode);
2318
+ /** Controls how inertia is computed: DEFAULT or FIXED. */
2319
+ get inertiaMode(): InertiaMode;
2320
+ set inertiaMode(value: InertiaMode);
2321
+ /** Controls gravitational mass: DEFAULT, FIXED, or SCALED. */
2322
+ get gravMassMode(): GravMassMode;
2323
+ set gravMassMode(value: GravMassMode);
2324
+ /**
2325
+ * Create a deep copy of this body (shapes, mass properties, etc.).
2326
+ * @returns A new Body with identical configuration.
2327
+ * @throws If this is the world body.
2328
+ */
2329
+ copy(): Body;
2330
+ /**
2331
+ * String identifier like `(dynamic)#42`.
2332
+ * @returns A human-readable description of this body.
2333
+ */
2334
+ toString(): string;
2335
+ /**
2336
+ * Manually integrate the body's position and rotation by `deltaTime` seconds (outside of `Space.step`).
2337
+ * @param deltaTime - Time in seconds to integrate over.
2338
+ * @returns `this` for chaining.
2339
+ * @throws If `deltaTime` is NaN.
2340
+ */
2341
+ integrate(deltaTime: number): Body;
2342
+ /**
2343
+ * Transform a point from local body space to world space.
2344
+ * @param point - The point in local space.
2345
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
2346
+ * @returns The transformed point in world space.
2347
+ */
2348
+ localPointToWorld(point: Vec2, weak?: boolean): Vec2;
2349
+ /**
2350
+ * Transform a point from world space to local body space.
2351
+ * @param point - The point in world space.
2352
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
2353
+ * @returns The transformed point in local space.
2354
+ */
2355
+ worldPointToLocal(point: Vec2, weak?: boolean): Vec2;
2356
+ /**
2357
+ * Rotate a vector from local body space to world space (no translation).
2358
+ * @param vector - The vector in local space.
2359
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
2360
+ * @returns The rotated vector in world space.
2361
+ */
2362
+ localVectorToWorld(vector: Vec2, weak?: boolean): Vec2;
2363
+ /**
2364
+ * Rotate a vector from world space to local body space (no translation).
2365
+ * @param vector - The vector in world space.
2366
+ * @param weak - If true, the returned Vec2 is a weak (pooled) reference.
2367
+ * @returns The rotated vector in local space.
2368
+ */
2369
+ worldVectorToLocal(vector: Vec2, weak?: boolean): Vec2;
2370
+ /**
2371
+ * Apply a linear (and optionally angular) impulse to the body.
2372
+ * If `pos` is given, it creates a torque about the body's centre.
2373
+ * If `sleepable` is true, sleeping bodies are not woken.
2374
+ * @param impulse - The linear impulse vector (world space).
2375
+ * @param pos - Optional world-space point of application.
2376
+ * @param sleepable - If true, the body will not be woken if sleeping.
2377
+ * @returns `this` for chaining.
2378
+ */
2379
+ applyImpulse(impulse: Vec2, pos?: Vec2, sleepable?: boolean): Body;
2380
+ /**
2381
+ * Apply a direct angular impulse (change in angular velocity × inertia).
2382
+ * @param impulse - The angular impulse magnitude.
2383
+ * @param sleepable - If true, the body will not be woken if sleeping.
2384
+ * @returns `this` for chaining.
2385
+ */
2386
+ applyAngularImpulse(impulse: number, sleepable?: boolean): Body;
2387
+ /**
2388
+ * Set linear and angular velocity so the body reaches the given target pose in `deltaTime` seconds.
2389
+ * Useful for kinematic or manually driven bodies.
2390
+ * @param targetPosition - Desired world-space position.
2391
+ * @param targetRotation - Desired rotation in radians.
2392
+ * @param deltaTime - Time in seconds over which to reach the target.
2393
+ * @returns `this` for chaining.
2394
+ * @throws If `targetPosition` is null or `deltaTime` is zero.
2395
+ */
2396
+ setVelocityFromTarget(targetPosition: Vec2, targetRotation: number, deltaTime: number): Body;
2397
+ /**
2398
+ * Translate all shapes attached to this body in local space by `translation`.
2399
+ * @param translation - Offset vector in local space.
2400
+ * @returns `this` for chaining.
2401
+ */
2402
+ translateShapes(translation: Vec2): Body;
2403
+ /**
2404
+ * Rotate all shapes attached to this body in local space by `angle` radians.
2405
+ * @param angle - Rotation in radians.
2406
+ * @returns `this` for chaining.
2407
+ */
2408
+ rotateShapes(angle: number): Body;
2409
+ /**
2410
+ * Scale all shapes attached to this body in local space.
2411
+ * @param scaleX - Horizontal scale factor.
2412
+ * @param scaleY - Vertical scale factor.
2413
+ * @returns `this` for chaining.
2414
+ */
2415
+ scaleShapes(scaleX: number, scaleY: number): Body;
2416
+ /**
2417
+ * Apply an affine transform matrix to all shapes in local space.
2418
+ * @param matrix - The 2D affine transformation matrix.
2419
+ * @returns `this` for chaining.
2420
+ */
2421
+ transformShapes(matrix: Mat23): Body;
2422
+ /**
2423
+ * Translate all shapes and adjust the body position so the local centre of mass coincides with the body origin.
2424
+ * @returns `this` for chaining.
2425
+ * @throws If the body has no shapes.
2426
+ */
2427
+ align(): Body;
2428
+ /**
2429
+ * Rotate the body about a world-space pivot point by `angle` radians.
2430
+ * Moves the body's position and increments its rotation.
2431
+ * @param centre - World-space pivot point.
2432
+ * @param angle - Rotation in radians.
2433
+ * @returns `this` for chaining.
2434
+ * @throws If `centre` is null or `angle` is NaN.
2435
+ */
2436
+ rotate(centre: Vec2, angle: number): Body;
2437
+ /**
2438
+ * Set the same `Material` on every shape attached to this body.
2439
+ * @param material - The material to apply.
2440
+ * @returns `this` for chaining.
2441
+ */
2442
+ setShapeMaterials(material: Material): Body;
2443
+ /**
2444
+ * Set the same `InteractionFilter` on every shape attached to this body.
2445
+ * @param filter - The interaction filter to apply.
2446
+ * @returns `this` for chaining.
2447
+ */
2448
+ setShapeFilters(filter: InteractionFilter): Body;
2449
+ /**
2450
+ * Set the same `FluidProperties` on every shape attached to this body.
2451
+ * @param fluidProperties - The fluid properties to apply.
2452
+ * @returns `this` for chaining.
2453
+ */
2454
+ setShapeFluidProperties(fluidProperties: FluidProperties): Body;
2455
+ /**
2456
+ * Test whether a world-space point lies inside any shape attached to this body.
2457
+ * @param point - The point to test in world space.
2458
+ * @returns True if the point is inside at least one shape.
2459
+ */
2460
+ contains(point: Vec2): boolean;
2461
+ /**
2462
+ * Return the set of bodies connected to this body via constraints.
2463
+ * @param depth - Maximum traversal depth (-1 means unlimited).
2464
+ * @param output - Optional existing list to accumulate results into.
2465
+ * @returns A BodyList of connected bodies.
2466
+ */
2467
+ connectedBodies(depth?: number, output?: BodyList | null): BodyList;
2468
+ /**
2469
+ * Return the set of bodies currently interacting with this body via arbiters.
2470
+ * @param type - Filter by interaction type (COLLISION, FLUID, SENSOR), or null for all.
2471
+ * @param _depth - Unused; reserved for future use.
2472
+ * @param output - Optional existing list to accumulate results into.
2473
+ * @returns A BodyList of interacting bodies.
2474
+ */
2475
+ interactingBodies(type?: InteractionType | null, _depth?: number, output?: BodyList | null): BodyList;
2476
+ /**
2477
+ * Sum of normal (penetration-resolving) impulses received from collision arbiters this step.
2478
+ * @param body - If provided, only arbiters shared with `body` are summed.
2479
+ * @param freshOnly - If true, only newly created arbiters are considered.
2480
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2481
+ */
2482
+ normalImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
2483
+ /**
2484
+ * Sum of tangent (friction) impulses received from collision arbiters this step.
2485
+ * @param body - If provided, only arbiters shared with `body` are summed.
2486
+ * @param freshOnly - If true, only newly created arbiters are considered.
2487
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2488
+ */
2489
+ tangentImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
2490
+ /**
2491
+ * Sum of total contact impulses (normal + tangent) from collision arbiters this step.
2492
+ * @param body - If provided, only arbiters shared with `body` are summed.
2493
+ * @param freshOnly - If true, only newly created arbiters are considered.
2494
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2495
+ */
2496
+ totalContactsImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
2497
+ /**
2498
+ * Sum of rolling (angular friction) impulses from collision arbiters this step.
2499
+ * @param body - If provided, only arbiters shared with `body` are summed.
2500
+ * @param freshOnly - If true, only newly created arbiters are considered.
2501
+ * @returns The total rolling impulse scalar.
2502
+ */
2503
+ rollingImpulse(body?: Body | null, freshOnly?: boolean): number;
2504
+ /**
2505
+ * Sum of buoyancy impulses received from fluid arbiters this step.
2506
+ * @param body - If provided, only arbiters shared with `body` are summed.
2507
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2508
+ */
2509
+ buoyancyImpulse(body?: Body | null): Vec3;
2510
+ /**
2511
+ * Sum of fluid drag impulses received from fluid arbiters this step.
2512
+ * @param body - If provided, only arbiters shared with `body` are summed.
2513
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2514
+ */
2515
+ dragImpulse(body?: Body | null): Vec3;
2516
+ /**
2517
+ * Sum of total fluid impulses (buoyancy + drag) from fluid arbiters this step.
2518
+ * @param body - If provided, only arbiters shared with `body` are summed.
2519
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2520
+ */
2521
+ totalFluidImpulse(body?: Body | null): Vec3;
2522
+ /**
2523
+ * Sum of impulses applied to this body by all attached constraints this step.
2524
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2525
+ */
2526
+ constraintsImpulse(): Vec3;
2527
+ /**
2528
+ * Sum of all impulses (contacts + constraints) applied to this body this step, excluding sensor arbiters.
2529
+ * @param body - If provided, only arbiters shared with `body` are summed.
2530
+ * @param freshOnly - If true, only newly created contact arbiters are considered.
2531
+ * @returns A Vec3 where x/y are the linear component and z is the angular component.
2532
+ */
2533
+ totalImpulse(body?: Body | null, freshOnly?: boolean): Vec3;
2534
+ /**
2535
+ * Compute a heuristic crush factor indicating how strongly this body is being compressed from multiple directions.
2536
+ * A value near zero means balanced forces; larger values indicate compression.
2537
+ * @returns The crush factor (dimensionless).
2538
+ * @throws If the body is not in a Space.
2539
+ */
2540
+ crushFactor(): number;
2541
+ private _getArbiters;
2542
+ private _getConstraints;
2543
+ private _arbiterImpulseQuery;
2544
+ }
2545
+
2546
+ /**
2547
+ * Shape type classification.
2548
+ *
2549
+ * - `CIRCLE` — circle shape
2550
+ * - `POLYGON` — polygon shape
2551
+ *
2552
+ * Converted from nape-compiled.js lines 30435–30482.
2553
+ */
2554
+ declare class ShapeType {
2555
+ static __name__: string[];
2556
+ constructor();
2557
+ static get CIRCLE(): ShapeType;
2558
+ static get POLYGON(): ShapeType;
2559
+ toString(): string;
2560
+ }
2561
+
2562
+ /**
2563
+ * Base class for physics shapes (Circle, Polygon). Never instantiated directly — use
2564
+ * `new Circle(...)` or `Polygon.box(...)` etc.
2565
+ */
2566
+ declare class Shape extends Interactor {
2567
+ /** The shape type: CIRCLE or POLYGON. */
2568
+ get type(): ShapeType;
2569
+ /** Returns true if this is a Circle shape. */
2570
+ isCircle(): boolean;
2571
+ /** Returns true if this is a Polygon shape. */
2572
+ isPolygon(): boolean;
2573
+ /**
2574
+ * The Body this shape belongs to. Setting moves the shape between bodies.
2575
+ */
2576
+ get body(): Body;
2577
+ set body(value: Body | null);
2578
+ /** Cast to Circle, or null if this is not a circle. */
2579
+ get castCircle(): Shape | null;
2580
+ /** Cast to Polygon, or null if this is not a polygon. */
2581
+ get castPolygon(): Shape | null;
2582
+ /** World-space centre of mass of this shape (read-only, lazy-computed). */
2583
+ get worldCOM(): Vec2;
2584
+ /**
2585
+ * Local-space centre of mass. Can be set to override the default shape centroid.
2586
+ */
2587
+ get localCOM(): Vec2;
2588
+ set localCOM(value: Vec2);
2589
+ /** Cross-sectional area of this shape. */
2590
+ get area(): number;
2591
+ /** Contribution to moment of inertia (about local centroid, unit density). */
2592
+ get inertia(): number;
2593
+ /** Angular drag coefficient for this shape. */
2594
+ get angDrag(): number;
2595
+ /** The Material assigned to this shape (controls friction, elasticity, density). */
2596
+ get material(): Material;
2597
+ set material(value: Material);
2598
+ /** The InteractionFilter controlling which shapes interact with this one. */
2599
+ get filter(): InteractionFilter;
2600
+ set filter(value: InteractionFilter);
2601
+ /** Fluid simulation properties for this shape. Auto-created on first access. */
2602
+ get fluidProperties(): FluidProperties;
2603
+ set fluidProperties(value: FluidProperties);
2604
+ /** Set of callback types registered on this shape for event dispatch. */
2605
+ get cbTypes(): CbTypeSet;
2606
+ /** If true, this shape participates in fluid interaction. */
2607
+ get fluidEnabled(): boolean;
2608
+ set fluidEnabled(value: boolean);
2609
+ /** If true, this shape acts as a sensor (no physical response, only callbacks). */
2610
+ get sensorEnabled(): boolean;
2611
+ set sensorEnabled(value: boolean);
2612
+ /** World-space AABB of this shape (updated each step). */
2613
+ get bounds(): AABB;
2614
+ /**
2615
+ * Translate the shape's local vertices by the given vector (in-place).
2616
+ * @param translation - The displacement vector to apply.
2617
+ * @returns `this` for chaining.
2618
+ */
2619
+ translate(translation: Vec2): Shape;
2620
+ /**
2621
+ * Scale the shape's local geometry. Circles require uniform scaling.
2622
+ * @param scaleX - Horizontal scale factor (must be non-zero).
2623
+ * @param scaleY - Vertical scale factor (must be non-zero).
2624
+ * @returns `this` for chaining.
2625
+ */
2626
+ scale(scaleX: number, scaleY: number): Shape;
2627
+ /**
2628
+ * Rotate the shape's local vertices by `angle` radians.
2629
+ * @param angle - Rotation in radians.
2630
+ * @returns `this` for chaining.
2631
+ */
2632
+ rotate(angle: number): Shape;
2633
+ /**
2634
+ * Apply a Mat23 affine transform to the shape's local geometry.
2635
+ * @param matrix - The transformation matrix (must be non-singular; Circles require equiorthogonal).
2636
+ * @returns `this` for chaining.
2637
+ */
2638
+ transform(matrix: {
2639
+ _inner: NapeInner;
2640
+ }): Shape;
2641
+ /**
2642
+ * Return true if the given world-space point lies inside this shape.
2643
+ * Requires the shape to be attached to a Body.
2644
+ * @param point - The world-space point to test.
2645
+ * @returns True if the point is inside this shape.
2646
+ */
2647
+ contains(point: Vec2): boolean;
2648
+ /**
2649
+ * Create a deep copy of this shape with the same type, geometry, material, and filter.
2650
+ * @returns A new Shape instance independent of this one.
2651
+ */
2652
+ copy(): Shape;
2653
+ toString(): string;
2654
+ /** Setup worldCOM lazy Vec2 wrapper */
2655
+ private _setupWorldCOM;
2656
+ }
2657
+ /** Lightweight typed interface for the callback type set on a shape. */
2658
+ interface CbTypeSet {
2659
+ readonly _inner: NapeInner;
2660
+ add(cbType: {
2661
+ _inner: NapeInner;
2662
+ }): void;
2663
+ remove(cbType: {
2664
+ _inner: NapeInner;
2665
+ }): void;
2666
+ has(cbType: {
2667
+ _inner: NapeInner;
2668
+ }): boolean;
2669
+ clear(): void;
2670
+ readonly length: number;
2671
+ }
2672
+
2673
+ /**
2674
+ * Result from a convex-cast query.
2675
+ *
2676
+ * Provides the contact normal, position, time-of-impact, and shape hit.
2677
+ * Instances are pooled — call `dispose()` when done to return to pool.
2678
+ */
2679
+ declare class ConvexResult {
2680
+ static __name__: string[];
2681
+ constructor();
2682
+ get normal(): Vec2;
2683
+ get position(): Vec2;
2684
+ get toi(): number;
2685
+ get shape(): Shape;
2686
+ dispose(): void;
2687
+ toString(): string;
2688
+ }
2689
+
2690
+ export { AABB as A, Body as B, CollisionArbiter as C, DebugDraw as D, Edge as E, FluidArbiter as F, GravMassMode as G, Polygon as H, InteractionFilter as I, RayResult as J, type RayResultList as K, Listener as L, Material as M, NapeList as N, type ShapeList as O, PreFlag as P, ShapeType as Q, Ray as R, Shape as S, Space as T, type TypedListLike as U, Vec2 as V, Vec3 as a, CbEvent as b, Interactor as c, InteractionType as d, Constraint as e, Arbiter as f, MatMN as g, type ArbiterList as h, ArbiterType as i, type BodyList as j, BodyType as k, Broadphase as l, type CbTypeSet as m, Compound as n, type CompoundList as o, type ConstraintList as p, ConvexResult as q, type ConvexResultList as r, type DebugVec2 as s, FluidProperties as t, InertiaMode as u, InteractionGroup as v, type ListenerList as w, ListenerType as x, MassMode as y, Mat23 as z };