@newkrok/nape-js 3.3.13 → 3.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -25,13 +25,13 @@ declare function getNape(): any;
25
25
  *
26
26
  * Converted from nape-compiled.js lines 83820–84273, 134996.
27
27
  */
28
- type Any$x = any;
28
+ type Any$F = any;
29
29
  declare class ZPP_Vec2 {
30
30
  static zpp_pool: ZPP_Vec2 | null;
31
31
  static __name__: string[];
32
- static _nape: Any$x;
33
- static _zpp: Any$x;
34
- static _wrapFn: ((zpp: ZPP_Vec2) => Any$x) | null;
32
+ static _nape: Any$F;
33
+ static _zpp: Any$F;
34
+ static _wrapFn: ((zpp: ZPP_Vec2) => Any$F) | null;
35
35
  x: number;
36
36
  y: number;
37
37
  next: ZPP_Vec2 | null;
@@ -40,18 +40,18 @@ declare class ZPP_Vec2 {
40
40
  pushmod: boolean;
41
41
  _inuse: boolean;
42
42
  weak: boolean;
43
- outer: Any$x;
43
+ outer: Any$F;
44
44
  _immutable: boolean;
45
45
  _isimmutable: (() => void) | null;
46
46
  _validate: (() => void) | null;
47
47
  _invalidate: ((self: ZPP_Vec2) => void) | null;
48
- __class__: Any$x;
48
+ __class__: Any$F;
49
49
  /** Static factory with optional pooling and immutability. */
50
50
  static get(x: number, y: number, immutable?: boolean): ZPP_Vec2;
51
51
  validate(): void;
52
52
  invalidate(): void;
53
53
  immutable(): void;
54
- wrapper(): Any$x;
54
+ wrapper(): Any$F;
55
55
  free(): void;
56
56
  alloc(): void;
57
57
  elem(): ZPP_Vec2;
@@ -203,20 +203,20 @@ type NapeInner = any;
203
203
  *
204
204
  * Converted from nape-compiled.js lines 83412–83434.
205
205
  */
206
- type Any$w = any;
206
+ type Any$E = any;
207
207
  declare class ZPP_Vec3 {
208
208
  static __name__: string[];
209
- static _zpp: Any$w;
210
- static _wrapFn: ((zpp: ZPP_Vec3) => Any$w) | null;
211
- outer: Any$w;
209
+ static _zpp: Any$E;
210
+ static _wrapFn: ((zpp: ZPP_Vec3) => Any$E) | null;
211
+ outer: Any$E;
212
212
  x: number;
213
213
  y: number;
214
214
  z: number;
215
215
  immutable: boolean;
216
216
  _validate: (() => void) | null;
217
- __class__: Any$w;
217
+ __class__: Any$E;
218
218
  validate(): void;
219
- wrapper(): Any$w;
219
+ wrapper(): Any$E;
220
220
  }
221
221
 
222
222
  /**
@@ -280,13 +280,13 @@ declare class Vec3 {
280
280
  *
281
281
  * Converted from nape-compiled.js lines 73495–73561, 133826.
282
282
  */
283
- type Any$v = any;
283
+ type Any$D = any;
284
284
  declare class ZPP_Mat23 {
285
285
  static __name__: string[];
286
- static _nape: Any$v;
287
- static _wrapFn: ((zpp: ZPP_Mat23) => Any$v) | null;
286
+ static _nape: Any$D;
287
+ static _wrapFn: ((zpp: ZPP_Mat23) => Any$D) | null;
288
288
  static zpp_pool: ZPP_Mat23 | null;
289
- outer: Any$v;
289
+ outer: Any$D;
290
290
  a: number;
291
291
  b: number;
292
292
  c: number;
@@ -295,13 +295,13 @@ declare class ZPP_Mat23 {
295
295
  ty: number;
296
296
  _invalidate: (() => void) | null;
297
297
  next: ZPP_Mat23 | null;
298
- __class__: Any$v;
298
+ __class__: Any$D;
299
299
  /** Static factory with pooling. */
300
300
  static get(): ZPP_Mat23;
301
301
  /** Create an identity matrix from pool. */
302
302
  static identity(): ZPP_Mat23;
303
303
  /** Create a public wrapper, recycling any existing inner. */
304
- wrapper(): Any$v;
304
+ wrapper(): Any$D;
305
305
  invalidate(): void;
306
306
  set(m: ZPP_Mat23): void;
307
307
  setas(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
@@ -362,13 +362,13 @@ declare class Mat23 {
362
362
  *
363
363
  * Converted from nape-compiled.js lines 69554–69563.
364
364
  */
365
- type Any$u = any;
365
+ type Any$C = any;
366
366
  declare class ZPP_GeomPoly {
367
367
  static __name__: string[];
368
- outer: Any$u;
369
- vertices: Any$u;
370
- __class__: Any$u;
371
- constructor(outer?: Any$u);
368
+ outer: Any$C;
369
+ vertices: Any$C;
370
+ __class__: Any$C;
371
+ constructor(outer?: Any$C);
372
372
  }
373
373
 
374
374
  /**
@@ -392,7 +392,7 @@ declare class Winding {
392
392
  toString(): string;
393
393
  }
394
394
 
395
- type Any$t = any;
395
+ type Any$B = any;
396
396
  /**
397
397
  * A polygon represented as a circular doubly-linked list of vertices.
398
398
  *
@@ -407,8 +407,8 @@ declare class GeomPoly {
407
407
  zpp_inner: ZPP_GeomPoly;
408
408
  zpp_pool: GeomPoly | null;
409
409
  zpp_disp: boolean;
410
- get _inner(): Any$t;
411
- constructor(vertices?: Any$t);
410
+ get _inner(): Any$B;
411
+ constructor(vertices?: Any$B);
412
412
  private _checkDisposed;
413
413
  /** @internal Get compiled ZPP_GeomVert class */
414
414
  private static _gvClass;
@@ -434,12 +434,12 @@ declare class GeomPoly {
434
434
  private static _addVertices;
435
435
  /** @internal After copying, dispose weak Vec2 inputs */
436
436
  private static _disposeWeakInputs;
437
- static get(vertices?: Any$t): GeomPoly;
437
+ static get(vertices?: Any$B): GeomPoly;
438
438
  empty(): boolean;
439
439
  size(): number;
440
- iterator(): Any$t;
441
- forwardIterator(): Any$t;
442
- backwardsIterator(): Any$t;
440
+ iterator(): Any$B;
441
+ forwardIterator(): Any$B;
442
+ backwardsIterator(): Any$B;
443
443
  current(): Vec2;
444
444
  push(vertex: Vec2): this;
445
445
  pop(): this;
@@ -452,7 +452,7 @@ declare class GeomPoly {
452
452
  copy(): GeomPoly;
453
453
  dispose(): void;
454
454
  area(): number;
455
- winding(): Any$t;
455
+ winding(): Any$B;
456
456
  contains(point: Vec2): boolean;
457
457
  isClockwise(): boolean;
458
458
  isConvex(): boolean;
@@ -460,14 +460,14 @@ declare class GeomPoly {
460
460
  isMonotone(): boolean;
461
461
  isDegenerate(): boolean;
462
462
  simplify(epsilon: number): GeomPoly;
463
- simpleDecomposition(output?: Any$t): Any$t;
464
- monotoneDecomposition(output?: Any$t): Any$t;
465
- convexDecomposition(delaunay?: boolean, output?: Any$t): Any$t;
466
- triangularDecomposition(delaunay?: boolean, output?: Any$t): Any$t;
463
+ simpleDecomposition(output?: Any$B): Any$B;
464
+ monotoneDecomposition(output?: Any$B): Any$B;
465
+ convexDecomposition(delaunay?: boolean, output?: Any$B): Any$B;
466
+ triangularDecomposition(delaunay?: boolean, output?: Any$B): Any$B;
467
467
  inflate(inflation: number): GeomPoly;
468
- cut(start: Vec2, end: Vec2, boundedStart?: boolean, boundedEnd?: boolean, output?: Any$t): Any$t;
469
- transform(matrix: Any$t): this;
470
- bounds(): Any$t;
468
+ cut(start: Vec2, end: Vec2, boundedStart?: boolean, boundedEnd?: boolean, output?: Any$B): Any$B;
469
+ transform(matrix: Any$B): this;
470
+ bounds(): Any$B;
471
471
  top(): Vec2;
472
472
  bottom(): Vec2;
473
473
  left(): Vec2;
@@ -483,30 +483,30 @@ declare class GeomPoly {
483
483
  *
484
484
  * Converted from nape-compiled.js lines 63546–63965, 134951.
485
485
  */
486
- type Any$s = any;
486
+ type Any$A = any;
487
487
  declare class ZPP_AABB {
488
488
  static zpp_pool: ZPP_AABB | null;
489
489
  static __name__: string[];
490
- static _nape: Any$s;
491
- static _zpp: Any$s;
492
- static _wrapFn: ((zpp: ZPP_AABB) => Any$s) | null;
490
+ static _nape: Any$A;
491
+ static _zpp: Any$A;
492
+ static _wrapFn: ((zpp: ZPP_AABB) => Any$A) | null;
493
493
  _invalidate: ((self: ZPP_AABB) => void) | null;
494
494
  _validate: (() => void) | null;
495
495
  _immutable: boolean;
496
- outer: Any$s;
496
+ outer: Any$A;
497
497
  next: ZPP_AABB | null;
498
498
  minx: number;
499
499
  miny: number;
500
500
  maxx: number;
501
501
  maxy: number;
502
- wrap_min: Any$s;
503
- wrap_max: Any$s;
504
- __class__: Any$s;
502
+ wrap_min: Any$A;
503
+ wrap_max: Any$A;
504
+ __class__: Any$A;
505
505
  /** Static factory with pooling. */
506
506
  static get(minx: number, miny: number, maxx: number, maxy: number): ZPP_AABB;
507
507
  validate(): void;
508
508
  invalidate(): void;
509
- wrapper(): Any$s;
509
+ wrapper(): Any$A;
510
510
  alloc(): void;
511
511
  free(): void;
512
512
  copy(): ZPP_AABB;
@@ -517,10 +517,10 @@ declare class ZPP_AABB {
517
517
  private static _makeVec2Wrapper;
518
518
  getmin(): void;
519
519
  dom_min(): void;
520
- mod_min(min: Any$s): void;
520
+ mod_min(min: Any$A): void;
521
521
  getmax(): void;
522
522
  dom_max(): void;
523
- mod_max(max: Any$s): void;
523
+ mod_max(max: Any$A): void;
524
524
  intersectX(x: ZPP_AABB): boolean;
525
525
  intersectY(x: ZPP_AABB): boolean;
526
526
  intersect(x: ZPP_AABB): boolean;
@@ -584,18 +584,18 @@ declare class AABB {
584
584
  *
585
585
  * Converted from nape-compiled.js lines 72949–72972.
586
586
  */
587
- type Any$r = any;
587
+ type Any$z = any;
588
588
  declare class ZPP_MatMN {
589
589
  static __name__: string[];
590
- outer: Any$r;
590
+ outer: Any$z;
591
591
  m: number;
592
592
  n: number;
593
593
  x: number[];
594
- __class__: Any$r;
594
+ __class__: Any$z;
595
595
  constructor(m: number, n: number);
596
596
  }
597
597
 
598
- type Any$q = any;
598
+ type Any$y = any;
599
599
  /**
600
600
  * Variable-sized M×N matrix.
601
601
  *
@@ -606,7 +606,7 @@ declare class MatMN {
606
606
  zpp_inner: ZPP_MatMN;
607
607
  get _inner(): NapeInner;
608
608
  constructor(rows: number, cols: number);
609
- static _wrap(inner: Any$q): MatMN;
609
+ static _wrap(inner: Any$y): MatMN;
610
610
  get rows(): number;
611
611
  get cols(): number;
612
612
  x(row: number, col: number): number;
@@ -616,7 +616,7 @@ declare class MatMN {
616
616
  mul(matrix: MatMN): MatMN;
617
617
  }
618
618
 
619
- type Any$p = any;
619
+ type Any$x = any;
620
620
  /**
621
621
  * Isosurface extraction using the marching squares algorithm.
622
622
  *
@@ -639,7 +639,7 @@ declare class MarchingSquares {
639
639
  * @param output - Optional GeomPolyList to populate. If null, a new one is created.
640
640
  * @returns The populated GeomPolyList.
641
641
  */
642
- static run(iso: (x: number, y: number) => number, bounds: AABB, cellsize: Vec2, quality?: number, subgrid?: Vec2 | null, combine?: boolean, output?: Any$p): Any$p;
642
+ static run(iso: (x: number, y: number) => number, bounds: AABB, cellsize: Vec2, quality?: number, subgrid?: Vec2 | null, combine?: boolean, output?: Any$x): Any$x;
643
643
  }
644
644
 
645
645
  /**
@@ -667,56 +667,141 @@ declare class Ray {
667
667
  copy(): Ray;
668
668
  }
669
669
 
670
- type Any$o = any;
670
+ /**
671
+ * ZPP_ConvexRayResult — Internal result object for ray-cast and convex-cast queries.
672
+ *
673
+ * Serves as the shared internal type for both RayResult and ConvexResult public wrappers.
674
+ * Uses separate pools for ray results vs convex results.
675
+ *
676
+ * Converted from nape-compiled.js lines 38897–39076, 86860–86862.
677
+ */
678
+ type Any$w = any;
679
+ declare class ZPP_ConvexRayResult {
680
+ static __name__: string[];
681
+ static rayPool: ZPP_ConvexRayResult | null;
682
+ static convexPool: ZPP_ConvexRayResult | null;
683
+ static internal: boolean;
684
+ static _createRayResult: (() => Any$w) | null;
685
+ static _createConvexResult: (() => Any$w) | null;
686
+ normal: Any$w;
687
+ shape: Any$w;
688
+ convex: Any$w;
689
+ position: Any$w;
690
+ ray: Any$w;
691
+ inner: boolean;
692
+ next: ZPP_ConvexRayResult | null;
693
+ toiDistance: number;
694
+ __class__: Any$w;
695
+ static getRay(normal: Any$w, time: number, inner: boolean, shape: Any$w): Any$w;
696
+ static getConvex(normal: Any$w, position: Any$w, toiDistance: number, shape: Any$w): Any$w;
697
+ disposed(): void;
698
+ free(): void;
699
+ private static _disposeVec2;
700
+ }
701
+
702
+ type Any$v = any;
671
703
  /**
672
704
  * Result from a convex-cast query.
673
705
  *
674
- * Thin wrapper delegates to compiled ZPP_ConvexRayResult (not yet extracted).
706
+ * Provides the contact normal, position, time-of-impact, and shape hit.
707
+ * Instances are pooled — call `dispose()` when done to return to pool.
675
708
  */
676
709
  declare class ConvexResult {
677
710
  static __name__: string[];
678
711
  /** @internal */
679
- zpp_inner: Any$o;
712
+ zpp_inner: ZPP_ConvexRayResult;
680
713
  /** @internal Backward-compat: compiled code accesses `obj.zpp_inner`. */
681
714
  get _inner(): NapeInner;
682
715
  constructor();
683
716
  /** @internal */
684
- static _wrap(inner: Any$o): ConvexResult;
717
+ static _wrap(inner: Any$v): ConvexResult;
685
718
  get normal(): Vec2;
686
719
  get position(): Vec2;
687
720
  get toi(): number;
688
- get shape(): Any$o;
721
+ get shape(): Any$v;
689
722
  dispose(): void;
690
723
  toString(): string;
691
724
  /** @internal */
692
725
  private _disposed;
693
726
  }
694
727
 
695
- type Any$n = any;
728
+ type Any$u = any;
696
729
  /**
697
730
  * Result from a raycast query.
698
731
  *
699
- * Thin wrapper delegates to compiled ZPP_ConvexRayResult (not yet extracted).
732
+ * Provides the contact normal, distance, inside-flag, and shape hit.
733
+ * Instances are pooled — call `dispose()` when done to return to pool.
700
734
  */
701
735
  declare class RayResult {
702
736
  static __name__: string[];
703
737
  /** @internal */
704
- zpp_inner: Any$n;
738
+ zpp_inner: ZPP_ConvexRayResult;
705
739
  /** @internal Backward-compat: compiled code accesses `obj.zpp_inner`. */
706
740
  get _inner(): NapeInner;
707
741
  constructor();
708
742
  /** @internal */
709
- static _wrap(inner: Any$n): RayResult;
743
+ static _wrap(inner: Any$u): RayResult;
710
744
  get normal(): Vec2;
711
745
  get distance(): number;
712
746
  get inner(): boolean;
713
- get shape(): Any$n;
747
+ get shape(): Any$u;
714
748
  dispose(): void;
715
749
  toString(): string;
716
750
  /** @internal */
717
751
  private _disposed;
718
752
  }
719
753
 
754
+ type Any$t = any;
755
+ /**
756
+ * Static utility class for geometric queries between shapes and bodies.
757
+ *
758
+ * All methods are static. This class cannot be instantiated.
759
+ *
760
+ * Thin wrapper — delegates to compiled nape.geom.Geom methods.
761
+ */
762
+ declare class Geom {
763
+ static __name__: string[];
764
+ /**
765
+ * Calculate minimum distance between two bodies and return closest points.
766
+ * @param body1 - First body (must have shapes).
767
+ * @param body2 - Second body (must have shapes).
768
+ * @param out1 - Output Vec2 for closest point on body1.
769
+ * @param out2 - Output Vec2 for closest point on body2.
770
+ * @returns The distance between the two bodies.
771
+ */
772
+ static distanceBody(body1: Any$t, body2: Any$t, out1: Vec2, out2: Vec2): number;
773
+ /**
774
+ * Calculate minimum distance between two shapes and return closest points.
775
+ * @param shape1 - First shape (must be part of a body).
776
+ * @param shape2 - Second shape (must be part of a body).
777
+ * @param out1 - Output Vec2 for closest point on shape1.
778
+ * @param out2 - Output Vec2 for closest point on shape2.
779
+ * @returns The distance between the two shapes.
780
+ */
781
+ static distance(shape1: Any$t, shape2: Any$t, out1: Vec2, out2: Vec2): number;
782
+ /**
783
+ * Test if two bodies intersect (any of their shapes overlap).
784
+ * @param body1 - First body (must have shapes).
785
+ * @param body2 - Second body (must have shapes).
786
+ * @returns True if the bodies intersect.
787
+ */
788
+ static intersectsBody(body1: Any$t, body2: Any$t): boolean;
789
+ /**
790
+ * Test if two shapes intersect.
791
+ * @param shape1 - First shape (must be part of a body).
792
+ * @param shape2 - Second shape (must be part of a body).
793
+ * @returns True if the shapes intersect.
794
+ */
795
+ static intersects(shape1: Any$t, shape2: Any$t): boolean;
796
+ /**
797
+ * Test if shape1 fully contains shape2.
798
+ * @param shape1 - Containing shape (must be part of a body).
799
+ * @param shape2 - Contained shape (must be part of a body).
800
+ * @returns True if shape1 contains shape2.
801
+ */
802
+ static contains(shape1: Any$t, shape2: Any$t): boolean;
803
+ }
804
+
720
805
  /**
721
806
  * Generic typed wrapper around Haxe list objects (BodyList, ShapeList, etc.).
722
807
  *
@@ -778,7 +863,7 @@ declare class NapeList<T> implements Iterable<T> {
778
863
  *
779
864
  * Converted from nape-compiled.js lines 87523–87601, 135477–135481.
780
865
  */
781
- type Any$m = any;
866
+ type Any$s = any;
782
867
  declare class ZPP_Material {
783
868
  static zpp_pool: ZPP_Material | null;
784
869
  static WAKE: number;
@@ -791,27 +876,27 @@ declare class ZPP_Material {
791
876
  * _nape = the `nape` public namespace (for wrapper creation)
792
877
  * _zpp = the `zpp_nape` internal namespace (for ZNPList_ZPP_Shape)
793
878
  */
794
- static _nape: Any$m;
795
- static _zpp: Any$m;
879
+ static _nape: Any$s;
880
+ static _zpp: Any$s;
796
881
  /**
797
882
  * Wrapper factory callback, registered by the modernized Material class.
798
883
  * When set, wrapper() uses this instead of creating a compiled Material.
799
884
  */
800
- static _wrapFn: ((zpp: ZPP_Material) => Any$m) | null;
885
+ static _wrapFn: ((zpp: ZPP_Material) => Any$s) | null;
801
886
  elasticity: number;
802
887
  dynamicFriction: number;
803
888
  staticFriction: number;
804
889
  density: number;
805
890
  rollingFriction: number;
806
- shapes: Any$m;
807
- wrap_shapes: Any$m;
808
- outer: Any$m;
809
- userData: Any$m;
891
+ shapes: Any$s;
892
+ wrap_shapes: Any$s;
893
+ outer: Any$s;
894
+ userData: Any$s;
810
895
  next: ZPP_Material | null;
811
- __class__: Any$m;
896
+ __class__: Any$s;
812
897
  constructor();
813
898
  /** Create/return the public nape.phys.Material wrapper for this internal object. */
814
- wrapper(): Any$m;
899
+ wrapper(): Any$s;
815
900
  /** Called when this object is returned to the pool. */
816
901
  free(): void;
817
902
  /** Called when this object is taken from the pool. */
@@ -819,9 +904,9 @@ declare class ZPP_Material {
819
904
  /** Initialize the shapes list (called during feature construction). */
820
905
  feature_cons(): void;
821
906
  /** Register a shape that uses this material. */
822
- addShape(shape: Any$m): void;
907
+ addShape(shape: Any$s): void;
823
908
  /** Unregister a shape that no longer uses this material. */
824
- remShape(shape: Any$m): void;
909
+ remShape(shape: Any$s): void;
825
910
  /** Create a copy with the same property values. */
826
911
  copy(): ZPP_Material;
827
912
  /** Copy all property values from another ZPP_Material. */
@@ -881,36 +966,36 @@ declare class Material {
881
966
  *
882
967
  * Converted from nape-compiled.js lines 87335–87523, 135403.
883
968
  */
884
- type Any$l = any;
969
+ type Any$r = any;
885
970
  declare class ZPP_FluidProperties {
886
971
  static zpp_pool: ZPP_FluidProperties | null;
887
972
  static __name__: string[];
888
- static _nape: Any$l;
889
- static _zpp: Any$l;
890
- static _wrapFn: ((zpp: ZPP_FluidProperties) => Any$l) | null;
973
+ static _nape: Any$r;
974
+ static _zpp: Any$r;
975
+ static _wrapFn: ((zpp: ZPP_FluidProperties) => Any$r) | null;
891
976
  viscosity: number;
892
977
  density: number;
893
978
  gravityx: number;
894
979
  gravityy: number;
895
- wrap_gravity: Any$l;
896
- shapes: Any$l;
897
- wrap_shapes: Any$l;
898
- outer: Any$l;
899
- userData: Any$l;
980
+ wrap_gravity: Any$r;
981
+ shapes: Any$r;
982
+ wrap_shapes: Any$r;
983
+ outer: Any$r;
984
+ userData: Any$r;
900
985
  next: ZPP_FluidProperties | null;
901
- __class__: Any$l;
986
+ __class__: Any$r;
902
987
  constructor();
903
988
  /** Create/return the public nape.phys.FluidProperties wrapper. */
904
- wrapper(): Any$l;
989
+ wrapper(): Any$r;
905
990
  free(): void;
906
991
  alloc(): void;
907
992
  feature_cons(): void;
908
- addShape(shape: Any$l): void;
909
- remShape(shape: Any$l): void;
993
+ addShape(shape: Any$r): void;
994
+ remShape(shape: Any$r): void;
910
995
  /** Copy with object pooling. */
911
996
  copy(): ZPP_FluidProperties;
912
997
  /** Called when gravity Vec2 wrapper is invalidated (user set new gravity). */
913
- gravity_invalidate(x: Any$l): void;
998
+ gravity_invalidate(x: Any$r): void;
914
999
  /** Sync the gravity Vec2 wrapper with internal values. */
915
1000
  gravity_validate(): void;
916
1001
  /** Lazily create and return the gravity Vec2 wrapper. */
@@ -961,33 +1046,33 @@ declare class FluidProperties {
961
1046
  *
962
1047
  * Converted from nape-compiled.js lines 63255–63366, 135329.
963
1048
  */
964
- type Any$k = any;
1049
+ type Any$q = any;
965
1050
  declare class ZPP_InteractionFilter {
966
1051
  static zpp_pool: ZPP_InteractionFilter | null;
967
1052
  static __name__: string[];
968
- static _nape: Any$k;
969
- static _zpp: Any$k;
970
- static _wrapFn: ((zpp: ZPP_InteractionFilter) => Any$k) | null;
1053
+ static _nape: Any$q;
1054
+ static _zpp: Any$q;
1055
+ static _wrapFn: ((zpp: ZPP_InteractionFilter) => Any$q) | null;
971
1056
  collisionGroup: number;
972
1057
  collisionMask: number;
973
1058
  sensorGroup: number;
974
1059
  sensorMask: number;
975
1060
  fluidGroup: number;
976
1061
  fluidMask: number;
977
- shapes: Any$k;
978
- wrap_shapes: Any$k;
979
- outer: Any$k;
980
- userData: Any$k;
1062
+ shapes: Any$q;
1063
+ wrap_shapes: Any$q;
1064
+ outer: Any$q;
1065
+ userData: Any$q;
981
1066
  next: ZPP_InteractionFilter | null;
982
- __class__: Any$k;
1067
+ __class__: Any$q;
983
1068
  constructor();
984
1069
  /** Create/return the public nape.dynamics.InteractionFilter wrapper. */
985
- wrapper(): Any$k;
1070
+ wrapper(): Any$q;
986
1071
  free(): void;
987
1072
  alloc(): void;
988
1073
  feature_cons(): void;
989
- addShape(shape: Any$k): void;
990
- remShape(shape: Any$k): void;
1074
+ addShape(shape: Any$q): void;
1075
+ remShape(shape: Any$q): void;
991
1076
  /** Create a copy with object pooling. */
992
1077
  copy(): ZPP_InteractionFilter;
993
1078
  /** Test whether two filters allow collision between their shapes. */
@@ -1051,22 +1136,22 @@ declare class InteractionFilter {
1051
1136
  *
1052
1137
  * Converted from nape-compiled.js lines 63367–63463, 135330–135331.
1053
1138
  */
1054
- type Any$j = any;
1139
+ type Any$p = any;
1055
1140
  declare class ZPP_InteractionGroup {
1056
1141
  static SHAPE: number;
1057
1142
  static BODY: number;
1058
1143
  static __name__: string[];
1059
- static _zpp: Any$j;
1060
- static _wrapFn: ((zpp: ZPP_InteractionGroup) => Any$j) | null;
1061
- outer: Any$j;
1144
+ static _zpp: Any$p;
1145
+ static _wrapFn: ((zpp: ZPP_InteractionGroup) => Any$p) | null;
1146
+ outer: Any$p;
1062
1147
  ignore: boolean;
1063
1148
  group: ZPP_InteractionGroup | null;
1064
- groups: Any$j;
1065
- wrap_groups: Any$j;
1066
- interactors: Any$j;
1067
- wrap_interactors: Any$j;
1149
+ groups: Any$p;
1150
+ wrap_groups: Any$p;
1151
+ interactors: Any$p;
1152
+ wrap_interactors: Any$p;
1068
1153
  depth: number;
1069
- __class__: Any$j;
1154
+ __class__: Any$p;
1070
1155
  constructor();
1071
1156
  /** Set or change the parent group. */
1072
1157
  setGroup(group: ZPP_InteractionGroup | null): void;
@@ -1077,9 +1162,9 @@ declare class ZPP_InteractionGroup {
1077
1162
  /** Remove a child group. */
1078
1163
  remGroup(group: ZPP_InteractionGroup): void;
1079
1164
  /** Register an interactor in this group. */
1080
- addInteractor(intx: Any$j): void;
1165
+ addInteractor(intx: Any$p): void;
1081
1166
  /** Unregister an interactor from this group. */
1082
- remInteractor(intx: Any$j, flag?: number): void;
1167
+ remInteractor(intx: Any$p, flag?: number): void;
1083
1168
  }
1084
1169
 
1085
1170
  /**
@@ -1286,24 +1371,24 @@ declare class Constraint {
1286
1371
  *
1287
1372
  * Converted from nape-compiled.js lines 27259–27304, 112053–112139.
1288
1373
  */
1289
- type Any$i = any;
1374
+ type Any$o = any;
1290
1375
  declare class ZPP_Listener {
1291
1376
  static __name__: string[];
1292
- static _nape: Any$i;
1293
- static _zpp: Any$i;
1377
+ static _nape: Any$o;
1378
+ static _zpp: Any$o;
1294
1379
  static internal: boolean;
1295
- static types: Any$i[];
1296
- static events: Any$i[];
1297
- space: Any$i;
1298
- interaction: Any$i;
1299
- constraint: Any$i;
1300
- body: Any$i;
1380
+ static types: Any$o[];
1381
+ static events: Any$o[];
1382
+ space: Any$o;
1383
+ interaction: Any$o;
1384
+ constraint: Any$o;
1385
+ body: Any$o;
1301
1386
  precedence: number;
1302
1387
  event: number;
1303
1388
  type: number;
1304
1389
  id: number;
1305
- outer: Any$i;
1306
- __class__: Any$i;
1390
+ outer: Any$o;
1391
+ __class__: Any$o;
1307
1392
  constructor();
1308
1393
  /** Sort comparator: higher precedence first, then by id descending. */
1309
1394
  static setlt(a: ZPP_Listener, b: ZPP_Listener): boolean;
@@ -1379,20 +1464,20 @@ declare class ListenerType {
1379
1464
  * Fully modernized from nape-compiled.js lines 231–433.
1380
1465
  */
1381
1466
 
1382
- type Any$h = any;
1467
+ type Any$n = any;
1383
1468
  declare class Listener {
1384
1469
  static __name__: string[];
1385
1470
  zpp_inner: ZPP_Listener;
1386
- get _inner(): Any$h;
1471
+ get _inner(): Any$n;
1387
1472
  constructor();
1388
- static _wrap(inner: Any$h): Listener;
1473
+ static _wrap(inner: Any$n): Listener;
1389
1474
  get type(): ListenerType;
1390
1475
  get event(): CbEvent;
1391
1476
  set event(event: CbEvent);
1392
1477
  get precedence(): number;
1393
1478
  set precedence(precedence: number);
1394
1479
  get space(): Space | null;
1395
- set space(space: Space | Any$h | null);
1480
+ set space(space: Space | Any$n | null);
1396
1481
  toString(): string;
1397
1482
  }
1398
1483
 
@@ -1551,6 +1636,145 @@ declare class Body extends Interactor {
1551
1636
  toString(): string;
1552
1637
  }
1553
1638
 
1639
+ /**
1640
+ * ZPP_Compound — Internal compound representation for the nape physics engine.
1641
+ *
1642
+ * Hierarchical grouping of bodies, constraints, and other compounds.
1643
+ * Extends ZPP_Interactor (still in compiled code — methods copied at init time).
1644
+ *
1645
+ * Converted from nape-compiled.js lines 55195–55521.
1646
+ */
1647
+ type Any$m = any;
1648
+ declare class ZPP_Compound {
1649
+ static __name__: string[];
1650
+ static __super__: Any$m;
1651
+ /**
1652
+ * Namespace references, set by the compiled module after import.
1653
+ * _nape = the `nape` public namespace (for wrapper creation in copy())
1654
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_BodyList, etc.)
1655
+ */
1656
+ static _nape: Any$m;
1657
+ static _zpp: Any$m;
1658
+ /**
1659
+ * Wrapper factory callback, registered by the modernized Compound class.
1660
+ * When set, wrapper() uses this instead of the compiled Compound constructor.
1661
+ */
1662
+ static _wrapFn: ((zpp: ZPP_Compound) => Any$m) | null;
1663
+ outer_i: Any$m;
1664
+ id: number;
1665
+ userData: Any$m;
1666
+ ishape: Any$m;
1667
+ ibody: Any$m;
1668
+ icompound: Any$m;
1669
+ wrap_cbTypes: Any$m;
1670
+ cbSet: Any$m;
1671
+ cbTypes: Any$m;
1672
+ group: Any$m;
1673
+ cbsets: Any$m;
1674
+ outer: Any$m;
1675
+ bodies: Any$m;
1676
+ constraints: Any$m;
1677
+ compounds: Any$m;
1678
+ wrap_bodies: Any$m;
1679
+ wrap_constraints: Any$m;
1680
+ wrap_compounds: Any$m;
1681
+ depth: number;
1682
+ compound: Any$m;
1683
+ space: Any$m;
1684
+ __class__: Any$m;
1685
+ constructor();
1686
+ __imutable_midstep(name: string): void;
1687
+ addedToSpace(): void;
1688
+ removedFromSpace(): void;
1689
+ breakApart(): void;
1690
+ private static _zppOf;
1691
+ bodies_adder(x: Any$m): boolean;
1692
+ bodies_subber(x: Any$m): void;
1693
+ bodies_modifiable(): void;
1694
+ constraints_adder(x: Any$m): boolean;
1695
+ constraints_subber(x: Any$m): void;
1696
+ constraints_modifiable(): void;
1697
+ compounds_adder(x: Any$m): boolean;
1698
+ compounds_subber(x: Any$m): void;
1699
+ compounds_modifiable(): void;
1700
+ copy(dict?: Any$m[], todo?: Any$m[]): Any$m;
1701
+ isShape: () => boolean;
1702
+ isBody: () => boolean;
1703
+ isCompound: () => boolean;
1704
+ __iaddedToSpace: () => void;
1705
+ __iremovedFromSpace: () => void;
1706
+ wake: () => void;
1707
+ getSpace: () => Any$m;
1708
+ setupcbTypes: () => void;
1709
+ immutable_cbTypes: () => void;
1710
+ wrap_cbTypes_subber: (pcb: Any$m) => void;
1711
+ wrap_cbTypes_adder: (cb: Any$m) => boolean;
1712
+ insert_cbtype: (cb: Any$m) => void;
1713
+ alloc_cbSet: () => void;
1714
+ dealloc_cbSet: () => void;
1715
+ immutable_midstep: (name: string) => void;
1716
+ copyto: (ret: Any$m) => void;
1717
+ lookup_group: () => Any$m;
1718
+ /**
1719
+ * Initialize prototype by copying ZPP_Interactor methods.
1720
+ * Must be called after _zpp is set (during compiled module init).
1721
+ */
1722
+ static _init(): void;
1723
+ }
1724
+
1725
+ type Any$l = any;
1726
+ /**
1727
+ * A compound physics object — a hierarchical grouping of Bodies, Constraints,
1728
+ * and other Compounds.
1729
+ *
1730
+ * Fully modernized — uses ZPP_Compound directly (extracted to TypeScript).
1731
+ */
1732
+ declare class Compound extends Interactor {
1733
+ static __name__: string[];
1734
+ static __super__: Any$l;
1735
+ /** Direct access to the extracted internal ZPP_Compound. */
1736
+ zpp_inner: ZPP_Compound;
1737
+ constructor();
1738
+ /** @internal */
1739
+ static _wrap(inner: NapeInner): Compound;
1740
+ /** Bodies in this compound. */
1741
+ get bodies(): Any$l;
1742
+ /** Constraints in this compound. */
1743
+ get constraints(): Any$l;
1744
+ /** Child compounds in this compound. */
1745
+ get compounds(): Any$l;
1746
+ /** Parent compound, or null if this is a root compound. */
1747
+ get compound(): Compound | null;
1748
+ set compound(value: Compound | null);
1749
+ /** Space this compound belongs to (only settable on root compounds). */
1750
+ get space(): Space | null;
1751
+ set space(value: Space | null);
1752
+ /** Deep copy of this compound and all its children. */
1753
+ copy(): Compound;
1754
+ /** Distribute all children to the parent compound or space, then remove. */
1755
+ breakApart(): void;
1756
+ /** Recursively visit all bodies in this compound and its sub-compounds. */
1757
+ visitBodies(lambda: (body: Body) => void): void;
1758
+ /** Recursively visit all constraints in this compound and its sub-compounds. */
1759
+ visitConstraints(lambda: (constraint: Any$l) => void): void;
1760
+ /** Recursively visit all sub-compounds in this compound. */
1761
+ visitCompounds(lambda: (compound: Compound) => void): void;
1762
+ /** Calculate the center of mass of all bodies in this compound. */
1763
+ COM(weak?: boolean): Vec2;
1764
+ /** Translate all bodies in this compound by the given vector. */
1765
+ translate(translation: Vec2): Compound;
1766
+ /** Rotate all bodies in this compound around the given centre point. */
1767
+ rotate(centre: Vec2, angle: number): Compound;
1768
+ toString(): string;
1769
+ get_bodies(): Any$l;
1770
+ get_constraints(): Any$l;
1771
+ get_compounds(): Any$l;
1772
+ get_compound(): Any$l;
1773
+ set_compound(compound: Any$l): Any$l;
1774
+ get_space(): Any$l;
1775
+ set_space(space: Any$l): Any$l;
1776
+ }
1777
+
1554
1778
  /**
1555
1779
  * Gravity mass mode for a body.
1556
1780
  *
@@ -1704,6 +1928,197 @@ declare class ArbiterType {
1704
1928
  toString(): string;
1705
1929
  }
1706
1930
 
1931
+ type Any$k = any;
1932
+ /**
1933
+ * Represents an interaction arbiter between two shapes.
1934
+ *
1935
+ * Arbiters are pooled internally by the engine — they cannot be created directly.
1936
+ * Access arbiters via `Space.arbiters`, `Body.arbiters`, or callback handlers.
1937
+ *
1938
+ * Thin wrapper — delegates to compiled ZPP_Arbiter (not yet extracted).
1939
+ */
1940
+ declare class Arbiter {
1941
+ static __name__: string[];
1942
+ /** @internal */
1943
+ zpp_inner: Any$k;
1944
+ /** @internal Backward-compat: compiled code accesses `obj.zpp_inner`. */
1945
+ get _inner(): NapeInner;
1946
+ constructor();
1947
+ /** Whether this arbiter is currently sleeping. */
1948
+ get isSleeping(): boolean;
1949
+ /** The type of this arbiter (COLLISION, SENSOR, or FLUID). */
1950
+ get type(): Any$k;
1951
+ /** Cast to CollisionArbiter if this is a collision, else null. */
1952
+ get collisionArbiter(): Any$k;
1953
+ /** Cast to FluidArbiter if this is a fluid interaction, else null. */
1954
+ get fluidArbiter(): Any$k;
1955
+ /** First shape (lower id). */
1956
+ get shape1(): Any$k;
1957
+ /** Second shape (higher id). */
1958
+ get shape2(): Any$k;
1959
+ /** Body of shape1. */
1960
+ get body1(): Any$k;
1961
+ /** Body of shape2. */
1962
+ get body2(): Any$k;
1963
+ /** The pre-handler state of this arbiter. */
1964
+ get state(): Any$k;
1965
+ /** Whether this is a collision arbiter. */
1966
+ isCollisionArbiter(): boolean;
1967
+ /** Whether this is a fluid arbiter. */
1968
+ isFluidArbiter(): boolean;
1969
+ /** Whether this is a sensor arbiter. */
1970
+ isSensorArbiter(): boolean;
1971
+ /**
1972
+ * Total impulse of this arbiter. Base implementation returns Vec3(0,0,0).
1973
+ * Overridden by CollisionArbiter and FluidArbiter.
1974
+ */
1975
+ totalImpulse(body?: Any$k, freshOnly?: boolean): Vec3;
1976
+ toString(): string;
1977
+ /** @internal */
1978
+ protected _activeCheck(): void;
1979
+ /** @internal */
1980
+ protected _checkBody(body: Any$k): void;
1981
+ }
1982
+
1983
+ type Any$j = any;
1984
+ /**
1985
+ * A collision arbiter between two shapes in contact.
1986
+ *
1987
+ * Provides access to contact points, collision normal, friction, elasticity,
1988
+ * and impulse information. Some properties are mutable only in pre-handlers.
1989
+ *
1990
+ * Thin wrapper — delegates to compiled ZPP_Arbiter/ZPP_ColArbiter (not yet extracted).
1991
+ */
1992
+ declare class CollisionArbiter extends Arbiter {
1993
+ static __name__: string[];
1994
+ static __super__: typeof Arbiter;
1995
+ constructor();
1996
+ /** Contact points for this collision. */
1997
+ get contacts(): Any$j;
1998
+ /** Collision normal vector. */
1999
+ get normal(): Any$j;
2000
+ /** Sum of the radii of the two shapes at the collision point. */
2001
+ get radius(): number;
2002
+ /** Reference edge of shape1 (if polygon), or null. */
2003
+ get referenceEdge1(): Any$j;
2004
+ /** Reference edge of shape2 (if polygon), or null. */
2005
+ get referenceEdge2(): Any$j;
2006
+ /** Coefficient of restitution (elasticity). Mutable in pre-handler only. */
2007
+ get elasticity(): number;
2008
+ set elasticity(value: number);
2009
+ /** Dynamic friction coefficient. Mutable in pre-handler only. */
2010
+ get dynamicFriction(): number;
2011
+ set dynamicFriction(value: number);
2012
+ /** Static friction coefficient. Mutable in pre-handler only. */
2013
+ get staticFriction(): number;
2014
+ set staticFriction(value: number);
2015
+ /** Rolling friction coefficient. Mutable in pre-handler only. */
2016
+ get rollingFriction(): number;
2017
+ set rollingFriction(value: number);
2018
+ /** Whether the first contact point lies on a polygon vertex (poly-circle only). */
2019
+ firstVertex(): boolean;
2020
+ /** Whether the second contact point lies on a polygon vertex (poly-circle only). */
2021
+ secondVertex(): boolean;
2022
+ /** Normal impulse accumulated across all contacts. */
2023
+ normalImpulse(body?: Any$j, freshOnly?: boolean): Vec3;
2024
+ /** Tangent (friction) impulse accumulated across all contacts. */
2025
+ tangentImpulse(body?: Any$j, freshOnly?: boolean): Vec3;
2026
+ /** Total impulse (normal + tangent + rolling) accumulated across all contacts. */
2027
+ totalImpulse(body?: Any$j, freshOnly?: boolean): Vec3;
2028
+ /** Rolling impulse for this collision. */
2029
+ rollingImpulse(body?: Any$j, freshOnly?: boolean): number;
2030
+ /** @internal Recalculate material properties if invalidated. */
2031
+ private _recalcIfInvalidated;
2032
+ /** @internal Throw if not in pre-handler mutable window. */
2033
+ private _mutableCheck;
2034
+ /** @internal Accumulate impulse from contacts. */
2035
+ private _accumulateImpulse;
2036
+ }
2037
+
2038
+ type Any$i = any;
2039
+ /**
2040
+ * A fluid arbiter between two shapes with fluid interaction.
2041
+ *
2042
+ * Provides access to buoyancy/drag impulses, overlap area, and position.
2043
+ * Some properties are mutable only in pre-handlers.
2044
+ *
2045
+ * Thin wrapper — delegates to compiled ZPP_Arbiter/ZPP_FluidArbiter (not yet extracted).
2046
+ */
2047
+ declare class FluidArbiter extends Arbiter {
2048
+ static __name__: string[];
2049
+ static __super__: typeof Arbiter;
2050
+ constructor();
2051
+ /** Centre of the overlap region. Mutable in pre-handler only. */
2052
+ get position(): Vec2;
2053
+ set position(value: Vec2);
2054
+ /** Area of the overlap region. Mutable in pre-handler only. */
2055
+ get overlap(): number;
2056
+ set overlap(value: number);
2057
+ /** Buoyancy impulse applied by this fluid arbiter. */
2058
+ buoyancyImpulse(body?: Any$i): Vec3;
2059
+ /** Drag impulse applied by this fluid arbiter. */
2060
+ dragImpulse(body?: Any$i): Vec3;
2061
+ /** Total impulse (buoyancy + drag). */
2062
+ totalImpulse(body?: Any$i, freshOnly?: boolean): Vec3;
2063
+ }
2064
+
2065
+ type Any$h = any;
2066
+ /**
2067
+ * Represents a contact point between two colliding shapes.
2068
+ *
2069
+ * Contacts are pooled internally by the engine — they cannot be created directly.
2070
+ * Access contacts via `CollisionArbiter.contacts`.
2071
+ *
2072
+ * Thin wrapper — delegates to compiled ZPP_Contact (not yet extracted).
2073
+ */
2074
+ declare class Contact {
2075
+ static __name__: string[];
2076
+ /** @internal */
2077
+ zpp_inner: Any$h;
2078
+ /** @internal Backward-compat: compiled code accesses `obj.zpp_inner`. */
2079
+ get _inner(): NapeInner;
2080
+ constructor();
2081
+ /** The collision arbiter this contact belongs to, or null. */
2082
+ get arbiter(): Any$h;
2083
+ /** Penetration depth of this contact (positive = overlapping). */
2084
+ get penetration(): number;
2085
+ /** World-space position of this contact point. */
2086
+ get position(): Vec2;
2087
+ /** Whether this contact was newly created in the current step. */
2088
+ get fresh(): boolean;
2089
+ /** Friction value for this contact. */
2090
+ get friction(): number;
2091
+ /**
2092
+ * Normal impulse at this contact point.
2093
+ * @param body - If null, returns world-frame impulse. Otherwise returns
2094
+ * impulse on the given body (must be one of the two in contact).
2095
+ */
2096
+ normalImpulse(body?: Any$h): Vec3;
2097
+ /**
2098
+ * Tangent impulse at this contact point.
2099
+ * @param body - If null, returns world-frame impulse. Otherwise returns
2100
+ * impulse on the given body.
2101
+ */
2102
+ tangentImpulse(body?: Any$h): Vec3;
2103
+ /**
2104
+ * Rolling impulse at this contact point.
2105
+ * @param body - If null, returns total rolling impulse. Otherwise returns
2106
+ * rolling impulse on the given body.
2107
+ */
2108
+ rollingImpulse(body?: Any$h): number;
2109
+ /**
2110
+ * Total impulse (normal + tangent + rolling) at this contact point.
2111
+ * @param body - If null, returns world-frame impulse. Otherwise returns
2112
+ * impulse on the given body.
2113
+ */
2114
+ totalImpulse(body?: Any$h): Vec3;
2115
+ toString(): string;
2116
+ /** @internal */
2117
+ private _inactiveCheck;
2118
+ /** @internal */
2119
+ private _checkBody;
2120
+ }
2121
+
1707
2122
  /**
1708
2123
  * ZPP_CbType — Internal callback type for the nape physics engine.
1709
2124
  *
@@ -2347,6 +2762,6 @@ declare class PulleyJoint extends Constraint {
2347
2762
  set ratio(value: number);
2348
2763
  }
2349
2764
 
2350
- declare const VERSION = "3.3.6";
2765
+ declare const VERSION: string;
2351
2766
 
2352
- export { AABB, AngleJoint, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, Circle, Constraint, ConstraintCallback, ConstraintListener, ConvexResult, DistanceJoint, FluidProperties, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding, getNape };
2767
+ export { AABB, AngleJoint, Arbiter, ArbiterType, Body, BodyCallback, BodyListener, BodyType, Broadphase, Callback, CbEvent, CbType, Circle, CollisionArbiter, Compound, Constraint, ConstraintCallback, ConstraintListener, Contact, ConvexResult, DistanceJoint, FluidArbiter, FluidProperties, Geom, GeomPoly, GravMassMode, InertiaMode, InteractionCallback, InteractionFilter, InteractionGroup, InteractionListener, InteractionType, Interactor, LineJoint, Listener, ListenerType, MarchingSquares, MassMode, Mat23, MatMN, Material, MotorJoint, NapeList, OptionType, PivotJoint, Polygon, PreCallback, PreFlag, PreListener, PulleyJoint, Ray, RayResult, Shape, ShapeType, Space, VERSION, ValidationResult, Vec2, Vec3, WeldJoint, Winding, getNape };