@newkrok/nape-js 3.3.43 → 3.3.45

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
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Converted from nape-compiled.js lines 32346–32733.
9
9
  */
10
- type Any$11 = any;
10
+ type Any$17 = any;
11
11
  declare class ZPP_IContact {
12
12
  static __name__: string[];
13
13
  length: number;
@@ -29,7 +29,7 @@ declare class ZPP_IContact {
29
29
  lr1y: number;
30
30
  lr2x: number;
31
31
  lr2y: number;
32
- __class__: Any$11;
32
+ __class__: Any$17;
33
33
  elem(): this;
34
34
  begin(): ZPP_IContact | null;
35
35
  setbegin(i: ZPP_IContact | null): void;
@@ -73,19 +73,19 @@ declare class ZPP_IContact {
73
73
  * Converted from nape-compiled.js lines 31853–32345, 81644–81645.
74
74
  */
75
75
 
76
- type Any$10 = any;
76
+ type Any$16 = any;
77
77
  declare class ZPP_Contact {
78
78
  static __name__: string[];
79
- static _nape: Any$10;
80
- static _zpp: Any$10;
79
+ static _nape: Any$16;
80
+ static _zpp: Any$16;
81
81
  static zpp_pool: ZPP_Contact | null;
82
82
  static internal: boolean;
83
- static _wrapFn: ((zpp: ZPP_Contact) => Any$10) | null;
84
- outer: Any$10;
83
+ static _wrapFn: ((zpp: ZPP_Contact) => Any$16) | null;
84
+ outer: Any$16;
85
85
  px: number;
86
86
  py: number;
87
- wrap_position: Any$10;
88
- arbiter: Any$10;
87
+ wrap_position: Any$16;
88
+ arbiter: Any$16;
89
89
  inner: ZPP_IContact;
90
90
  active: boolean;
91
91
  posOnly: boolean;
@@ -99,9 +99,9 @@ declare class ZPP_Contact {
99
99
  modified: boolean;
100
100
  _inuse: boolean;
101
101
  next: ZPP_Contact | null;
102
- __class__: Any$10;
102
+ __class__: Any$16;
103
103
  constructor();
104
- wrapper(): Any$10;
104
+ wrapper(): Any$16;
105
105
  position_validate(): void;
106
106
  getposition(): void;
107
107
  inactiveme(): boolean;
@@ -166,13 +166,13 @@ declare function getNape(): any;
166
166
  *
167
167
  * Converted from nape-compiled.js lines 83820–84273, 134996.
168
168
  */
169
- type Any$$ = any;
169
+ type Any$15 = any;
170
170
  declare class ZPP_Vec2 {
171
171
  static zpp_pool: ZPP_Vec2 | null;
172
172
  static __name__: string[];
173
- static _nape: Any$$;
174
- static _zpp: Any$$;
175
- static _wrapFn: ((zpp: ZPP_Vec2) => Any$$) | null;
173
+ static _nape: Any$15;
174
+ static _zpp: Any$15;
175
+ static _wrapFn: ((zpp: ZPP_Vec2) => Any$15) | null;
176
176
  x: number;
177
177
  y: number;
178
178
  next: ZPP_Vec2 | null;
@@ -181,18 +181,18 @@ declare class ZPP_Vec2 {
181
181
  pushmod: boolean;
182
182
  _inuse: boolean;
183
183
  weak: boolean;
184
- outer: Any$$;
184
+ outer: Any$15;
185
185
  _immutable: boolean;
186
186
  _isimmutable: (() => void) | null;
187
187
  _validate: (() => void) | null;
188
188
  _invalidate: ((self: ZPP_Vec2) => void) | null;
189
- __class__: Any$$;
189
+ __class__: Any$15;
190
190
  /** Static factory with optional pooling and immutability. */
191
191
  static get(x: number, y: number, immutable?: boolean): ZPP_Vec2;
192
192
  validate(): void;
193
193
  invalidate(): void;
194
194
  immutable(): void;
195
- wrapper(): Any$$;
195
+ wrapper(): Any$15;
196
196
  free(): void;
197
197
  alloc(): void;
198
198
  elem(): ZPP_Vec2;
@@ -344,20 +344,20 @@ type NapeInner = any;
344
344
  *
345
345
  * Converted from nape-compiled.js lines 83412–83434.
346
346
  */
347
- type Any$_ = any;
347
+ type Any$14 = any;
348
348
  declare class ZPP_Vec3 {
349
349
  static __name__: string[];
350
- static _zpp: Any$_;
351
- static _wrapFn: ((zpp: ZPP_Vec3) => Any$_) | null;
352
- outer: Any$_;
350
+ static _zpp: Any$14;
351
+ static _wrapFn: ((zpp: ZPP_Vec3) => Any$14) | null;
352
+ outer: Any$14;
353
353
  x: number;
354
354
  y: number;
355
355
  z: number;
356
356
  immutable: boolean;
357
357
  _validate: (() => void) | null;
358
- __class__: Any$_;
358
+ __class__: Any$14;
359
359
  validate(): void;
360
- wrapper(): Any$_;
360
+ wrapper(): Any$14;
361
361
  }
362
362
 
363
363
  /**
@@ -421,13 +421,13 @@ declare class Vec3 {
421
421
  *
422
422
  * Converted from nape-compiled.js lines 73495–73561, 133826.
423
423
  */
424
- type Any$Z = any;
424
+ type Any$13 = any;
425
425
  declare class ZPP_Mat23 {
426
426
  static __name__: string[];
427
- static _nape: Any$Z;
428
- static _wrapFn: ((zpp: ZPP_Mat23) => Any$Z) | null;
427
+ static _nape: Any$13;
428
+ static _wrapFn: ((zpp: ZPP_Mat23) => Any$13) | null;
429
429
  static zpp_pool: ZPP_Mat23 | null;
430
- outer: Any$Z;
430
+ outer: Any$13;
431
431
  a: number;
432
432
  b: number;
433
433
  c: number;
@@ -436,13 +436,13 @@ declare class ZPP_Mat23 {
436
436
  ty: number;
437
437
  _invalidate: (() => void) | null;
438
438
  next: ZPP_Mat23 | null;
439
- __class__: Any$Z;
439
+ __class__: Any$13;
440
440
  /** Static factory with pooling. */
441
441
  static get(): ZPP_Mat23;
442
442
  /** Create an identity matrix from pool. */
443
443
  static identity(): ZPP_Mat23;
444
444
  /** Create a public wrapper, recycling any existing inner. */
445
- wrapper(): Any$Z;
445
+ wrapper(): Any$13;
446
446
  invalidate(): void;
447
447
  set(m: ZPP_Mat23): void;
448
448
  setas(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
@@ -503,13 +503,13 @@ declare class Mat23 {
503
503
  *
504
504
  * Converted from nape-compiled.js lines 69554–69563.
505
505
  */
506
- type Any$Y = any;
506
+ type Any$12 = any;
507
507
  declare class ZPP_GeomPoly {
508
508
  static __name__: string[];
509
- outer: Any$Y;
510
- vertices: Any$Y;
511
- __class__: Any$Y;
512
- constructor(outer?: Any$Y);
509
+ outer: Any$12;
510
+ vertices: Any$12;
511
+ __class__: Any$12;
512
+ constructor(outer?: Any$12);
513
513
  }
514
514
 
515
515
  /**
@@ -533,7 +533,7 @@ declare class Winding {
533
533
  toString(): string;
534
534
  }
535
535
 
536
- type Any$X = any;
536
+ type Any$11 = any;
537
537
  /**
538
538
  * A polygon represented as a circular doubly-linked list of vertices.
539
539
  *
@@ -548,8 +548,8 @@ declare class GeomPoly {
548
548
  zpp_inner: ZPP_GeomPoly;
549
549
  zpp_pool: GeomPoly | null;
550
550
  zpp_disp: boolean;
551
- get _inner(): Any$X;
552
- constructor(vertices?: Any$X);
551
+ get _inner(): Any$11;
552
+ constructor(vertices?: Any$11);
553
553
  private _checkDisposed;
554
554
  /** @internal Get compiled ZPP_GeomVert class */
555
555
  private static _gvClass;
@@ -575,12 +575,12 @@ declare class GeomPoly {
575
575
  private static _addVertices;
576
576
  /** @internal After copying, dispose weak Vec2 inputs */
577
577
  private static _disposeWeakInputs;
578
- static get(vertices?: Any$X): GeomPoly;
578
+ static get(vertices?: Any$11): GeomPoly;
579
579
  empty(): boolean;
580
580
  size(): number;
581
- iterator(): Any$X;
582
- forwardIterator(): Any$X;
583
- backwardsIterator(): Any$X;
581
+ iterator(): Any$11;
582
+ forwardIterator(): Any$11;
583
+ backwardsIterator(): Any$11;
584
584
  current(): Vec2;
585
585
  push(vertex: Vec2): this;
586
586
  pop(): this;
@@ -593,7 +593,7 @@ declare class GeomPoly {
593
593
  copy(): GeomPoly;
594
594
  dispose(): void;
595
595
  area(): number;
596
- winding(): Any$X;
596
+ winding(): Any$11;
597
597
  contains(point: Vec2): boolean;
598
598
  isClockwise(): boolean;
599
599
  isConvex(): boolean;
@@ -601,14 +601,14 @@ declare class GeomPoly {
601
601
  isMonotone(): boolean;
602
602
  isDegenerate(): boolean;
603
603
  simplify(epsilon: number): GeomPoly;
604
- simpleDecomposition(output?: Any$X): Any$X;
605
- monotoneDecomposition(output?: Any$X): Any$X;
606
- convexDecomposition(delaunay?: boolean, output?: Any$X): Any$X;
607
- triangularDecomposition(delaunay?: boolean, output?: Any$X): Any$X;
604
+ simpleDecomposition(output?: Any$11): Any$11;
605
+ monotoneDecomposition(output?: Any$11): Any$11;
606
+ convexDecomposition(delaunay?: boolean, output?: Any$11): Any$11;
607
+ triangularDecomposition(delaunay?: boolean, output?: Any$11): Any$11;
608
608
  inflate(inflation: number): GeomPoly;
609
- cut(start: Vec2, end: Vec2, boundedStart?: boolean, boundedEnd?: boolean, output?: Any$X): Any$X;
610
- transform(matrix: Any$X): this;
611
- bounds(): Any$X;
609
+ cut(start: Vec2, end: Vec2, boundedStart?: boolean, boundedEnd?: boolean, output?: Any$11): Any$11;
610
+ transform(matrix: Any$11): this;
611
+ bounds(): Any$11;
612
612
  top(): Vec2;
613
613
  bottom(): Vec2;
614
614
  left(): Vec2;
@@ -624,30 +624,30 @@ declare class GeomPoly {
624
624
  *
625
625
  * Converted from nape-compiled.js lines 63546–63965, 134951.
626
626
  */
627
- type Any$W = any;
627
+ type Any$10 = any;
628
628
  declare class ZPP_AABB {
629
629
  static zpp_pool: ZPP_AABB | null;
630
630
  static __name__: string[];
631
- static _nape: Any$W;
632
- static _zpp: Any$W;
633
- static _wrapFn: ((zpp: ZPP_AABB) => Any$W) | null;
631
+ static _nape: Any$10;
632
+ static _zpp: Any$10;
633
+ static _wrapFn: ((zpp: ZPP_AABB) => Any$10) | null;
634
634
  _invalidate: ((self: ZPP_AABB) => void) | null;
635
635
  _validate: (() => void) | null;
636
636
  _immutable: boolean;
637
- outer: Any$W;
637
+ outer: Any$10;
638
638
  next: ZPP_AABB | null;
639
639
  minx: number;
640
640
  miny: number;
641
641
  maxx: number;
642
642
  maxy: number;
643
- wrap_min: Any$W;
644
- wrap_max: Any$W;
645
- __class__: Any$W;
643
+ wrap_min: Any$10;
644
+ wrap_max: Any$10;
645
+ __class__: Any$10;
646
646
  /** Static factory with pooling. */
647
647
  static get(minx: number, miny: number, maxx: number, maxy: number): ZPP_AABB;
648
648
  validate(): void;
649
649
  invalidate(): void;
650
- wrapper(): Any$W;
650
+ wrapper(): Any$10;
651
651
  alloc(): void;
652
652
  free(): void;
653
653
  copy(): ZPP_AABB;
@@ -658,10 +658,10 @@ declare class ZPP_AABB {
658
658
  private static _makeVec2Wrapper;
659
659
  getmin(): void;
660
660
  dom_min(): void;
661
- mod_min(min: Any$W): void;
661
+ mod_min(min: Any$10): void;
662
662
  getmax(): void;
663
663
  dom_max(): void;
664
- mod_max(max: Any$W): void;
664
+ mod_max(max: Any$10): void;
665
665
  intersectX(x: ZPP_AABB): boolean;
666
666
  intersectY(x: ZPP_AABB): boolean;
667
667
  intersect(x: ZPP_AABB): boolean;
@@ -725,18 +725,18 @@ declare class AABB {
725
725
  *
726
726
  * Converted from nape-compiled.js lines 72949–72972.
727
727
  */
728
- type Any$V = any;
728
+ type Any$$ = any;
729
729
  declare class ZPP_MatMN {
730
730
  static __name__: string[];
731
- outer: Any$V;
731
+ outer: Any$$;
732
732
  m: number;
733
733
  n: number;
734
734
  x: number[];
735
- __class__: Any$V;
735
+ __class__: Any$$;
736
736
  constructor(m: number, n: number);
737
737
  }
738
738
 
739
- type Any$U = any;
739
+ type Any$_ = any;
740
740
  /**
741
741
  * Variable-sized M×N matrix.
742
742
  *
@@ -747,7 +747,7 @@ declare class MatMN {
747
747
  zpp_inner: ZPP_MatMN;
748
748
  get _inner(): NapeInner;
749
749
  constructor(rows: number, cols: number);
750
- static _wrap(inner: Any$U): MatMN;
750
+ static _wrap(inner: Any$_): MatMN;
751
751
  get rows(): number;
752
752
  get cols(): number;
753
753
  x(row: number, col: number): number;
@@ -757,7 +757,7 @@ declare class MatMN {
757
757
  mul(matrix: MatMN): MatMN;
758
758
  }
759
759
 
760
- type Any$T = any;
760
+ type Any$Z = any;
761
761
  /**
762
762
  * Isosurface extraction using the marching squares algorithm.
763
763
  *
@@ -780,21 +780,71 @@ declare class MarchingSquares {
780
780
  * @param output - Optional GeomPolyList to populate. If null, a new one is created.
781
781
  * @returns The populated GeomPolyList.
782
782
  */
783
- static run(iso: (x: number, y: number) => number, bounds: AABB, cellsize: Vec2, quality?: number, subgrid?: Vec2 | null, combine?: boolean, output?: Any$T): Any$T;
783
+ static run(iso: (x: number, y: number) => number, bounds: AABB, cellsize: Vec2, quality?: number, subgrid?: Vec2 | null, combine?: boolean, output?: Any$Z): Any$Z;
784
784
  }
785
785
 
786
+ /**
787
+ * ZPP_Ray — Internal ray representation for the nape physics engine.
788
+ *
789
+ * Manages ray origin/direction with invalidation callbacks, plus ray-shape
790
+ * intersection methods (AABB, circle, polygon).
791
+ *
792
+ * Converted from nape-compiled.js lines 31239–33172, 65896.
793
+ */
794
+
795
+ type Any$Y = any;
796
+ declare class ZPP_Ray {
797
+ static __name__: string[];
798
+ static internal: boolean;
799
+ zip_dir: boolean;
800
+ absnormaly: number;
801
+ absnormalx: number;
802
+ normaly: number;
803
+ normalx: number;
804
+ idiry: number;
805
+ idirx: number;
806
+ diry: number;
807
+ dirx: number;
808
+ originy: number;
809
+ originx: number;
810
+ userData: Any$Y;
811
+ maxdist: number;
812
+ direction: Any$Y;
813
+ origin: Any$Y;
814
+ __class__: Any$Y;
815
+ constructor();
816
+ origin_invalidate(x: Any$Y): void;
817
+ direction_invalidate(x: Any$Y): void;
818
+ invalidate_dir(): void;
819
+ validate_dir(): void;
820
+ rayAABB(): ZPP_AABB;
821
+ aabbtest(a: Any$Y): boolean;
822
+ aabbsect(a: Any$Y): number;
823
+ private static _allocVec2;
824
+ private static _validateWorldCOM;
825
+ private _circleNormal;
826
+ private static _insertSorted;
827
+ circlesect(c: Any$Y, inner: boolean, mint: number): Any$Y;
828
+ circlesect2(c: Any$Y, inner: boolean, list: Any$Y): void;
829
+ polysect(p: Any$Y, inner: boolean, mint: number): Any$Y;
830
+ polysect2(p: Any$Y, inner: boolean, list: Any$Y): void;
831
+ }
832
+
833
+ type Any$X = any;
786
834
  /**
787
835
  * A ray for raycasting queries.
788
836
  *
789
- * Thin wrapper around the compiled Ray implementation.
790
- * Full modernization (replacing compiled code) is pending ZPP_Ray extraction.
837
+ * Fully modernized uses ZPP_Ray directly (extracted to TypeScript).
791
838
  */
792
839
  declare class Ray {
793
- /** @internal */
794
- readonly _inner: NapeInner;
840
+ static __name__: string[];
841
+ /** Direct access to the extracted internal ZPP_Ray. */
842
+ zpp_inner: ZPP_Ray;
843
+ /** Backward-compat alias for compiled code. */
844
+ get _inner(): this;
795
845
  constructor(origin: Vec2, direction: Vec2);
796
846
  /** @internal */
797
- static _wrap(inner: NapeInner): Ray;
847
+ static _wrap(inner: Any$X): Ray;
798
848
  static fromSegment(start: Vec2, end: Vec2): Ray;
799
849
  get origin(): Vec2;
800
850
  set origin(value: Vec2);
@@ -806,6 +856,13 @@ declare class Ray {
806
856
  aabb(): AABB;
807
857
  at(distance: number, weak?: boolean): Vec2;
808
858
  copy(): Ray;
859
+ /** @internal */ get_origin(): Vec2;
860
+ /** @internal */ set_origin(v: Vec2): Vec2;
861
+ /** @internal */ get_direction(): Vec2;
862
+ /** @internal */ set_direction(v: Vec2): Vec2;
863
+ /** @internal */ get_maxDistance(): number;
864
+ /** @internal */ set_maxDistance(v: number): number;
865
+ /** @internal */ get_userData(): Any$X;
809
866
  }
810
867
 
811
868
  /**
@@ -816,31 +873,31 @@ declare class Ray {
816
873
  *
817
874
  * Converted from nape-compiled.js lines 38897–39076, 86860–86862.
818
875
  */
819
- type Any$S = any;
876
+ type Any$W = any;
820
877
  declare class ZPP_ConvexRayResult {
821
878
  static __name__: string[];
822
879
  static rayPool: ZPP_ConvexRayResult | null;
823
880
  static convexPool: ZPP_ConvexRayResult | null;
824
881
  static internal: boolean;
825
- static _createRayResult: (() => Any$S) | null;
826
- static _createConvexResult: (() => Any$S) | null;
827
- normal: Any$S;
828
- shape: Any$S;
829
- convex: Any$S;
830
- position: Any$S;
831
- ray: Any$S;
882
+ static _createRayResult: (() => Any$W) | null;
883
+ static _createConvexResult: (() => Any$W) | null;
884
+ normal: Any$W;
885
+ shape: Any$W;
886
+ convex: Any$W;
887
+ position: Any$W;
888
+ ray: Any$W;
832
889
  inner: boolean;
833
890
  next: ZPP_ConvexRayResult | null;
834
891
  toiDistance: number;
835
- __class__: Any$S;
836
- static getRay(normal: Any$S, time: number, inner: boolean, shape: Any$S): Any$S;
837
- static getConvex(normal: Any$S, position: Any$S, toiDistance: number, shape: Any$S): Any$S;
892
+ __class__: Any$W;
893
+ static getRay(normal: Any$W, time: number, inner: boolean, shape: Any$W): Any$W;
894
+ static getConvex(normal: Any$W, position: Any$W, toiDistance: number, shape: Any$W): Any$W;
838
895
  disposed(): void;
839
896
  free(): void;
840
897
  private static _disposeVec2;
841
898
  }
842
899
 
843
- type Any$R = any;
900
+ type Any$V = any;
844
901
  /**
845
902
  * Result from a convex-cast query.
846
903
  *
@@ -855,18 +912,18 @@ declare class ConvexResult {
855
912
  get _inner(): NapeInner;
856
913
  constructor();
857
914
  /** @internal */
858
- static _wrap(inner: Any$R): ConvexResult;
915
+ static _wrap(inner: Any$V): ConvexResult;
859
916
  get normal(): Vec2;
860
917
  get position(): Vec2;
861
918
  get toi(): number;
862
- get shape(): Any$R;
919
+ get shape(): Any$V;
863
920
  dispose(): void;
864
921
  toString(): string;
865
922
  /** @internal */
866
923
  private _disposed;
867
924
  }
868
925
 
869
- type Any$Q = any;
926
+ type Any$U = any;
870
927
  /**
871
928
  * Result from a raycast query.
872
929
  *
@@ -881,68 +938,17 @@ declare class RayResult {
881
938
  get _inner(): NapeInner;
882
939
  constructor();
883
940
  /** @internal */
884
- static _wrap(inner: Any$Q): RayResult;
941
+ static _wrap(inner: Any$U): RayResult;
885
942
  get normal(): Vec2;
886
943
  get distance(): number;
887
944
  get inner(): boolean;
888
- get shape(): Any$Q;
945
+ get shape(): Any$U;
889
946
  dispose(): void;
890
947
  toString(): string;
891
948
  /** @internal */
892
949
  private _disposed;
893
950
  }
894
951
 
895
- type Any$P = any;
896
- /**
897
- * Static utility class for geometric queries between shapes and bodies.
898
- *
899
- * All methods are static. This class cannot be instantiated.
900
- *
901
- * Thin wrapper — delegates to compiled nape.geom.Geom methods.
902
- */
903
- declare class Geom {
904
- static __name__: string[];
905
- /**
906
- * Calculate minimum distance between two bodies and return closest points.
907
- * @param body1 - First body (must have shapes).
908
- * @param body2 - Second body (must have shapes).
909
- * @param out1 - Output Vec2 for closest point on body1.
910
- * @param out2 - Output Vec2 for closest point on body2.
911
- * @returns The distance between the two bodies.
912
- */
913
- static distanceBody(body1: Any$P, body2: Any$P, out1: Vec2, out2: Vec2): number;
914
- /**
915
- * Calculate minimum distance between two shapes and return closest points.
916
- * @param shape1 - First shape (must be part of a body).
917
- * @param shape2 - Second shape (must be part of a body).
918
- * @param out1 - Output Vec2 for closest point on shape1.
919
- * @param out2 - Output Vec2 for closest point on shape2.
920
- * @returns The distance between the two shapes.
921
- */
922
- static distance(shape1: Any$P, shape2: Any$P, out1: Vec2, out2: Vec2): number;
923
- /**
924
- * Test if two bodies intersect (any of their shapes overlap).
925
- * @param body1 - First body (must have shapes).
926
- * @param body2 - Second body (must have shapes).
927
- * @returns True if the bodies intersect.
928
- */
929
- static intersectsBody(body1: Any$P, body2: Any$P): boolean;
930
- /**
931
- * Test if two shapes intersect.
932
- * @param shape1 - First shape (must be part of a body).
933
- * @param shape2 - Second shape (must be part of a body).
934
- * @returns True if the shapes intersect.
935
- */
936
- static intersects(shape1: Any$P, shape2: Any$P): boolean;
937
- /**
938
- * Test if shape1 fully contains shape2.
939
- * @param shape1 - Containing shape (must be part of a body).
940
- * @param shape2 - Contained shape (must be part of a body).
941
- * @returns True if shape1 contains shape2.
942
- */
943
- static contains(shape1: Any$P, shape2: Any$P): boolean;
944
- }
945
-
946
952
  /**
947
953
  * Generic typed wrapper around Haxe list objects (BodyList, ShapeList, etc.).
948
954
  *
@@ -997,186 +1003,170 @@ declare class NapeList<T> implements Iterable<T> {
997
1003
  }
998
1004
 
999
1005
  /**
1000
- * ZPP_Material — Internal material representation for the nape physics engine.
1006
+ * ZPP_Constraint — Internal base class for all constraints / joints.
1001
1007
  *
1002
- * Stores physical material properties (friction, elasticity, density) and
1003
- * manages the list of shapes that reference this material for invalidation.
1008
+ * Manages activation/deactivation, callback types, space integration,
1009
+ * and provides stubs for solver methods overridden by joint subclasses.
1004
1010
  *
1005
- * Converted from nape-compiled.js lines 8752387601, 135477–135481.
1011
+ * Converted from nape-compiled.js lines 2142421827.
1006
1012
  */
1007
- type Any$O = any;
1008
- declare class ZPP_Material {
1009
- static zpp_pool: ZPP_Material | null;
1010
- static WAKE: number;
1011
- static PROPS: number;
1012
- static ANGDRAG: number;
1013
- static ARBITERS: number;
1013
+ type Any$T = any;
1014
+ declare class ZPP_Constraint {
1014
1015
  static __name__: string[];
1015
1016
  /**
1016
1017
  * Namespace references, set by the compiled module after import.
1017
- * _nape = the `nape` public namespace (for wrapper creation)
1018
- * _zpp = the `zpp_nape` internal namespace (for ZNPList_ZPP_Shape)
1018
+ * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
1019
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
1019
1020
  */
1020
- static _nape: Any$O;
1021
- static _zpp: Any$O;
1021
+ static _nape: Any$T;
1022
+ static _zpp: Any$T;
1023
+ outer: Any$T;
1024
+ id: number;
1025
+ userData: Any$T;
1026
+ compound: Any$T;
1027
+ space: Any$T;
1028
+ active: boolean;
1029
+ stiff: boolean;
1030
+ frequency: number;
1031
+ damping: number;
1032
+ maxForce: number;
1033
+ maxError: number;
1034
+ breakUnderForce: boolean;
1035
+ breakUnderError: boolean;
1036
+ removeOnBreak: boolean;
1037
+ component: Any$T;
1038
+ ignore: boolean;
1039
+ __velocity: boolean;
1040
+ cbTypes: Any$T;
1041
+ cbSet: Any$T;
1042
+ wrap_cbTypes: Any$T;
1043
+ pre_dt: number;
1044
+ __class__: Any$T;
1045
+ constructor();
1022
1046
  /**
1023
- * Wrapper factory callback, registered by the modernized Material class.
1024
- * When set, wrapper() uses this instead of creating a compiled Material.
1047
+ * Initialise base constraint fields.
1048
+ * Extracted into a separate method because compiled joint subclasses
1049
+ * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
1050
+ * way, so the compiled wrapper delegates to this method instead.
1025
1051
  */
1026
- static _wrapFn: ((zpp: ZPP_Material) => Any$O) | null;
1027
- elasticity: number;
1028
- dynamicFriction: number;
1029
- staticFriction: number;
1030
- density: number;
1031
- rollingFriction: number;
1032
- shapes: Any$O;
1033
- wrap_shapes: Any$O;
1034
- outer: Any$O;
1035
- userData: Any$O;
1036
- next: ZPP_Material | null;
1037
- __class__: Any$O;
1038
- constructor();
1039
- /** Create/return the public nape.phys.Material wrapper for this internal object. */
1040
- wrapper(): Any$O;
1041
- /** Called when this object is returned to the pool. */
1042
- free(): void;
1043
- /** Called when this object is taken from the pool. */
1044
- alloc(): void;
1045
- /** Initialize the shapes list (called during feature construction). */
1046
- feature_cons(): void;
1047
- /** Register a shape that uses this material. */
1048
- addShape(shape: Any$O): void;
1049
- /** Unregister a shape that no longer uses this material. */
1050
- remShape(shape: Any$O): void;
1051
- /** Create a copy with the same property values. */
1052
- copy(): ZPP_Material;
1053
- /** Copy all property values from another ZPP_Material. */
1054
- set(x: ZPP_Material): void;
1055
- /** Notify all shapes using this material that properties changed. */
1056
- invalidate(x: number): void;
1052
+ _initBase(): void;
1053
+ clear(): void;
1054
+ activeBodies(): void;
1055
+ inactiveBodies(): void;
1056
+ clearcache(): void;
1057
+ validate(): void;
1058
+ wake_connected(): void;
1059
+ forest(): void;
1060
+ broken(): void;
1061
+ warmStart(): void;
1062
+ draw(_g: Any$T): void;
1063
+ pair_exists(_id: Any$T, _di: Any$T): boolean;
1064
+ preStep(_dt: number): boolean;
1065
+ applyImpulseVel(): boolean;
1066
+ applyImpulsePos(): boolean;
1067
+ copy(_dict?: Any$T, _todo?: Any$T): Any$T;
1068
+ immutable_midstep(name: string): void;
1069
+ setupcbTypes(): void;
1070
+ immutable_cbTypes(): void;
1071
+ wrap_cbTypes_subber(pcb: Any$T): void;
1072
+ wrap_cbTypes_adder(cb: Any$T): boolean;
1073
+ insert_cbtype(cb: Any$T): void;
1074
+ alloc_cbSet(): void;
1075
+ dealloc_cbSet(): void;
1076
+ activate(): void;
1077
+ deactivate(): void;
1078
+ addedToSpace(): void;
1079
+ removedFromSpace(): void;
1080
+ activeInSpace(): void;
1081
+ inactiveOrOutSpace(): void;
1082
+ wake(): void;
1083
+ copyto(ret: Any$T): void;
1084
+ static _findRoot(comp: Any$T): Any$T;
1085
+ static _unionComponents(a: Any$T, b: Any$T): void;
1057
1086
  }
1058
1087
 
1088
+ type Any$S = any;
1059
1089
  /**
1060
- * Physical material properties applied to shapes.
1061
- *
1062
- * Controls elasticity (bounciness), friction coefficients, density, and
1063
- * rolling friction. Internally wraps a ZPP_Material and is registered as
1064
- * the public `nape.phys.Material` class in the compiled namespace.
1090
+ * Base class for all constraints / joints.
1065
1091
  *
1066
- * Converted from nape-compiled.js lines 38254–38573.
1092
+ * Fully modernized uses ZPP_Constraint directly (extracted to TypeScript).
1093
+ * Not instantiated directly; only via joint subclasses.
1067
1094
  */
1068
- declare class Material {
1095
+ declare class Constraint {
1069
1096
  static __name__: string[];
1070
- /** @internal The internal ZPP_Material this wrapper owns. */
1071
- zpp_inner: ZPP_Material;
1097
+ /** Direct access to the extracted internal ZPP_Constraint. */
1098
+ zpp_inner: ZPP_Constraint;
1072
1099
  /**
1073
- * Backward-compatible accessor returns `this` so that compiled engine
1074
- * code that receives `material._inner` can still access `zpp_inner`.
1100
+ * Compiled joint reference for joint-specific methods (body1/body2/anchors etc.).
1101
+ * Joint subclasses set this to the compiled joint instance until those joints
1102
+ * are fully modernized. Also serves as backward compat for compiled code.
1075
1103
  * @internal
1076
1104
  */
1077
- get _inner(): NapeInner;
1078
- constructor(elasticity?: number, dynamicFriction?: number, staticFriction?: number, density?: number, rollingFriction?: number);
1079
- /** @internal Wrap a ZPP_Material (or legacy compiled Material) with caching. */
1080
- static _wrap(inner: any): Material;
1081
- get elasticity(): number;
1082
- set elasticity(value: number);
1083
- get dynamicFriction(): number;
1084
- set dynamicFriction(value: number);
1085
- get staticFriction(): number;
1086
- set staticFriction(value: number);
1087
- get density(): number;
1088
- set density(value: number);
1089
- get rollingFriction(): number;
1090
- set rollingFriction(value: number);
1105
+ _inner: Any$S;
1106
+ debugDraw: boolean;
1107
+ /** @internal */
1108
+ protected constructor();
1109
+ /** @internal */
1110
+ static _wrap(inner: Any$S): Constraint;
1111
+ get space(): Space | null;
1112
+ set space(value: Space | null);
1113
+ get compound(): Any$S;
1114
+ set compound(value: Any$S);
1115
+ get active(): boolean;
1116
+ set active(value: boolean);
1117
+ get ignore(): boolean;
1118
+ set ignore(value: boolean);
1119
+ get stiff(): boolean;
1120
+ set stiff(value: boolean);
1121
+ get frequency(): number;
1122
+ set frequency(value: number);
1123
+ get damping(): number;
1124
+ set damping(value: number);
1125
+ get maxForce(): number;
1126
+ set maxForce(value: number);
1127
+ get maxError(): number;
1128
+ set maxError(value: number);
1129
+ get breakUnderForce(): boolean;
1130
+ set breakUnderForce(value: boolean);
1131
+ get breakUnderError(): boolean;
1132
+ set breakUnderError(value: boolean);
1133
+ get removeOnBreak(): boolean;
1134
+ set removeOnBreak(value: boolean);
1135
+ get isSleeping(): boolean;
1091
1136
  get userData(): Record<string, unknown>;
1092
- copy(): Material;
1093
- toString(): string;
1094
- static wood(): Material;
1095
- static steel(): Material;
1096
- static ice(): Material;
1097
- static rubber(): Material;
1098
- static glass(): Material;
1099
- static sand(): Material;
1100
- }
1101
-
1102
- /**
1103
- * ZPP_FluidProperties — Internal fluid properties for the nape physics engine.
1104
- *
1105
- * Stores density, viscosity, and per-fluid gravity override.
1106
- * Manages the list of shapes that reference these properties for invalidation.
1107
- *
1108
- * Converted from nape-compiled.js lines 87335–87523, 135403.
1109
- */
1110
- type Any$N = any;
1111
- declare class ZPP_FluidProperties {
1112
- static zpp_pool: ZPP_FluidProperties | null;
1113
- static __name__: string[];
1114
- static _nape: Any$N;
1115
- static _zpp: Any$N;
1116
- static _wrapFn: ((zpp: ZPP_FluidProperties) => Any$N) | null;
1117
- viscosity: number;
1118
- density: number;
1119
- gravityx: number;
1120
- gravityy: number;
1121
- wrap_gravity: Any$N;
1122
- shapes: Any$N;
1123
- wrap_shapes: Any$N;
1124
- outer: Any$N;
1125
- userData: Any$N;
1126
- next: ZPP_FluidProperties | null;
1127
- __class__: Any$N;
1128
- constructor();
1129
- /** Create/return the public nape.phys.FluidProperties wrapper. */
1130
- wrapper(): Any$N;
1131
- free(): void;
1132
- alloc(): void;
1133
- feature_cons(): void;
1134
- addShape(shape: Any$N): void;
1135
- remShape(shape: Any$N): void;
1136
- /** Copy with object pooling. */
1137
- copy(): ZPP_FluidProperties;
1138
- /** Called when gravity Vec2 wrapper is invalidated (user set new gravity). */
1139
- gravity_invalidate(x: Any$N): void;
1140
- /** Sync the gravity Vec2 wrapper with internal values. */
1141
- gravity_validate(): void;
1142
- /** Lazily create and return the gravity Vec2 wrapper. */
1143
- getgravity(): void;
1144
- /** Notify all shapes that fluid properties changed. */
1145
- invalidate(): void;
1146
- }
1147
-
1148
- /**
1149
- * Fluid properties for shapes that act as fluid regions.
1150
- *
1151
- * Controls density, viscosity, and per-fluid gravity override.
1152
- * Internally wraps a ZPP_FluidProperties and is registered as
1153
- * the public `nape.phys.FluidProperties` class in the compiled namespace.
1154
- *
1155
- * Converted from nape-compiled.js lines 37002–37511.
1156
- */
1157
- declare class FluidProperties {
1158
- static __name__: string[];
1159
- /** @internal The internal ZPP_FluidProperties this wrapper owns. */
1160
- zpp_inner: ZPP_FluidProperties;
1161
- /**
1162
- * Backward-compatible accessor — returns `this` so that compiled engine
1163
- * code that receives `fluidProps._inner` can still access `zpp_inner`.
1164
- * @internal
1165
- */
1166
- get _inner(): NapeInner;
1167
- constructor(density?: number, viscosity?: number);
1168
- /** @internal Wrap a ZPP_FluidProperties (or legacy compiled FluidProperties) with caching. */
1169
- static _wrap(inner: any): FluidProperties;
1170
- get density(): number;
1171
- set density(value: number);
1172
- get viscosity(): number;
1173
- set viscosity(value: number);
1174
- get gravity(): any;
1175
- set gravity(gravity: any);
1176
- get userData(): Record<string, unknown>;
1177
- get shapes(): any;
1178
- copy(): FluidProperties;
1137
+ get cbTypes(): Any$S;
1138
+ impulse(): Any$S;
1139
+ bodyImpulse(_body: Body): Any$S;
1140
+ visitBodies(_fn: (body: Body) => void): void;
1141
+ copy(): Constraint;
1179
1142
  toString(): string;
1143
+ /** @internal */ get_userData(): Any$S;
1144
+ /** @internal */ get_compound(): Any$S;
1145
+ /** @internal */ set_compound(v: Any$S): Any$S;
1146
+ /** @internal */ get_space(): Any$S;
1147
+ /** @internal */ set_space(v: Any$S): Any$S;
1148
+ /** @internal */ get_isSleeping(): boolean;
1149
+ /** @internal */ get_active(): boolean;
1150
+ /** @internal */ set_active(v: boolean): boolean;
1151
+ /** @internal */ get_ignore(): boolean;
1152
+ /** @internal */ set_ignore(v: boolean): boolean;
1153
+ /** @internal */ get_stiff(): boolean;
1154
+ /** @internal */ set_stiff(v: boolean): boolean;
1155
+ /** @internal */ get_frequency(): number;
1156
+ /** @internal */ set_frequency(v: number): number;
1157
+ /** @internal */ get_damping(): number;
1158
+ /** @internal */ set_damping(v: number): number;
1159
+ /** @internal */ get_maxForce(): number;
1160
+ /** @internal */ set_maxForce(v: number): number;
1161
+ /** @internal */ get_maxError(): number;
1162
+ /** @internal */ set_maxError(v: number): number;
1163
+ /** @internal */ get_breakUnderForce(): boolean;
1164
+ /** @internal */ set_breakUnderForce(v: boolean): boolean;
1165
+ /** @internal */ get_breakUnderError(): boolean;
1166
+ /** @internal */ set_breakUnderError(v: boolean): boolean;
1167
+ /** @internal */ get_removeOnBreak(): boolean;
1168
+ /** @internal */ set_removeOnBreak(v: boolean): boolean;
1169
+ /** @internal */ get_cbTypes(): Any$S;
1180
1170
  }
1181
1171
 
1182
1172
  /**
@@ -1187,33 +1177,33 @@ declare class FluidProperties {
1187
1177
  *
1188
1178
  * Converted from nape-compiled.js lines 63255–63366, 135329.
1189
1179
  */
1190
- type Any$M = any;
1180
+ type Any$R = any;
1191
1181
  declare class ZPP_InteractionFilter {
1192
1182
  static zpp_pool: ZPP_InteractionFilter | null;
1193
1183
  static __name__: string[];
1194
- static _nape: Any$M;
1195
- static _zpp: Any$M;
1196
- static _wrapFn: ((zpp: ZPP_InteractionFilter) => Any$M) | null;
1184
+ static _nape: Any$R;
1185
+ static _zpp: Any$R;
1186
+ static _wrapFn: ((zpp: ZPP_InteractionFilter) => Any$R) | null;
1197
1187
  collisionGroup: number;
1198
1188
  collisionMask: number;
1199
1189
  sensorGroup: number;
1200
1190
  sensorMask: number;
1201
1191
  fluidGroup: number;
1202
1192
  fluidMask: number;
1203
- shapes: Any$M;
1204
- wrap_shapes: Any$M;
1205
- outer: Any$M;
1206
- userData: Any$M;
1193
+ shapes: Any$R;
1194
+ wrap_shapes: Any$R;
1195
+ outer: Any$R;
1196
+ userData: Any$R;
1207
1197
  next: ZPP_InteractionFilter | null;
1208
- __class__: Any$M;
1198
+ __class__: Any$R;
1209
1199
  constructor();
1210
1200
  /** Create/return the public nape.dynamics.InteractionFilter wrapper. */
1211
- wrapper(): Any$M;
1201
+ wrapper(): Any$R;
1212
1202
  free(): void;
1213
1203
  alloc(): void;
1214
1204
  feature_cons(): void;
1215
- addShape(shape: Any$M): void;
1216
- remShape(shape: Any$M): void;
1205
+ addShape(shape: Any$R): void;
1206
+ remShape(shape: Any$R): void;
1217
1207
  /** Create a copy with object pooling. */
1218
1208
  copy(): ZPP_InteractionFilter;
1219
1209
  /** Test whether two filters allow collision between their shapes. */
@@ -1269,6 +1259,298 @@ declare class InteractionFilter {
1269
1259
  toString(): string;
1270
1260
  }
1271
1261
 
1262
+ /**
1263
+ * ZPP_Callback — Internal callback data holder for the nape physics engine.
1264
+ *
1265
+ * Stores callback event information (listener, event type, interactors, etc.)
1266
+ * and forms a doubly-linked list for callback queue management.
1267
+ *
1268
+ * Converted from nape-compiled.js lines 44587–44794, 133299–133300.
1269
+ */
1270
+ type Any$Q = any;
1271
+ declare class ZPP_Callback {
1272
+ static __name__: string[];
1273
+ static _nape: Any$Q;
1274
+ static _zpp: Any$Q;
1275
+ static internal: boolean;
1276
+ static zpp_pool: ZPP_Callback | null;
1277
+ outer_body: Any$Q;
1278
+ outer_con: Any$Q;
1279
+ outer_int: Any$Q;
1280
+ event: number;
1281
+ listener: Any$Q;
1282
+ space: Any$Q;
1283
+ index: number;
1284
+ next: ZPP_Callback | null;
1285
+ prev: ZPP_Callback | null;
1286
+ length: number;
1287
+ int1: Any$Q;
1288
+ int2: Any$Q;
1289
+ set: Any$Q;
1290
+ wrap_arbiters: Any$Q;
1291
+ pre_arbiter: Any$Q;
1292
+ pre_swapped: boolean;
1293
+ body: Any$Q;
1294
+ constraint: Any$Q;
1295
+ __class__: Any$Q;
1296
+ wrapper_body(): Any$Q;
1297
+ wrapper_con(): Any$Q;
1298
+ wrapper_int(): Any$Q;
1299
+ push(obj: ZPP_Callback): void;
1300
+ push_rev(obj: ZPP_Callback): void;
1301
+ pop(): ZPP_Callback;
1302
+ pop_rev(): ZPP_Callback;
1303
+ empty(): boolean;
1304
+ clear(): void;
1305
+ splice(o: ZPP_Callback): ZPP_Callback | null;
1306
+ rotateL(): void;
1307
+ rotateR(): void;
1308
+ cycleNext(o: ZPP_Callback): ZPP_Callback | null;
1309
+ cyclePrev(o: ZPP_Callback): ZPP_Callback | null;
1310
+ at(i: number): ZPP_Callback;
1311
+ rev_at(i: number): ZPP_Callback;
1312
+ free(): void;
1313
+ alloc(): void;
1314
+ genarbs(): void;
1315
+ }
1316
+
1317
+ /**
1318
+ * ZPP_Space -- Internal space implementation (core simulation loop).
1319
+ * Converted from nape-compiled.js lines 30236-43690.
1320
+ *
1321
+ * This is the largest and most complex class in the engine (~13,450 lines).
1322
+ * It handles integration, constraint solving, broadphase management,
1323
+ * sleeping/waking, and callback dispatch.
1324
+ */
1325
+
1326
+ type Any$P = any;
1327
+ declare class ZPP_Space {
1328
+ static __name__: string[];
1329
+ static _zpp: Any$P;
1330
+ static _nape: Any$P;
1331
+ outer: Any$P;
1332
+ userData: Any$P;
1333
+ gravityx: Any$P;
1334
+ gravityy: Any$P;
1335
+ wrap_gravity: Any$P;
1336
+ bodies: Any$P;
1337
+ wrap_bodies: Any$P;
1338
+ compounds: Any$P;
1339
+ wrap_compounds: Any$P;
1340
+ constraints: Any$P;
1341
+ wrap_constraints: Any$P;
1342
+ kinematics: Any$P;
1343
+ bphase: Any$P;
1344
+ __static: Any$P;
1345
+ global_lin_drag: Any$P;
1346
+ global_ang_drag: Any$P;
1347
+ stamp: Any$P;
1348
+ midstep: Any$P;
1349
+ time: Any$P;
1350
+ sortcontacts: Any$P;
1351
+ c_arbiters_true: Any$P;
1352
+ c_arbiters_false: Any$P;
1353
+ f_arbiters: Any$P;
1354
+ s_arbiters: Any$P;
1355
+ wrap_arbiters: Any$P;
1356
+ live: Any$P;
1357
+ wrap_live: Any$P;
1358
+ live_constraints: Any$P;
1359
+ wrap_livecon: Any$P;
1360
+ staticsleep: Any$P;
1361
+ islands: Any$P;
1362
+ listeners: Any$P;
1363
+ wrap_listeners: Any$P;
1364
+ callbacks: Any$P;
1365
+ callbackset_list: Any$P;
1366
+ cbsets: Any$P;
1367
+ convexShapeList: Any$P;
1368
+ pre_dt: Any$P;
1369
+ toiEvents: Any$P;
1370
+ continuous: Any$P;
1371
+ precb: Any$P;
1372
+ prelisteners: Any$P;
1373
+ mrca1: Any$P;
1374
+ mrca2: Any$P;
1375
+ __class__: Any$P;
1376
+ constructor(gravity?: Any$P, broadphase?: Any$P);
1377
+ getgravity(): void;
1378
+ gravity_invalidate(x: Any$P): void;
1379
+ gravity_validate(): void;
1380
+ clear(): void;
1381
+ bodies_adder(x: Any$P): boolean;
1382
+ bodies_subber(x: Any$P): void;
1383
+ bodies_modifiable(): void;
1384
+ compounds_adder(x: Any$P): boolean;
1385
+ compounds_subber(x: Any$P): void;
1386
+ compounds_modifiable(): void;
1387
+ constraints_adder(x: Any$P): boolean;
1388
+ constraints_subber(x: Any$P): void;
1389
+ constraints_modifiable(): void;
1390
+ listeners_adder(x: Any$P): boolean;
1391
+ listeners_subber(x: Any$P): void;
1392
+ listeners_modifiable(): void;
1393
+ revoke_listener(x: Any$P): void;
1394
+ unrevoke_listener(x: Any$P): void;
1395
+ addListener(x: Any$P): void;
1396
+ remListener(x: Any$P): void;
1397
+ add_callbackset(cb: Any$P): void;
1398
+ remove_callbackset(cb: Any$P): void;
1399
+ transmitType(p: Any$P, new_type: Any$P): void;
1400
+ added_shape(s: Any$P, dontwake: Any$P): void;
1401
+ removed_shape(s: Any$P, deleting: Any$P): void;
1402
+ addConstraint(con: Any$P): void;
1403
+ remConstraint(con: Any$P): void;
1404
+ addCompound(x: Any$P): void;
1405
+ remCompound(x: Any$P): void;
1406
+ addBody(body: Any$P, flag?: Any$P): void;
1407
+ remBody(body: Any$P, flag?: Any$P): void;
1408
+ shapesUnderPoint(x: Any$P, y: Any$P, filter: Any$P, output: Any$P): any;
1409
+ bodiesUnderPoint(x: Any$P, y: Any$P, filter: Any$P, output: Any$P): any;
1410
+ shapesInAABB(aabb: Any$P, strict: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1411
+ bodiesInAABB(aabb: Any$P, strict: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1412
+ shapesInCircle(pos: Any$P, rad: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1413
+ bodiesInCircle(pos: Any$P, rad: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1414
+ shapesInShape(shape: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1415
+ bodiesInShape(shape: Any$P, cont: Any$P, filter: Any$P, output: Any$P): any;
1416
+ rayCast(ray: Any$P, inner: Any$P, filter: Any$P): any;
1417
+ rayMultiCast(ray: Any$P, inner: Any$P, filter: Any$P, output: Any$P): any;
1418
+ convexCast(shape: Any$P, deltaTime: Any$P, filter: Any$P, dynamics: Any$P): any;
1419
+ prepareCast(s: Any$P): void;
1420
+ convexMultiCast(shape: Any$P, deltaTime: Any$P, filter: Any$P, dynamics: Any$P, output: Any$P): any;
1421
+ push_callback(i: Any$P): ZPP_Callback;
1422
+ step(deltaTime: Any$P, velocityIterations: Any$P, positionIterations: Any$P): void;
1423
+ continuousCollisions(deltaTime: Any$P): void;
1424
+ continuousEvent(s1: Any$P, s2: Any$P, stat: Any$P, in_arb: Any$P, _: Any$P): any;
1425
+ bodyCbWake(b: Any$P): void;
1426
+ bodyCbSleep(b: Any$P): void;
1427
+ constraintCbWake(con: Any$P): void;
1428
+ constraintCbSleep(con: Any$P): void;
1429
+ constraintCbBreak(con: Any$P): void;
1430
+ nullListenerType(cb1: Any$P, cb2: Any$P): void;
1431
+ nullInteractorType(intx: Any$P, me: Any$P): void;
1432
+ freshListenerType(cb1: Any$P, cb2: Any$P): void;
1433
+ freshInteractorType(intx: Any$P, me: Any$P): void;
1434
+ wakeCompound(x: Any$P): void;
1435
+ wakeIsland(i: Any$P): void;
1436
+ non_inlined_wake(o: Any$P, fst?: Any$P): void;
1437
+ really_wake(o: Any$P, fst?: Any$P): void;
1438
+ wake_constraint(con: Any$P, fst?: Any$P): boolean;
1439
+ doForests(dt: Any$P): void;
1440
+ sleepArbiters(): void;
1441
+ static_validation(body: Any$P): void;
1442
+ validation(): void;
1443
+ updateVel(dt: Any$P): void;
1444
+ updatePos(dt: Any$P): void;
1445
+ presteparb(arb: Any$P, dt: Any$P, cont?: Any$P): boolean;
1446
+ prestep(dt: Any$P): void;
1447
+ warmStart(): void;
1448
+ iterateVel(times: Any$P): void;
1449
+ iteratePos(times: Any$P): void;
1450
+ group_ignore(s1: Any$P, s2: Any$P): boolean;
1451
+ interactionType(s1: Any$P, s2: Any$P, b1: Any$P, b2: Any$P): 0 | 1 | 2 | -1;
1452
+ narrowPhase(s1: Any$P, s2: Any$P, stat: Any$P, in_arb: Any$P, continuous: Any$P): any;
1453
+ MRCA_chains(s1: Any$P, s2: Any$P): void;
1454
+ inlined_MRCA_chains(s1: Any$P, s2: Any$P): void;
1455
+ }
1456
+
1457
+ type Any$O = any;
1458
+ /**
1459
+ * The physics world. Add bodies and constraints, then call `step()` each frame.
1460
+ *
1461
+ * Fully modernized — uses ZPP_Space directly (extracted to TypeScript).
1462
+ */
1463
+ declare class Space {
1464
+ zpp_inner: ZPP_Space;
1465
+ constructor(gravity?: Vec2, broadphase?: Any$O);
1466
+ /** @internal */
1467
+ get _inner(): Any$O;
1468
+ /** @internal */
1469
+ static _wrap(inner: NapeInner): Space;
1470
+ get userData(): Record<string, unknown>;
1471
+ get gravity(): Vec2;
1472
+ set gravity(value: Vec2);
1473
+ get broadphase(): Any$O;
1474
+ get sortContacts(): boolean;
1475
+ set sortContacts(value: boolean);
1476
+ get worldAngularDrag(): number;
1477
+ set worldAngularDrag(value: number);
1478
+ get worldLinearDrag(): number;
1479
+ set worldLinearDrag(value: number);
1480
+ get compounds(): Any$O;
1481
+ get bodies(): Any$O;
1482
+ get liveBodies(): Any$O;
1483
+ get constraints(): Any$O;
1484
+ get liveConstraints(): Any$O;
1485
+ get world(): Body;
1486
+ get arbiters(): Any$O;
1487
+ get listeners(): Any$O;
1488
+ get timeStamp(): number;
1489
+ get elapsedTime(): number;
1490
+ step(deltaTime: number, velocityIterations?: number, positionIterations?: number): void;
1491
+ clear(): void;
1492
+ visitBodies(lambda: (body: Body) => void): void;
1493
+ visitConstraints(lambda: (constraint: Constraint) => void): void;
1494
+ visitCompounds(lambda: (compound: Any$O) => void): void;
1495
+ interactionType(shape1: Shape, shape2: Shape): Any$O;
1496
+ shapesUnderPoint(point: Vec2, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1497
+ bodiesUnderPoint(point: Vec2, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1498
+ shapesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1499
+ bodiesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1500
+ shapesInCircle(position: Vec2, radius: number, containment?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1501
+ bodiesInCircle(position: Vec2, radius: number, containment?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1502
+ shapesInShape(shape: Shape, containment?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1503
+ bodiesInShape(shape: Shape, containment?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1504
+ shapesInBody(body: Body, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1505
+ bodiesInBody(body: Body, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1506
+ convexCast(shape: Shape, deltaTime: number, liveSweep?: boolean, filter?: InteractionFilter | Any$O): Any$O;
1507
+ convexMultiCast(shape: Shape, deltaTime: number, liveSweep?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1508
+ rayCast(ray: Ray | Any$O, inner?: boolean, filter?: InteractionFilter | Any$O): Any$O;
1509
+ rayMultiCast(ray: Ray | Any$O, inner?: boolean, filter?: InteractionFilter | Any$O, output?: Any$O): Any$O;
1510
+ toString(): string;
1511
+ /** @internal */ get_userData(): Any$O;
1512
+ /** @internal */ get_gravity(): Any$O;
1513
+ /** @internal */ set_gravity(v: Any$O): Any$O;
1514
+ /** @internal */ get_broadphase(): Any$O;
1515
+ /** @internal */ get_sortContacts(): boolean;
1516
+ /** @internal */ set_sortContacts(v: boolean): boolean;
1517
+ /** @internal */ get_worldAngularDrag(): number;
1518
+ /** @internal */ set_worldAngularDrag(v: number): number;
1519
+ /** @internal */ get_worldLinearDrag(): number;
1520
+ /** @internal */ set_worldLinearDrag(v: number): number;
1521
+ /** @internal */ get_compounds(): Any$O;
1522
+ /** @internal */ get_bodies(): Any$O;
1523
+ /** @internal */ get_liveBodies(): Any$O;
1524
+ /** @internal */ get_constraints(): Any$O;
1525
+ /** @internal */ get_liveConstraints(): Any$O;
1526
+ /** @internal */ get_world(): Any$O;
1527
+ /** @internal */ get_arbiters(): Any$O;
1528
+ /** @internal */ get_listeners(): Any$O;
1529
+ /** @internal */ get_timeStamp(): number;
1530
+ /** @internal */ get_elapsedTime(): number;
1531
+ }
1532
+
1533
+ /**
1534
+ * Body type enumeration.
1535
+ *
1536
+ * - `STATIC` — immovable, infinite mass (walls, floors)
1537
+ * - `DYNAMIC` — fully simulated (default)
1538
+ * - `KINEMATIC` — moves only via velocity, not affected by forces
1539
+ *
1540
+ * Converted from nape-compiled.js lines 24640–24705.
1541
+ */
1542
+ declare class BodyType {
1543
+ static __name__: string[];
1544
+ constructor();
1545
+ static get STATIC(): BodyType;
1546
+ static get DYNAMIC(): BodyType;
1547
+ static get KINEMATIC(): BodyType;
1548
+ static get_STATIC(): BodyType;
1549
+ static get_DYNAMIC(): BodyType;
1550
+ static get_KINEMATIC(): BodyType;
1551
+ toString(): string;
1552
+ }
1553
+
1272
1554
  /**
1273
1555
  * ZPP_InteractionGroup — Internal interaction group for the nape physics engine.
1274
1556
  *
@@ -1277,22 +1559,22 @@ declare class InteractionFilter {
1277
1559
  *
1278
1560
  * Converted from nape-compiled.js lines 63367–63463, 135330–135331.
1279
1561
  */
1280
- type Any$L = any;
1562
+ type Any$N = any;
1281
1563
  declare class ZPP_InteractionGroup {
1282
1564
  static SHAPE: number;
1283
1565
  static BODY: number;
1284
1566
  static __name__: string[];
1285
- static _zpp: Any$L;
1286
- static _wrapFn: ((zpp: ZPP_InteractionGroup) => Any$L) | null;
1287
- outer: Any$L;
1567
+ static _zpp: Any$N;
1568
+ static _wrapFn: ((zpp: ZPP_InteractionGroup) => Any$N) | null;
1569
+ outer: Any$N;
1288
1570
  ignore: boolean;
1289
1571
  group: ZPP_InteractionGroup | null;
1290
- groups: Any$L;
1291
- wrap_groups: Any$L;
1292
- interactors: Any$L;
1293
- wrap_interactors: Any$L;
1572
+ groups: Any$N;
1573
+ wrap_groups: Any$N;
1574
+ interactors: Any$N;
1575
+ wrap_interactors: Any$N;
1294
1576
  depth: number;
1295
- __class__: Any$L;
1577
+ __class__: Any$N;
1296
1578
  constructor();
1297
1579
  /** Set or change the parent group. */
1298
1580
  setGroup(group: ZPP_InteractionGroup | null): void;
@@ -1303,9 +1585,9 @@ declare class ZPP_InteractionGroup {
1303
1585
  /** Remove a child group. */
1304
1586
  remGroup(group: ZPP_InteractionGroup): void;
1305
1587
  /** Register an interactor in this group. */
1306
- addInteractor(intx: Any$L): void;
1588
+ addInteractor(intx: Any$N): void;
1307
1589
  /** Unregister an interactor from this group. */
1308
- remInteractor(intx: Any$L, flag?: number): void;
1590
+ remInteractor(intx: Any$N, flag?: number): void;
1309
1591
  }
1310
1592
 
1311
1593
  /**
@@ -1391,834 +1673,687 @@ declare class Interactor {
1391
1673
  }
1392
1674
 
1393
1675
  /**
1394
- * Shape type classification.
1676
+ * ZPP_Body Internal body representation for the nape physics engine.
1395
1677
  *
1396
- * - `CIRCLE` — circle shape
1397
- * - `POLYGON` polygon shape
1678
+ * Core physics body managing position, velocity, mass, inertia, shapes, and
1679
+ * CCD (continuous collision detection) sweep integration.
1680
+ * Extends ZPP_Interactor (still in compiled code — methods copied at init time).
1398
1681
  *
1399
- * Converted from nape-compiled.js lines 3043530482.
1682
+ * Converted from nape-compiled.js lines 5243154547.
1400
1683
  */
1401
- declare class ShapeType {
1402
- static __name__: string[];
1403
- constructor();
1404
- static get CIRCLE(): ShapeType;
1405
- static get POLYGON(): ShapeType;
1406
- static get_CIRCLE(): ShapeType;
1407
- static get_POLYGON(): ShapeType;
1408
- toString(): string;
1409
- }
1410
1684
 
1411
- /**
1412
- * Base class for physics shapes (Circle, Polygon).
1413
- *
1414
- * Fully modernized — all getters/setters access the ZPP_Shape inner directly.
1415
- */
1416
- declare class Shape extends Interactor {
1417
- /** @internal – shapes are created via Circle or Polygon constructors. */
1418
- protected constructor();
1419
- /** @internal */
1420
- static _wrap(inner: NapeInner): Shape;
1421
- get type(): ShapeType;
1422
- isCircle(): boolean;
1423
- isPolygon(): boolean;
1424
- get body(): Body;
1425
- set body(value: Body | null);
1426
- get castCircle(): Shape | null;
1427
- get castPolygon(): Shape | null;
1428
- get worldCOM(): Vec2;
1429
- get localCOM(): Vec2;
1430
- set localCOM(value: Vec2);
1431
- get area(): number;
1432
- get inertia(): number;
1433
- get angDrag(): number;
1434
- get material(): Material;
1435
- set material(value: Material);
1436
- get filter(): InteractionFilter;
1437
- set filter(value: InteractionFilter);
1438
- get fluidProperties(): FluidProperties;
1439
- set fluidProperties(value: FluidProperties);
1440
- /** Callback types assigned to this shape. */
1441
- get cbTypes(): CbTypeSet;
1442
- get fluidEnabled(): boolean;
1443
- set fluidEnabled(value: boolean);
1444
- get sensorEnabled(): boolean;
1445
- set sensorEnabled(value: boolean);
1446
- get bounds(): AABB;
1447
- translate(translation: Vec2): Shape;
1448
- scale(scaleX: number, scaleY: number): Shape;
1449
- rotate(angle: number): Shape;
1450
- transform(matrix: {
1451
- _inner: NapeInner;
1452
- }): Shape;
1453
- contains(point: Vec2): boolean;
1454
- copy(): Shape;
1455
- toString(): string;
1456
- /** @internal */ get_type(): ShapeType;
1457
- /** @internal */ get_body(): Body;
1458
- /** @internal */ set_body(v: Body | null): void;
1459
- /** @internal */ get_castCircle(): Shape | null;
1460
- /** @internal */ get_castPolygon(): Shape | null;
1461
- /** @internal */ get_worldCOM(): Vec2;
1462
- /** @internal */ get_localCOM(): Vec2;
1463
- /** @internal */ set_localCOM(v: Vec2): void;
1464
- /** @internal */ get_area(): number;
1465
- /** @internal */ get_inertia(): number;
1466
- /** @internal */ get_angDrag(): number;
1467
- /** @internal */ get_material(): Material;
1468
- /** @internal */ set_material(v: Material): void;
1469
- /** @internal */ get_filter(): InteractionFilter;
1470
- /** @internal */ set_filter(v: InteractionFilter): void;
1471
- /** @internal */ get_fluidProperties(): FluidProperties;
1472
- /** @internal */ set_fluidProperties(v: FluidProperties): void;
1473
- /** @internal */ get_fluidEnabled(): boolean;
1474
- /** @internal */ set_fluidEnabled(v: boolean): void;
1475
- /** @internal */ get_sensorEnabled(): boolean;
1476
- /** @internal */ set_sensorEnabled(v: boolean): void;
1477
- /** @internal */ get_bounds(): AABB;
1478
- /** Setup worldCOM lazy Vec2 wrapper */
1479
- private _setupWorldCOM;
1480
- }
1481
- /** Lightweight typed interface for the callback type set on a shape. */
1482
- interface CbTypeSet {
1483
- readonly _inner: NapeInner;
1484
- add(cbType: {
1485
- _inner: NapeInner;
1486
- }): void;
1487
- remove(cbType: {
1488
- _inner: NapeInner;
1489
- }): void;
1490
- has(cbType: {
1491
- _inner: NapeInner;
1492
- }): boolean;
1493
- clear(): void;
1494
- readonly length: number;
1495
- }
1496
-
1497
- /**
1498
- * ZPP_Constraint — Internal base class for all constraints / joints.
1499
- *
1500
- * Manages activation/deactivation, callback types, space integration,
1501
- * and provides stubs for solver methods overridden by joint subclasses.
1502
- *
1503
- * Converted from nape-compiled.js lines 21424–21827.
1504
- */
1505
- type Any$K = any;
1506
- declare class ZPP_Constraint {
1685
+ type Any$M = any;
1686
+ declare class ZPP_Body {
1507
1687
  static __name__: string[];
1688
+ static __super__: Any$M;
1508
1689
  /**
1509
1690
  * Namespace references, set by the compiled module after import.
1510
- * _nape = the `nape` public namespace (for CbTypeIterator in copyto)
1511
- * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_CbSet, etc.)
1691
+ * _nape = the `nape` public namespace
1692
+ * _zpp = the `zpp_nape` internal namespace
1512
1693
  */
1513
- static _nape: Any$K;
1514
- static _zpp: Any$K;
1515
- outer: Any$K;
1694
+ static _nape: Any$M;
1695
+ static _zpp: Any$M;
1696
+ static types: Any$M[];
1697
+ static bodystack: Any$M;
1698
+ static bodyset: Any$M;
1699
+ static cur_graph_depth: number;
1700
+ static bodysetlt(a: Any$M, b: Any$M): boolean;
1701
+ static __static(): Any$M;
1702
+ outer_i: Any$M;
1516
1703
  id: number;
1517
- userData: Any$K;
1518
- compound: Any$K;
1519
- space: Any$K;
1520
- active: boolean;
1521
- stiff: boolean;
1522
- frequency: number;
1523
- damping: number;
1524
- maxForce: number;
1525
- maxError: number;
1526
- breakUnderForce: boolean;
1527
- breakUnderError: boolean;
1528
- removeOnBreak: boolean;
1529
- component: Any$K;
1530
- ignore: boolean;
1531
- __velocity: boolean;
1532
- cbTypes: Any$K;
1533
- cbSet: Any$K;
1534
- wrap_cbTypes: Any$K;
1535
- pre_dt: number;
1536
- __class__: Any$K;
1704
+ userData: Any$M;
1705
+ ishape: Any$M;
1706
+ ibody: Any$M;
1707
+ icompound: Any$M;
1708
+ wrap_cbTypes: Any$M;
1709
+ cbSet: Any$M;
1710
+ cbTypes: Any$M;
1711
+ group: Any$M;
1712
+ cbsets: Any$M;
1713
+ outer: Any$M;
1714
+ world: boolean;
1715
+ type: number;
1716
+ compound: Any$M;
1717
+ shapes: Any$M;
1718
+ wrap_shapes: Any$M;
1719
+ space: Any$M;
1720
+ arbiters: Any$M;
1721
+ wrap_arbiters: Any$M;
1722
+ constraints: Any$M;
1723
+ wrap_constraints: Any$M;
1724
+ component: Any$M;
1725
+ graph_depth: number;
1726
+ sweepTime: number;
1727
+ sweep_angvel: number;
1728
+ sweepFrozen: boolean;
1729
+ sweepRadius: number;
1730
+ bullet: boolean;
1731
+ bulletEnabled: boolean;
1732
+ disableCCD: boolean;
1733
+ pre_posx: number;
1734
+ pre_posy: number;
1735
+ posx: number;
1736
+ posy: number;
1737
+ wrap_pos: Any$M;
1738
+ velx: number;
1739
+ vely: number;
1740
+ wrap_vel: Any$M;
1741
+ forcex: number;
1742
+ forcey: number;
1743
+ wrap_force: Any$M;
1744
+ kinvelx: number;
1745
+ kinvely: number;
1746
+ wrap_kinvel: Any$M;
1747
+ svelx: number;
1748
+ svely: number;
1749
+ wrap_svel: Any$M;
1750
+ wrapcvel: Any$M;
1751
+ angvel: number;
1752
+ torque: number;
1753
+ kinangvel: number;
1754
+ pre_rot: number;
1755
+ rot: number;
1756
+ axisx: number;
1757
+ axisy: number;
1758
+ zip_axis: boolean;
1759
+ kinematicDelaySleep: boolean;
1760
+ mass: number;
1761
+ zip_mass: boolean;
1762
+ massMode: number;
1763
+ imass: number;
1764
+ smass: number;
1765
+ cmass: number;
1766
+ nomove: boolean;
1767
+ gravMass: number;
1768
+ zip_gravMass: boolean;
1769
+ gravMassMode: number;
1770
+ gravMassScale: number;
1771
+ zip_gravMassScale: boolean;
1772
+ inertiaMode: number;
1773
+ inertia: number;
1774
+ zip_inertia: boolean;
1775
+ cinertia: number;
1776
+ iinertia: number;
1777
+ sinertia: number;
1778
+ norotate: boolean;
1779
+ aabb: ZPP_AABB;
1780
+ zip_aabb: boolean;
1781
+ localCOMx: number;
1782
+ localCOMy: number;
1783
+ zip_localCOM: boolean;
1784
+ worldCOMx: number;
1785
+ worldCOMy: number;
1786
+ zip_worldCOM: boolean;
1787
+ wrap_localCOM: Any$M;
1788
+ wrap_worldCOM: Any$M;
1789
+ __class__: Any$M;
1537
1790
  constructor();
1538
- /**
1539
- * Initialise base constraint fields.
1540
- * Extracted into a separate method because compiled joint subclasses
1541
- * call `ZPP_Constraint.call(this)` — ES classes can't be invoked that
1542
- * way, so the compiled wrapper delegates to this method instead.
1543
- */
1544
- _initBase(): void;
1791
+ isStatic(): boolean;
1792
+ isDynamic(): boolean;
1793
+ isKinematic(): boolean;
1794
+ invalidate_type(): void;
1795
+ invalidate_shapes(): void;
1796
+ init_bodysetlist(): void;
1797
+ connectedBodies_cont(b: Any$M): void;
1798
+ connectedBodies(depth: number, output: Any$M): Any$M;
1799
+ interactingBodies(type: number, output: Any$M): Any$M;
1800
+ atRest(dt: number): boolean;
1801
+ refreshArbiters(): void;
1802
+ sweepIntegrate(dt: number): void;
1803
+ sweepValidate(s: Any$M): void;
1804
+ invalidate_pos(): void;
1805
+ pos_invalidate(pos: Any$M): void;
1806
+ pos_validate(): void;
1807
+ vel_invalidate(vel: Any$M): void;
1808
+ vel_validate(): void;
1809
+ kinvel_invalidate(vel: Any$M): void;
1810
+ kinvel_validate(): void;
1811
+ svel_invalidate(vel: Any$M): void;
1812
+ svel_validate(): void;
1813
+ force_invalidate(force: Any$M): void;
1814
+ force_validate(): void;
1815
+ private _setupVec2Wrapper;
1816
+ setupPosition(): void;
1817
+ setupVelocity(): void;
1818
+ setupkinvel(): void;
1819
+ setupsvel(): void;
1820
+ setupForce(): void;
1821
+ cvel_validate(): void;
1822
+ setup_cvel(): void;
1823
+ invalidate_rot(): void;
1824
+ validate_axis(): void;
1825
+ quick_validate_axis(): void;
1826
+ delta_rot(dr: number): void;
1827
+ invalidate_mass(): void;
1828
+ validate_mass(): void;
1829
+ invalidate_gravMass(): void;
1830
+ validate_gravMass(): void;
1831
+ invalidate_gravMassScale(): void;
1832
+ validate_gravMassScale(): void;
1833
+ invalidate_inertia(): void;
1834
+ validate_inertia(): void;
1835
+ invalidate_wake(): void;
1836
+ invalidate_aabb(): void;
1837
+ validate_aabb(): void;
1838
+ private _validateCircleAABB;
1839
+ private _validatePolygonAABB;
1840
+ aabb_validate(): void;
1841
+ invalidate_localCOM(): void;
1842
+ invalidate_worldCOM(): void;
1843
+ private _computePolygonLocalCOM;
1844
+ validate_localCOM(): void;
1845
+ validate_worldCOM(): void;
1846
+ getlocalCOM(): void;
1847
+ getworldCOM(): void;
1848
+ __immutable_midstep(): void;
1545
1849
  clear(): void;
1546
- activeBodies(): void;
1547
- inactiveBodies(): void;
1548
- clearcache(): void;
1549
- validate(): void;
1550
- wake_connected(): void;
1551
- forest(): void;
1552
- broken(): void;
1553
- warmStart(): void;
1554
- draw(_g: Any$K): void;
1555
- pair_exists(_id: Any$K, _di: Any$K): boolean;
1556
- preStep(_dt: number): boolean;
1557
- applyImpulseVel(): boolean;
1558
- applyImpulsePos(): boolean;
1559
- copy(_dict?: Any$K, _todo?: Any$K): Any$K;
1560
- immutable_midstep(name: string): void;
1561
- setupcbTypes(): void;
1562
- immutable_cbTypes(): void;
1563
- wrap_cbTypes_subber(pcb: Any$K): void;
1564
- wrap_cbTypes_adder(cb: Any$K): boolean;
1565
- insert_cbtype(cb: Any$K): void;
1566
- alloc_cbSet(): void;
1567
- dealloc_cbSet(): void;
1568
- activate(): void;
1569
- deactivate(): void;
1850
+ shapes_adder(s: Any$M): boolean;
1851
+ shapes_subber(s: Any$M): void;
1852
+ shapes_invalidate(_param: Any$M): void;
1853
+ shapes_modifiable(): void;
1570
1854
  addedToSpace(): void;
1571
1855
  removedFromSpace(): void;
1572
- activeInSpace(): void;
1573
- inactiveOrOutSpace(): void;
1574
- wake(): void;
1575
- copyto(ret: Any$K): void;
1576
- static _findRoot(comp: Any$K): Any$K;
1577
- static _unionComponents(a: Any$K, b: Any$K): void;
1856
+ private _removeArbiterFromList;
1857
+ copy(): Any$M;
1858
+ wake: () => void;
1859
+ __iaddedToSpace: () => void;
1860
+ __iremovedFromSpace: () => void;
1861
+ immutable_midstep: (name: string) => void;
1862
+ copyto: (ret: Any$M) => void;
1863
+ insert_cbtype: (cb: Any$M) => void;
1864
+ alloc_cbSet: () => void;
1865
+ dealloc_cbSet: () => void;
1866
+ setupcbTypes: () => void;
1867
+ immutable_cbTypes: () => void;
1868
+ wrap_cbTypes_subber: (pcb: Any$M) => void;
1869
+ wrap_cbTypes_adder: (cb: Any$M) => void;
1870
+ setGroup: (group: Any$M) => void;
1871
+ lookup_group: () => Any$M;
1872
+ getSpace: () => Any$M;
1873
+ isShape: () => boolean;
1874
+ isBody: () => boolean;
1875
+ isCompound: () => boolean;
1876
+ static _initialized: boolean;
1877
+ static _init(zpp: Any$M, nape: Any$M): void;
1578
1878
  }
1579
1879
 
1580
- type Any$J = any;
1880
+ type Any$L = any;
1581
1881
  /**
1582
- * Base class for all constraints / joints.
1882
+ * A rigid body in the physics simulation.
1583
1883
  *
1584
- * Fully modernized — uses ZPP_Constraint directly (extracted to TypeScript).
1585
- * Not instantiated directly; only via joint subclasses.
1884
+ * Fully modernized — all methods implemented directly using ZPP_Body.
1586
1885
  */
1587
- declare class Constraint {
1886
+ declare class Body extends Interactor {
1588
1887
  static __name__: string[];
1589
- /** Direct access to the extracted internal ZPP_Constraint. */
1590
- zpp_inner: ZPP_Constraint;
1591
- /**
1592
- * Compiled joint reference for joint-specific methods (body1/body2/anchors etc.).
1593
- * Joint subclasses set this to the compiled joint instance until those joints
1594
- * are fully modernized. Also serves as backward compat for compiled code.
1595
- * @internal
1596
- */
1597
- _inner: Any$J;
1888
+ static __super__: Any$L;
1889
+ /** Direct access to the extracted internal ZPP_Body. */
1890
+ zpp_inner: ZPP_Body;
1598
1891
  debugDraw: boolean;
1892
+ constructor(type?: BodyType, position?: Vec2);
1599
1893
  /** @internal */
1600
- protected constructor();
1601
- /** @internal */
1602
- static _wrap(inner: Any$J): Constraint;
1603
- get space(): Space | null;
1604
- set space(value: Space | null);
1605
- get compound(): Any$J;
1606
- set compound(value: Any$J);
1607
- get active(): boolean;
1608
- set active(value: boolean);
1609
- get ignore(): boolean;
1610
- set ignore(value: boolean);
1611
- get stiff(): boolean;
1612
- set stiff(value: boolean);
1613
- get frequency(): number;
1614
- set frequency(value: number);
1615
- get damping(): number;
1616
- set damping(value: number);
1617
- get maxForce(): number;
1618
- set maxForce(value: number);
1619
- get maxError(): number;
1620
- set maxError(value: number);
1621
- get breakUnderForce(): boolean;
1622
- set breakUnderForce(value: boolean);
1623
- get breakUnderError(): boolean;
1624
- set breakUnderError(value: boolean);
1625
- get removeOnBreak(): boolean;
1626
- set removeOnBreak(value: boolean);
1894
+ static _wrap(inner: NapeInner): Body;
1895
+ get type(): BodyType;
1896
+ set type(value: BodyType);
1897
+ isStatic(): boolean;
1898
+ isDynamic(): boolean;
1899
+ isKinematic(): boolean;
1900
+ get position(): Vec2;
1901
+ set position(value: Vec2);
1902
+ get rotation(): number;
1903
+ set rotation(value: number);
1904
+ get velocity(): Vec2;
1905
+ set velocity(value: Vec2);
1906
+ get angularVel(): number;
1907
+ set angularVel(value: number);
1908
+ get kinematicVel(): Vec2;
1909
+ set kinematicVel(value: Vec2);
1910
+ get kinAngVel(): number;
1911
+ set kinAngVel(value: number);
1912
+ get surfaceVel(): Vec2;
1913
+ set surfaceVel(value: Vec2);
1914
+ get force(): Vec2;
1915
+ set force(value: Vec2);
1916
+ get torque(): number;
1917
+ set torque(value: number);
1918
+ get mass(): number;
1919
+ set mass(value: number);
1920
+ get inertia(): number;
1921
+ set inertia(value: number);
1922
+ get constraintMass(): number;
1923
+ get constraintInertia(): number;
1924
+ get gravMass(): number;
1925
+ set gravMass(value: number);
1926
+ get gravMassScale(): number;
1927
+ set gravMassScale(value: number);
1928
+ get isBullet(): boolean;
1929
+ set isBullet(value: boolean);
1930
+ get disableCCD(): boolean;
1931
+ set disableCCD(value: boolean);
1932
+ get allowMovement(): boolean;
1933
+ set allowMovement(value: boolean);
1934
+ get allowRotation(): boolean;
1935
+ set allowRotation(value: boolean);
1627
1936
  get isSleeping(): boolean;
1628
- get userData(): Record<string, unknown>;
1629
- get cbTypes(): Any$J;
1630
- impulse(): Any$J;
1631
- bodyImpulse(_body: Body): Any$J;
1632
- visitBodies(_fn: (body: Body) => void): void;
1633
- copy(): Constraint;
1937
+ get shapes(): NapeList<Shape>;
1938
+ get space(): Space;
1939
+ set space(value: Space | null);
1940
+ get compound(): Any$L;
1941
+ set compound(value: Any$L);
1942
+ get bounds(): AABB;
1943
+ get constraintVelocity(): Vec2;
1944
+ get localCOM(): Vec2;
1945
+ get worldCOM(): Vec2;
1946
+ get massMode(): Any$L;
1947
+ set massMode(value: Any$L);
1948
+ get inertiaMode(): Any$L;
1949
+ set inertiaMode(value: Any$L);
1950
+ get gravMassMode(): Any$L;
1951
+ set gravMassMode(value: Any$L);
1952
+ copy(): Body;
1634
1953
  toString(): string;
1635
- /** @internal */ get_userData(): Any$J;
1636
- /** @internal */ get_compound(): Any$J;
1637
- /** @internal */ set_compound(v: Any$J): Any$J;
1638
- /** @internal */ get_space(): Any$J;
1639
- /** @internal */ set_space(v: Any$J): Any$J;
1640
- /** @internal */ get_isSleeping(): boolean;
1641
- /** @internal */ get_active(): boolean;
1642
- /** @internal */ set_active(v: boolean): boolean;
1643
- /** @internal */ get_ignore(): boolean;
1644
- /** @internal */ set_ignore(v: boolean): boolean;
1645
- /** @internal */ get_stiff(): boolean;
1646
- /** @internal */ set_stiff(v: boolean): boolean;
1647
- /** @internal */ get_frequency(): number;
1648
- /** @internal */ set_frequency(v: number): number;
1649
- /** @internal */ get_damping(): number;
1650
- /** @internal */ set_damping(v: number): number;
1651
- /** @internal */ get_maxForce(): number;
1652
- /** @internal */ set_maxForce(v: number): number;
1653
- /** @internal */ get_maxError(): number;
1654
- /** @internal */ set_maxError(v: number): number;
1655
- /** @internal */ get_breakUnderForce(): boolean;
1656
- /** @internal */ set_breakUnderForce(v: boolean): boolean;
1657
- /** @internal */ get_breakUnderError(): boolean;
1658
- /** @internal */ set_breakUnderError(v: boolean): boolean;
1659
- /** @internal */ get_removeOnBreak(): boolean;
1660
- /** @internal */ set_removeOnBreak(v: boolean): boolean;
1661
- /** @internal */ get_cbTypes(): Any$J;
1954
+ get_type(): Any$L;
1955
+ set_type(type: Any$L): Any$L;
1956
+ get_shapes(): Any$L;
1957
+ get_isBullet(): boolean;
1958
+ set_isBullet(v: boolean): boolean;
1959
+ get_disableCCD(): boolean;
1960
+ set_disableCCD(v: boolean): boolean;
1961
+ get_position(): Any$L;
1962
+ set_position(position: Any$L): Any$L;
1963
+ get_velocity(): Any$L;
1964
+ set_velocity(velocity: Any$L): Any$L;
1965
+ get_rotation(): number;
1966
+ set_rotation(rotation: number): number;
1967
+ get_angularVel(): number;
1968
+ set_angularVel(angularVel: number): number;
1969
+ get_kinematicVel(): Any$L;
1970
+ set_kinematicVel(kinematicVel: Any$L): Any$L;
1971
+ get_kinAngVel(): number;
1972
+ set_kinAngVel(kinAngVel: number): number;
1973
+ get_surfaceVel(): Any$L;
1974
+ set_surfaceVel(surfaceVel: Any$L): Any$L;
1975
+ get_force(): Any$L;
1976
+ set_force(force: Any$L): Any$L;
1977
+ get_torque(): number;
1978
+ set_torque(torque: number): number;
1979
+ get_bounds(): Any$L;
1980
+ get_constraintVelocity(): Any$L;
1981
+ get_constraintMass(): number;
1982
+ get_constraintInertia(): number;
1983
+ get_allowMovement(): boolean;
1984
+ set_allowMovement(allowMovement: boolean): boolean;
1985
+ get_allowRotation(): boolean;
1986
+ set_allowRotation(allowRotation: boolean): boolean;
1987
+ get_isSleeping(): boolean;
1988
+ get_compound(): Any$L;
1989
+ set_compound(compound: Any$L): Any$L;
1990
+ get_space(): Any$L;
1991
+ set_space(space: Any$L): Any$L;
1992
+ get_arbiters(): Any$L;
1993
+ get_constraints(): Any$L;
1994
+ get_massMode(): Any$L;
1995
+ set_massMode(massMode: Any$L): Any$L;
1996
+ get_mass(): number;
1997
+ set_mass(mass: number): number;
1998
+ get_gravMassMode(): Any$L;
1999
+ set_gravMassMode(gravMassMode: Any$L): Any$L;
2000
+ get_gravMass(): number;
2001
+ set_gravMass(gravMass: number): number;
2002
+ get_gravMassScale(): number;
2003
+ set_gravMassScale(gravMassScale: number): number;
2004
+ get_inertiaMode(): Any$L;
2005
+ set_inertiaMode(inertiaMode: Any$L): Any$L;
2006
+ get_inertia(): number;
2007
+ set_inertia(inertia: number): number;
2008
+ get_localCOM(): Any$L;
2009
+ get_worldCOM(): Any$L;
2010
+ integrate(deltaTime: number): Body;
2011
+ localPointToWorld(point: Vec2, weak?: boolean): Vec2;
2012
+ worldPointToLocal(point: Vec2, weak?: boolean): Vec2;
2013
+ localVectorToWorld(vector: Vec2, weak?: boolean): Vec2;
2014
+ worldVectorToLocal(vector: Vec2, weak?: boolean): Vec2;
2015
+ applyImpulse(impulse: Vec2, pos?: Vec2, sleepable?: boolean): Body;
2016
+ applyAngularImpulse(impulse: number, sleepable?: boolean): Body;
2017
+ setVelocityFromTarget(targetPosition: Vec2, targetRotation: number, deltaTime: number): Body;
2018
+ translateShapes(translation: Vec2): Body;
2019
+ rotateShapes(angle: number): Body;
2020
+ scaleShapes(scaleX: number, scaleY: number): Body;
2021
+ transformShapes(matrix: Any$L): Body;
2022
+ align(): Body;
2023
+ rotate(centre: Vec2, angle: number): Body;
2024
+ setShapeMaterials(material: Any$L): Body;
2025
+ setShapeFilters(filter: Any$L): Body;
2026
+ setShapeFluidProperties(fluidProperties: Any$L): Body;
2027
+ contains(point: Vec2): boolean;
2028
+ connectedBodies(depth?: number, output?: Any$L): Any$L;
2029
+ interactingBodies(type?: Any$L, depth?: number, output?: Any$L): Any$L;
2030
+ normalImpulse(body?: Any$L, freshOnly?: boolean): Vec3;
2031
+ tangentImpulse(body?: Any$L, freshOnly?: boolean): Vec3;
2032
+ totalContactsImpulse(body?: Any$L, freshOnly?: boolean): Vec3;
2033
+ rollingImpulse(body?: Any$L, freshOnly?: boolean): number;
2034
+ buoyancyImpulse(body?: Any$L): Vec3;
2035
+ dragImpulse(body?: Any$L): Vec3;
2036
+ totalFluidImpulse(body?: Any$L): Vec3;
2037
+ constraintsImpulse(): Vec3;
2038
+ totalImpulse(body?: Any$L, freshOnly?: boolean): Vec3;
2039
+ crushFactor(): number;
2040
+ private _arbiterImpulseQuery;
1662
2041
  }
1663
2042
 
1664
2043
  /**
1665
- * ZPP_Listener — Internal listener base class for the nape physics engine.
2044
+ * ZPP_Material — Internal material representation for the nape physics engine.
1666
2045
  *
1667
- * Base class for ZPP_BodyListener, ZPP_ConstraintListener, and
1668
- * ZPP_InteractionListener. Holds common properties (space, precedence,
1669
- * event type, listener type) and provides stub methods for subclass override.
2046
+ * Stores physical material properties (friction, elasticity, density) and
2047
+ * manages the list of shapes that reference this material for invalidation.
1670
2048
  *
1671
- * Converted from nape-compiled.js lines 2725927304, 112053112139.
2049
+ * Converted from nape-compiled.js lines 8752387601, 135477135481.
1672
2050
  */
1673
- type Any$I = any;
1674
- declare class ZPP_Listener {
2051
+ type Any$K = any;
2052
+ declare class ZPP_Material {
2053
+ static zpp_pool: ZPP_Material | null;
2054
+ static WAKE: number;
2055
+ static PROPS: number;
2056
+ static ANGDRAG: number;
2057
+ static ARBITERS: number;
1675
2058
  static __name__: string[];
1676
- static _nape: Any$I;
1677
- static _zpp: Any$I;
1678
- static internal: boolean;
1679
- static types: Any$I[];
1680
- static events: Any$I[];
1681
- space: Any$I;
1682
- interaction: Any$I;
1683
- constraint: Any$I;
1684
- body: Any$I;
1685
- precedence: number;
1686
- event: number;
1687
- type: number;
1688
- id: number;
1689
- outer: Any$I;
1690
- __class__: Any$I;
2059
+ /**
2060
+ * Namespace references, set by the compiled module after import.
2061
+ * _nape = the `nape` public namespace (for wrapper creation)
2062
+ * _zpp = the `zpp_nape` internal namespace (for ZNPList_ZPP_Shape)
2063
+ */
2064
+ static _nape: Any$K;
2065
+ static _zpp: Any$K;
2066
+ /**
2067
+ * Wrapper factory callback, registered by the modernized Material class.
2068
+ * When set, wrapper() uses this instead of creating a compiled Material.
2069
+ */
2070
+ static _wrapFn: ((zpp: ZPP_Material) => Any$K) | null;
2071
+ elasticity: number;
2072
+ dynamicFriction: number;
2073
+ staticFriction: number;
2074
+ density: number;
2075
+ rollingFriction: number;
2076
+ shapes: Any$K;
2077
+ wrap_shapes: Any$K;
2078
+ outer: Any$K;
2079
+ userData: Any$K;
2080
+ next: ZPP_Material | null;
2081
+ __class__: Any$K;
1691
2082
  constructor();
1692
- /** Sort comparator: higher precedence first, then by id descending. */
1693
- static setlt(a: ZPP_Listener, b: ZPP_Listener): boolean;
1694
- swapEvent(_event?: number): void;
1695
- invalidate_precedence(): void;
1696
- addedToSpace(): void;
1697
- removedFromSpace(): void;
2083
+ /** Create/return the public nape.phys.Material wrapper for this internal object. */
2084
+ wrapper(): Any$K;
2085
+ /** Called when this object is returned to the pool. */
2086
+ free(): void;
2087
+ /** Called when this object is taken from the pool. */
2088
+ alloc(): void;
2089
+ /** Initialize the shapes list (called during feature construction). */
2090
+ feature_cons(): void;
2091
+ /** Register a shape that uses this material. */
2092
+ addShape(shape: Any$K): void;
2093
+ /** Unregister a shape that no longer uses this material. */
2094
+ remShape(shape: Any$K): void;
2095
+ /** Create a copy with the same property values. */
2096
+ copy(): ZPP_Material;
2097
+ /** Copy all property values from another ZPP_Material. */
2098
+ set(x: ZPP_Material): void;
2099
+ /** Notify all shapes using this material that properties changed. */
2100
+ invalidate(x: number): void;
1698
2101
  }
1699
2102
 
1700
2103
  /**
1701
- * Callback event types.
2104
+ * Physical material properties applied to shapes.
1702
2105
  *
1703
- * - `BEGIN` — interaction just started
1704
- * - `ONGOING` interaction continues
1705
- * - `END` interaction just ended
1706
- * - `WAKE` — body/constraint woke up
1707
- * - `SLEEP` — body/constraint went to sleep
1708
- * - `BREAK` — constraint was broken
1709
- * - `PRE` — pre-interaction callback
2106
+ * Controls elasticity (bounciness), friction coefficients, density, and
2107
+ * rolling friction. Internally wraps a ZPP_Material and is registered as
2108
+ * the public `nape.phys.Material` class in the compiled namespace.
1710
2109
  *
1711
- * Converted from nape-compiled.js lines 516657.
2110
+ * Converted from nape-compiled.js lines 3825438573.
1712
2111
  */
1713
- declare class CbEvent {
2112
+ declare class Material {
1714
2113
  static __name__: string[];
1715
- constructor();
1716
- static get BEGIN(): CbEvent;
1717
- static get ONGOING(): CbEvent;
1718
- static get END(): CbEvent;
1719
- static get WAKE(): CbEvent;
1720
- static get SLEEP(): CbEvent;
1721
- static get BREAK(): CbEvent;
1722
- static get PRE(): CbEvent;
1723
- static get_BEGIN(): CbEvent;
1724
- static get_ONGOING(): CbEvent;
1725
- static get_END(): CbEvent;
1726
- static get_WAKE(): CbEvent;
1727
- static get_SLEEP(): CbEvent;
1728
- static get_BREAK(): CbEvent;
1729
- static get_PRE(): CbEvent;
2114
+ /** @internal The internal ZPP_Material this wrapper owns. */
2115
+ zpp_inner: ZPP_Material;
2116
+ /**
2117
+ * Backward-compatible accessor — returns `this` so that compiled engine
2118
+ * code that receives `material._inner` can still access `zpp_inner`.
2119
+ * @internal
2120
+ */
2121
+ get _inner(): NapeInner;
2122
+ constructor(elasticity?: number, dynamicFriction?: number, staticFriction?: number, density?: number, rollingFriction?: number);
2123
+ /** @internal Wrap a ZPP_Material (or legacy compiled Material) with caching. */
2124
+ static _wrap(inner: any): Material;
2125
+ get elasticity(): number;
2126
+ set elasticity(value: number);
2127
+ get dynamicFriction(): number;
2128
+ set dynamicFriction(value: number);
2129
+ get staticFriction(): number;
2130
+ set staticFriction(value: number);
2131
+ get density(): number;
2132
+ set density(value: number);
2133
+ get rollingFriction(): number;
2134
+ set rollingFriction(value: number);
2135
+ get userData(): Record<string, unknown>;
2136
+ copy(): Material;
1730
2137
  toString(): string;
1731
- }
2138
+ static wood(): Material;
2139
+ static steel(): Material;
2140
+ static ice(): Material;
2141
+ static rubber(): Material;
2142
+ static glass(): Material;
2143
+ static sand(): Material;
2144
+ }
1732
2145
 
1733
2146
  /**
1734
- * Listener type classification.
2147
+ * ZPP_FluidProperties Internal fluid properties for the nape physics engine.
1735
2148
  *
1736
- * - `BODY` — body event listener
1737
- * - `CONSTRAINT` — constraint event listener
1738
- * - `INTERACTION` — interaction event listener
1739
- * - `PRE` — pre-interaction listener
2149
+ * Stores density, viscosity, and per-fluid gravity override.
2150
+ * Manages the list of shapes that reference these properties for invalidation.
1740
2151
  *
1741
- * Converted from nape-compiled.js lines 25542646.
2152
+ * Converted from nape-compiled.js lines 8733587523, 135403.
1742
2153
  */
1743
- declare class ListenerType {
2154
+ type Any$J = any;
2155
+ declare class ZPP_FluidProperties {
2156
+ static zpp_pool: ZPP_FluidProperties | null;
1744
2157
  static __name__: string[];
1745
- static BODY: ListenerType | null;
1746
- static CONSTRAINT: ListenerType | null;
1747
- static INTERACTION: ListenerType | null;
1748
- static PRE: ListenerType | null;
2158
+ static _nape: Any$J;
2159
+ static _zpp: Any$J;
2160
+ static _wrapFn: ((zpp: ZPP_FluidProperties) => Any$J) | null;
2161
+ viscosity: number;
2162
+ density: number;
2163
+ gravityx: number;
2164
+ gravityy: number;
2165
+ wrap_gravity: Any$J;
2166
+ shapes: Any$J;
2167
+ wrap_shapes: Any$J;
2168
+ outer: Any$J;
2169
+ userData: Any$J;
2170
+ next: ZPP_FluidProperties | null;
2171
+ __class__: Any$J;
1749
2172
  constructor();
1750
- static get_BODY(): ListenerType;
1751
- static get_CONSTRAINT(): ListenerType;
1752
- static get_INTERACTION(): ListenerType;
1753
- static get_PRE(): ListenerType;
1754
- toString(): string;
2173
+ /** Create/return the public nape.phys.FluidProperties wrapper. */
2174
+ wrapper(): Any$J;
2175
+ free(): void;
2176
+ alloc(): void;
2177
+ feature_cons(): void;
2178
+ addShape(shape: Any$J): void;
2179
+ remShape(shape: Any$J): void;
2180
+ /** Copy with object pooling. */
2181
+ copy(): ZPP_FluidProperties;
2182
+ /** Called when gravity Vec2 wrapper is invalidated (user set new gravity). */
2183
+ gravity_invalidate(x: Any$J): void;
2184
+ /** Sync the gravity Vec2 wrapper with internal values. */
2185
+ gravity_validate(): void;
2186
+ /** Lazily create and return the gravity Vec2 wrapper. */
2187
+ getgravity(): void;
2188
+ /** Notify all shapes that fluid properties changed. */
2189
+ invalidate(): void;
1755
2190
  }
1756
2191
 
1757
2192
  /**
1758
- * Listener Base class for all physics event listeners.
2193
+ * Fluid properties for shapes that act as fluid regions.
1759
2194
  *
1760
- * Provides common properties (type, event, precedence, space) and
1761
- * toString() for all listener subclasses.
2195
+ * Controls density, viscosity, and per-fluid gravity override.
2196
+ * Internally wraps a ZPP_FluidProperties and is registered as
2197
+ * the public `nape.phys.FluidProperties` class in the compiled namespace.
1762
2198
  *
1763
- * Fully modernized from nape-compiled.js lines 231433.
2199
+ * Converted from nape-compiled.js lines 3700237511.
1764
2200
  */
1765
-
1766
- type Any$H = any;
1767
- declare class Listener {
2201
+ declare class FluidProperties {
1768
2202
  static __name__: string[];
1769
- zpp_inner: ZPP_Listener;
1770
- get _inner(): Any$H;
1771
- constructor();
1772
- static _wrap(inner: Any$H): Listener;
1773
- get type(): ListenerType;
1774
- get event(): CbEvent;
1775
- set event(event: CbEvent);
1776
- get precedence(): number;
1777
- set precedence(precedence: number);
1778
- get space(): Space | null;
1779
- set space(space: Space | Any$H | null);
1780
- toString(): string;
1781
- }
1782
-
1783
- /**
1784
- * The physics world. Add bodies and constraints, then call `step()` each frame.
1785
- */
1786
- declare class Space {
1787
- /** @internal */
1788
- readonly _inner: NapeInner;
1789
- constructor(gravity?: Vec2);
1790
- /** @internal */
1791
- static _wrap(inner: NapeInner): Space;
1792
- get gravity(): Vec2;
1793
- set gravity(value: Vec2);
1794
- get worldLinearDrag(): number;
1795
- set worldLinearDrag(value: number);
1796
- get worldAngularDrag(): number;
1797
- set worldAngularDrag(value: number);
1798
- get sortContacts(): boolean;
1799
- set sortContacts(value: boolean);
1800
- get bodies(): NapeList<Body>;
1801
- get liveBodies(): NapeList<Body>;
1802
- get constraints(): NapeList<Constraint>;
1803
- get liveConstraints(): NapeList<Constraint>;
1804
- get arbiters(): NapeInner;
1805
- get listeners(): NapeList<Listener>;
1806
- get compounds(): NapeInner;
1807
- /** The static world body (always present, immovable). */
1808
- get world(): Body;
1809
- get timeStamp(): number;
1810
- get elapsedTime(): number;
1811
- get broadphase(): NapeInner;
2203
+ /** @internal The internal ZPP_FluidProperties this wrapper owns. */
2204
+ zpp_inner: ZPP_FluidProperties;
2205
+ /**
2206
+ * Backward-compatible accessor — returns `this` so that compiled engine
2207
+ * code that receives `fluidProps._inner` can still access `zpp_inner`.
2208
+ * @internal
2209
+ */
2210
+ get _inner(): NapeInner;
2211
+ constructor(density?: number, viscosity?: number);
2212
+ /** @internal Wrap a ZPP_FluidProperties (or legacy compiled FluidProperties) with caching. */
2213
+ static _wrap(inner: any): FluidProperties;
2214
+ get density(): number;
2215
+ set density(value: number);
2216
+ get viscosity(): number;
2217
+ set viscosity(value: number);
2218
+ get gravity(): any;
2219
+ set gravity(gravity: any);
1812
2220
  get userData(): Record<string, unknown>;
1813
- step(deltaTime: number, velocityIterations?: number, positionIterations?: number): void;
1814
- clear(): void;
1815
- visitBodies(fn: (body: Body) => void): void;
1816
- visitConstraints(fn: (constraint: Constraint) => void): void;
1817
- visitCompounds(fn: (compound: NapeInner) => void): void;
1818
- shapesUnderPoint(point: Vec2, filter?: InteractionFilterLike, output?: NapeInner): NapeInner;
1819
- bodiesUnderPoint(point: Vec2, filter?: InteractionFilterLike, output?: NapeInner): NapeInner;
1820
- shapesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilterLike, output?: NapeInner): NapeInner;
1821
- bodiesInAABB(aabb: AABB, containment?: boolean, strict?: boolean, filter?: InteractionFilterLike, output?: NapeInner): NapeInner;
1822
- rayCast(ray: {
1823
- _inner: NapeInner;
1824
- } | NapeInner, inner?: boolean, filter?: InteractionFilterLike): NapeInner;
1825
- rayMultiCast(ray: {
1826
- _inner: NapeInner;
1827
- } | NapeInner, inner?: boolean, filter?: InteractionFilterLike, output?: NapeInner): NapeInner;
2221
+ get shapes(): any;
2222
+ copy(): FluidProperties;
1828
2223
  toString(): string;
1829
2224
  }
1830
- /** @internal Helper type for filter-like parameters. */
1831
- type InteractionFilterLike = {
1832
- _inner: NapeInner;
1833
- } | NapeInner | undefined;
1834
2225
 
1835
2226
  /**
1836
- * Body type enumeration.
2227
+ * Shape type classification.
1837
2228
  *
1838
- * - `STATIC` immovable, infinite mass (walls, floors)
1839
- * - `DYNAMIC` fully simulated (default)
1840
- * - `KINEMATIC` — moves only via velocity, not affected by forces
2229
+ * - `CIRCLE` circle shape
2230
+ * - `POLYGON` polygon shape
1841
2231
  *
1842
- * Converted from nape-compiled.js lines 2464024705.
2232
+ * Converted from nape-compiled.js lines 3043530482.
1843
2233
  */
1844
- declare class BodyType {
2234
+ declare class ShapeType {
1845
2235
  static __name__: string[];
1846
2236
  constructor();
1847
- static get STATIC(): BodyType;
1848
- static get DYNAMIC(): BodyType;
1849
- static get KINEMATIC(): BodyType;
1850
- static get_STATIC(): BodyType;
1851
- static get_DYNAMIC(): BodyType;
1852
- static get_KINEMATIC(): BodyType;
2237
+ static get CIRCLE(): ShapeType;
2238
+ static get POLYGON(): ShapeType;
2239
+ static get_CIRCLE(): ShapeType;
2240
+ static get_POLYGON(): ShapeType;
1853
2241
  toString(): string;
1854
2242
  }
1855
2243
 
1856
2244
  /**
1857
- * ZPP_Body Internal body representation for the nape physics engine.
1858
- *
1859
- * Core physics body managing position, velocity, mass, inertia, shapes, and
1860
- * CCD (continuous collision detection) sweep integration.
1861
- * Extends ZPP_Interactor (still in compiled code — methods copied at init time).
2245
+ * Base class for physics shapes (Circle, Polygon).
1862
2246
  *
1863
- * Converted from nape-compiled.js lines 52431–54547.
2247
+ * Fully modernized all getters/setters access the ZPP_Shape inner directly.
1864
2248
  */
1865
-
1866
- type Any$G = any;
1867
- declare class ZPP_Body {
1868
- static __name__: string[];
1869
- static __super__: Any$G;
1870
- /**
1871
- * Namespace references, set by the compiled module after import.
1872
- * _nape = the `nape` public namespace
1873
- * _zpp = the `zpp_nape` internal namespace
1874
- */
1875
- static _nape: Any$G;
1876
- static _zpp: Any$G;
1877
- static types: Any$G[];
1878
- static bodystack: Any$G;
1879
- static bodyset: Any$G;
1880
- static cur_graph_depth: number;
1881
- static bodysetlt(a: Any$G, b: Any$G): boolean;
1882
- static __static(): Any$G;
1883
- outer_i: Any$G;
1884
- id: number;
1885
- userData: Any$G;
1886
- ishape: Any$G;
1887
- ibody: Any$G;
1888
- icompound: Any$G;
1889
- wrap_cbTypes: Any$G;
1890
- cbSet: Any$G;
1891
- cbTypes: Any$G;
1892
- group: Any$G;
1893
- cbsets: Any$G;
1894
- outer: Any$G;
1895
- world: boolean;
1896
- type: number;
1897
- compound: Any$G;
1898
- shapes: Any$G;
1899
- wrap_shapes: Any$G;
1900
- space: Any$G;
1901
- arbiters: Any$G;
1902
- wrap_arbiters: Any$G;
1903
- constraints: Any$G;
1904
- wrap_constraints: Any$G;
1905
- component: Any$G;
1906
- graph_depth: number;
1907
- sweepTime: number;
1908
- sweep_angvel: number;
1909
- sweepFrozen: boolean;
1910
- sweepRadius: number;
1911
- bullet: boolean;
1912
- bulletEnabled: boolean;
1913
- disableCCD: boolean;
1914
- pre_posx: number;
1915
- pre_posy: number;
1916
- posx: number;
1917
- posy: number;
1918
- wrap_pos: Any$G;
1919
- velx: number;
1920
- vely: number;
1921
- wrap_vel: Any$G;
1922
- forcex: number;
1923
- forcey: number;
1924
- wrap_force: Any$G;
1925
- kinvelx: number;
1926
- kinvely: number;
1927
- wrap_kinvel: Any$G;
1928
- svelx: number;
1929
- svely: number;
1930
- wrap_svel: Any$G;
1931
- wrapcvel: Any$G;
1932
- angvel: number;
1933
- torque: number;
1934
- kinangvel: number;
1935
- pre_rot: number;
1936
- rot: number;
1937
- axisx: number;
1938
- axisy: number;
1939
- zip_axis: boolean;
1940
- kinematicDelaySleep: boolean;
1941
- mass: number;
1942
- zip_mass: boolean;
1943
- massMode: number;
1944
- imass: number;
1945
- smass: number;
1946
- cmass: number;
1947
- nomove: boolean;
1948
- gravMass: number;
1949
- zip_gravMass: boolean;
1950
- gravMassMode: number;
1951
- gravMassScale: number;
1952
- zip_gravMassScale: boolean;
1953
- inertiaMode: number;
1954
- inertia: number;
1955
- zip_inertia: boolean;
1956
- cinertia: number;
1957
- iinertia: number;
1958
- sinertia: number;
1959
- norotate: boolean;
1960
- aabb: ZPP_AABB;
1961
- zip_aabb: boolean;
1962
- localCOMx: number;
1963
- localCOMy: number;
1964
- zip_localCOM: boolean;
1965
- worldCOMx: number;
1966
- worldCOMy: number;
1967
- zip_worldCOM: boolean;
1968
- wrap_localCOM: Any$G;
1969
- wrap_worldCOM: Any$G;
1970
- __class__: Any$G;
1971
- constructor();
1972
- isStatic(): boolean;
1973
- isDynamic(): boolean;
1974
- isKinematic(): boolean;
1975
- invalidate_type(): void;
1976
- invalidate_shapes(): void;
1977
- init_bodysetlist(): void;
1978
- connectedBodies_cont(b: Any$G): void;
1979
- connectedBodies(depth: number, output: Any$G): Any$G;
1980
- interactingBodies(type: number, output: Any$G): Any$G;
1981
- atRest(dt: number): boolean;
1982
- refreshArbiters(): void;
1983
- sweepIntegrate(dt: number): void;
1984
- sweepValidate(s: Any$G): void;
1985
- invalidate_pos(): void;
1986
- pos_invalidate(pos: Any$G): void;
1987
- pos_validate(): void;
1988
- vel_invalidate(vel: Any$G): void;
1989
- vel_validate(): void;
1990
- kinvel_invalidate(vel: Any$G): void;
1991
- kinvel_validate(): void;
1992
- svel_invalidate(vel: Any$G): void;
1993
- svel_validate(): void;
1994
- force_invalidate(force: Any$G): void;
1995
- force_validate(): void;
1996
- private _setupVec2Wrapper;
1997
- setupPosition(): void;
1998
- setupVelocity(): void;
1999
- setupkinvel(): void;
2000
- setupsvel(): void;
2001
- setupForce(): void;
2002
- cvel_validate(): void;
2003
- setup_cvel(): void;
2004
- invalidate_rot(): void;
2005
- validate_axis(): void;
2006
- quick_validate_axis(): void;
2007
- delta_rot(dr: number): void;
2008
- invalidate_mass(): void;
2009
- validate_mass(): void;
2010
- invalidate_gravMass(): void;
2011
- validate_gravMass(): void;
2012
- invalidate_gravMassScale(): void;
2013
- validate_gravMassScale(): void;
2014
- invalidate_inertia(): void;
2015
- validate_inertia(): void;
2016
- invalidate_wake(): void;
2017
- invalidate_aabb(): void;
2018
- validate_aabb(): void;
2019
- private _validateCircleAABB;
2020
- private _validatePolygonAABB;
2021
- aabb_validate(): void;
2022
- invalidate_localCOM(): void;
2023
- invalidate_worldCOM(): void;
2024
- private _computePolygonLocalCOM;
2025
- validate_localCOM(): void;
2026
- validate_worldCOM(): void;
2027
- getlocalCOM(): void;
2028
- getworldCOM(): void;
2029
- __immutable_midstep(): void;
2249
+ declare class Shape extends Interactor {
2250
+ /** @internal shapes are created via Circle or Polygon constructors. */
2251
+ protected constructor();
2252
+ /** @internal */
2253
+ static _wrap(inner: NapeInner): Shape;
2254
+ get type(): ShapeType;
2255
+ isCircle(): boolean;
2256
+ isPolygon(): boolean;
2257
+ get body(): Body;
2258
+ set body(value: Body | null);
2259
+ get castCircle(): Shape | null;
2260
+ get castPolygon(): Shape | null;
2261
+ get worldCOM(): Vec2;
2262
+ get localCOM(): Vec2;
2263
+ set localCOM(value: Vec2);
2264
+ get area(): number;
2265
+ get inertia(): number;
2266
+ get angDrag(): number;
2267
+ get material(): Material;
2268
+ set material(value: Material);
2269
+ get filter(): InteractionFilter;
2270
+ set filter(value: InteractionFilter);
2271
+ get fluidProperties(): FluidProperties;
2272
+ set fluidProperties(value: FluidProperties);
2273
+ /** Callback types assigned to this shape. */
2274
+ get cbTypes(): CbTypeSet;
2275
+ get fluidEnabled(): boolean;
2276
+ set fluidEnabled(value: boolean);
2277
+ get sensorEnabled(): boolean;
2278
+ set sensorEnabled(value: boolean);
2279
+ get bounds(): AABB;
2280
+ translate(translation: Vec2): Shape;
2281
+ scale(scaleX: number, scaleY: number): Shape;
2282
+ rotate(angle: number): Shape;
2283
+ transform(matrix: {
2284
+ _inner: NapeInner;
2285
+ }): Shape;
2286
+ contains(point: Vec2): boolean;
2287
+ copy(): Shape;
2288
+ toString(): string;
2289
+ /** @internal */ get_type(): ShapeType;
2290
+ /** @internal */ get_body(): Body;
2291
+ /** @internal */ set_body(v: Body | null): void;
2292
+ /** @internal */ get_castCircle(): Shape | null;
2293
+ /** @internal */ get_castPolygon(): Shape | null;
2294
+ /** @internal */ get_worldCOM(): Vec2;
2295
+ /** @internal */ get_localCOM(): Vec2;
2296
+ /** @internal */ set_localCOM(v: Vec2): void;
2297
+ /** @internal */ get_area(): number;
2298
+ /** @internal */ get_inertia(): number;
2299
+ /** @internal */ get_angDrag(): number;
2300
+ /** @internal */ get_material(): Material;
2301
+ /** @internal */ set_material(v: Material): void;
2302
+ /** @internal */ get_filter(): InteractionFilter;
2303
+ /** @internal */ set_filter(v: InteractionFilter): void;
2304
+ /** @internal */ get_fluidProperties(): FluidProperties;
2305
+ /** @internal */ set_fluidProperties(v: FluidProperties): void;
2306
+ /** @internal */ get_fluidEnabled(): boolean;
2307
+ /** @internal */ set_fluidEnabled(v: boolean): void;
2308
+ /** @internal */ get_sensorEnabled(): boolean;
2309
+ /** @internal */ set_sensorEnabled(v: boolean): void;
2310
+ /** @internal */ get_bounds(): AABB;
2311
+ /** Setup worldCOM lazy Vec2 wrapper */
2312
+ private _setupWorldCOM;
2313
+ }
2314
+ /** Lightweight typed interface for the callback type set on a shape. */
2315
+ interface CbTypeSet {
2316
+ readonly _inner: NapeInner;
2317
+ add(cbType: {
2318
+ _inner: NapeInner;
2319
+ }): void;
2320
+ remove(cbType: {
2321
+ _inner: NapeInner;
2322
+ }): void;
2323
+ has(cbType: {
2324
+ _inner: NapeInner;
2325
+ }): boolean;
2030
2326
  clear(): void;
2031
- shapes_adder(s: Any$G): boolean;
2032
- shapes_subber(s: Any$G): void;
2033
- shapes_invalidate(_param: Any$G): void;
2034
- shapes_modifiable(): void;
2035
- addedToSpace(): void;
2036
- removedFromSpace(): void;
2037
- private _removeArbiterFromList;
2038
- copy(): Any$G;
2039
- wake: () => void;
2040
- __iaddedToSpace: () => void;
2041
- __iremovedFromSpace: () => void;
2042
- immutable_midstep: (name: string) => void;
2043
- copyto: (ret: Any$G) => void;
2044
- insert_cbtype: (cb: Any$G) => void;
2045
- alloc_cbSet: () => void;
2046
- dealloc_cbSet: () => void;
2047
- setupcbTypes: () => void;
2048
- immutable_cbTypes: () => void;
2049
- wrap_cbTypes_subber: (pcb: Any$G) => void;
2050
- wrap_cbTypes_adder: (cb: Any$G) => void;
2051
- setGroup: (group: Any$G) => void;
2052
- lookup_group: () => Any$G;
2053
- getSpace: () => Any$G;
2054
- isShape: () => boolean;
2055
- isBody: () => boolean;
2056
- isCompound: () => boolean;
2057
- static _initialized: boolean;
2058
- static _init(zpp: Any$G, nape: Any$G): void;
2327
+ readonly length: number;
2059
2328
  }
2060
2329
 
2061
- type Any$F = any;
2062
2330
  /**
2063
- * A rigid body in the physics simulation.
2331
+ * Static utility class for geometric queries between shapes and bodies.
2064
2332
  *
2065
- * Fully modernized — all methods implemented directly using ZPP_Body.
2333
+ * Fully modernized — calls ZPP_Geom, ZPP_SweepDistance, and ZPP_Collide directly.
2066
2334
  */
2067
- declare class Body extends Interactor {
2335
+ declare class Geom {
2068
2336
  static __name__: string[];
2069
- static __super__: Any$F;
2070
- /** Direct access to the extracted internal ZPP_Body. */
2071
- zpp_inner: ZPP_Body;
2072
- debugDraw: boolean;
2073
- constructor(type?: BodyType, position?: Vec2);
2074
- /** @internal */
2075
- static _wrap(inner: NapeInner): Body;
2076
- get type(): BodyType;
2077
- set type(value: BodyType);
2078
- isStatic(): boolean;
2079
- isDynamic(): boolean;
2080
- isKinematic(): boolean;
2081
- get position(): Vec2;
2082
- set position(value: Vec2);
2083
- get rotation(): number;
2084
- set rotation(value: number);
2085
- get velocity(): Vec2;
2086
- set velocity(value: Vec2);
2087
- get angularVel(): number;
2088
- set angularVel(value: number);
2089
- get kinematicVel(): Vec2;
2090
- set kinematicVel(value: Vec2);
2091
- get kinAngVel(): number;
2092
- set kinAngVel(value: number);
2093
- get surfaceVel(): Vec2;
2094
- set surfaceVel(value: Vec2);
2095
- get force(): Vec2;
2096
- set force(value: Vec2);
2097
- get torque(): number;
2098
- set torque(value: number);
2099
- get mass(): number;
2100
- set mass(value: number);
2101
- get inertia(): number;
2102
- set inertia(value: number);
2103
- get constraintMass(): number;
2104
- get constraintInertia(): number;
2105
- get gravMass(): number;
2106
- set gravMass(value: number);
2107
- get gravMassScale(): number;
2108
- set gravMassScale(value: number);
2109
- get isBullet(): boolean;
2110
- set isBullet(value: boolean);
2111
- get disableCCD(): boolean;
2112
- set disableCCD(value: boolean);
2113
- get allowMovement(): boolean;
2114
- set allowMovement(value: boolean);
2115
- get allowRotation(): boolean;
2116
- set allowRotation(value: boolean);
2117
- get isSleeping(): boolean;
2118
- get shapes(): NapeList<Shape>;
2119
- get space(): Space;
2120
- set space(value: Space | null);
2121
- get compound(): Any$F;
2122
- set compound(value: Any$F);
2123
- get bounds(): AABB;
2124
- get constraintVelocity(): Vec2;
2125
- get localCOM(): Vec2;
2126
- get worldCOM(): Vec2;
2127
- get massMode(): Any$F;
2128
- set massMode(value: Any$F);
2129
- get inertiaMode(): Any$F;
2130
- set inertiaMode(value: Any$F);
2131
- get gravMassMode(): Any$F;
2132
- set gravMassMode(value: Any$F);
2133
- copy(): Body;
2134
- toString(): string;
2135
- get_type(): Any$F;
2136
- set_type(type: Any$F): Any$F;
2137
- get_shapes(): Any$F;
2138
- get_isBullet(): boolean;
2139
- set_isBullet(v: boolean): boolean;
2140
- get_disableCCD(): boolean;
2141
- set_disableCCD(v: boolean): boolean;
2142
- get_position(): Any$F;
2143
- set_position(position: Any$F): Any$F;
2144
- get_velocity(): Any$F;
2145
- set_velocity(velocity: Any$F): Any$F;
2146
- get_rotation(): number;
2147
- set_rotation(rotation: number): number;
2148
- get_angularVel(): number;
2149
- set_angularVel(angularVel: number): number;
2150
- get_kinematicVel(): Any$F;
2151
- set_kinematicVel(kinematicVel: Any$F): Any$F;
2152
- get_kinAngVel(): number;
2153
- set_kinAngVel(kinAngVel: number): number;
2154
- get_surfaceVel(): Any$F;
2155
- set_surfaceVel(surfaceVel: Any$F): Any$F;
2156
- get_force(): Any$F;
2157
- set_force(force: Any$F): Any$F;
2158
- get_torque(): number;
2159
- set_torque(torque: number): number;
2160
- get_bounds(): Any$F;
2161
- get_constraintVelocity(): Any$F;
2162
- get_constraintMass(): number;
2163
- get_constraintInertia(): number;
2164
- get_allowMovement(): boolean;
2165
- set_allowMovement(allowMovement: boolean): boolean;
2166
- get_allowRotation(): boolean;
2167
- set_allowRotation(allowRotation: boolean): boolean;
2168
- get_isSleeping(): boolean;
2169
- get_compound(): Any$F;
2170
- set_compound(compound: Any$F): Any$F;
2171
- get_space(): Any$F;
2172
- set_space(space: Any$F): Any$F;
2173
- get_arbiters(): Any$F;
2174
- get_constraints(): Any$F;
2175
- get_massMode(): Any$F;
2176
- set_massMode(massMode: Any$F): Any$F;
2177
- get_mass(): number;
2178
- set_mass(mass: number): number;
2179
- get_gravMassMode(): Any$F;
2180
- set_gravMassMode(gravMassMode: Any$F): Any$F;
2181
- get_gravMass(): number;
2182
- set_gravMass(gravMass: number): number;
2183
- get_gravMassScale(): number;
2184
- set_gravMassScale(gravMassScale: number): number;
2185
- get_inertiaMode(): Any$F;
2186
- set_inertiaMode(inertiaMode: Any$F): Any$F;
2187
- get_inertia(): number;
2188
- set_inertia(inertia: number): number;
2189
- get_localCOM(): Any$F;
2190
- get_worldCOM(): Any$F;
2191
- integrate(deltaTime: number): Body;
2192
- localPointToWorld(point: Vec2, weak?: boolean): Vec2;
2193
- worldPointToLocal(point: Vec2, weak?: boolean): Vec2;
2194
- localVectorToWorld(vector: Vec2, weak?: boolean): Vec2;
2195
- worldVectorToLocal(vector: Vec2, weak?: boolean): Vec2;
2196
- applyImpulse(impulse: Vec2, pos?: Vec2, sleepable?: boolean): Body;
2197
- applyAngularImpulse(impulse: number, sleepable?: boolean): Body;
2198
- setVelocityFromTarget(targetPosition: Vec2, targetRotation: number, deltaTime: number): Body;
2199
- translateShapes(translation: Vec2): Body;
2200
- rotateShapes(angle: number): Body;
2201
- scaleShapes(scaleX: number, scaleY: number): Body;
2202
- transformShapes(matrix: Any$F): Body;
2203
- align(): Body;
2204
- rotate(centre: Vec2, angle: number): Body;
2205
- setShapeMaterials(material: Any$F): Body;
2206
- setShapeFilters(filter: Any$F): Body;
2207
- setShapeFluidProperties(fluidProperties: Any$F): Body;
2208
- contains(point: Vec2): boolean;
2209
- connectedBodies(depth?: number, output?: Any$F): Any$F;
2210
- interactingBodies(type?: Any$F, depth?: number, output?: Any$F): Any$F;
2211
- normalImpulse(body?: Any$F, freshOnly?: boolean): Vec3;
2212
- tangentImpulse(body?: Any$F, freshOnly?: boolean): Vec3;
2213
- totalContactsImpulse(body?: Any$F, freshOnly?: boolean): Vec3;
2214
- rollingImpulse(body?: Any$F, freshOnly?: boolean): number;
2215
- buoyancyImpulse(body?: Any$F): Vec3;
2216
- dragImpulse(body?: Any$F): Vec3;
2217
- totalFluidImpulse(body?: Any$F): Vec3;
2218
- constraintsImpulse(): Vec3;
2219
- totalImpulse(body?: Any$F, freshOnly?: boolean): Vec3;
2220
- crushFactor(): number;
2221
- private _arbiterImpulseQuery;
2337
+ /**
2338
+ * Calculate minimum distance between two bodies and return closest points.
2339
+ */
2340
+ static distanceBody(body1: Body, body2: Body, out1: Vec2, out2: Vec2): number;
2341
+ /**
2342
+ * Calculate minimum distance between two shapes and return closest points.
2343
+ */
2344
+ static distance(shape1: Shape, shape2: Shape, out1: Vec2, out2: Vec2): number;
2345
+ /**
2346
+ * Test if two bodies intersect (any of their shapes overlap).
2347
+ */
2348
+ static intersectsBody(body1: Body, body2: Body): boolean;
2349
+ /**
2350
+ * Test if two shapes intersect.
2351
+ */
2352
+ static intersects(shape1: Shape, shape2: Shape): boolean;
2353
+ /**
2354
+ * Test if shape1 fully contains shape2.
2355
+ */
2356
+ static contains(shape1: Shape, shape2: Shape): boolean;
2222
2357
  }
2223
2358
 
2224
2359
  /**
@@ -2229,77 +2364,77 @@ declare class Body extends Interactor {
2229
2364
  *
2230
2365
  * Converted from nape-compiled.js lines 55195–55521.
2231
2366
  */
2232
- type Any$E = any;
2367
+ type Any$I = any;
2233
2368
  declare class ZPP_Compound {
2234
2369
  static __name__: string[];
2235
- static __super__: Any$E;
2370
+ static __super__: Any$I;
2236
2371
  /**
2237
2372
  * Namespace references, set by the compiled module after import.
2238
2373
  * _nape = the `nape` public namespace (for wrapper creation in copy())
2239
2374
  * _zpp = the `zpp_nape` internal namespace (for ZNPList_*, ZPP_BodyList, etc.)
2240
2375
  */
2241
- static _nape: Any$E;
2242
- static _zpp: Any$E;
2376
+ static _nape: Any$I;
2377
+ static _zpp: Any$I;
2243
2378
  /**
2244
2379
  * Wrapper factory callback, registered by the modernized Compound class.
2245
2380
  * When set, wrapper() uses this instead of the compiled Compound constructor.
2246
2381
  */
2247
- static _wrapFn: ((zpp: ZPP_Compound) => Any$E) | null;
2248
- outer_i: Any$E;
2382
+ static _wrapFn: ((zpp: ZPP_Compound) => Any$I) | null;
2383
+ outer_i: Any$I;
2249
2384
  id: number;
2250
- userData: Any$E;
2251
- ishape: Any$E;
2252
- ibody: Any$E;
2253
- icompound: Any$E;
2254
- wrap_cbTypes: Any$E;
2255
- cbSet: Any$E;
2256
- cbTypes: Any$E;
2257
- group: Any$E;
2258
- cbsets: Any$E;
2259
- outer: Any$E;
2260
- bodies: Any$E;
2261
- constraints: Any$E;
2262
- compounds: Any$E;
2263
- wrap_bodies: Any$E;
2264
- wrap_constraints: Any$E;
2265
- wrap_compounds: Any$E;
2385
+ userData: Any$I;
2386
+ ishape: Any$I;
2387
+ ibody: Any$I;
2388
+ icompound: Any$I;
2389
+ wrap_cbTypes: Any$I;
2390
+ cbSet: Any$I;
2391
+ cbTypes: Any$I;
2392
+ group: Any$I;
2393
+ cbsets: Any$I;
2394
+ outer: Any$I;
2395
+ bodies: Any$I;
2396
+ constraints: Any$I;
2397
+ compounds: Any$I;
2398
+ wrap_bodies: Any$I;
2399
+ wrap_constraints: Any$I;
2400
+ wrap_compounds: Any$I;
2266
2401
  depth: number;
2267
- compound: Any$E;
2268
- space: Any$E;
2269
- __class__: Any$E;
2402
+ compound: Any$I;
2403
+ space: Any$I;
2404
+ __class__: Any$I;
2270
2405
  constructor();
2271
2406
  __imutable_midstep(name: string): void;
2272
2407
  addedToSpace(): void;
2273
2408
  removedFromSpace(): void;
2274
2409
  breakApart(): void;
2275
2410
  private static _zppOf;
2276
- bodies_adder(x: Any$E): boolean;
2277
- bodies_subber(x: Any$E): void;
2411
+ bodies_adder(x: Any$I): boolean;
2412
+ bodies_subber(x: Any$I): void;
2278
2413
  bodies_modifiable(): void;
2279
- constraints_adder(x: Any$E): boolean;
2280
- constraints_subber(x: Any$E): void;
2414
+ constraints_adder(x: Any$I): boolean;
2415
+ constraints_subber(x: Any$I): void;
2281
2416
  constraints_modifiable(): void;
2282
- compounds_adder(x: Any$E): boolean;
2283
- compounds_subber(x: Any$E): void;
2417
+ compounds_adder(x: Any$I): boolean;
2418
+ compounds_subber(x: Any$I): void;
2284
2419
  compounds_modifiable(): void;
2285
- copy(dict?: Any$E[], todo?: Any$E[]): Any$E;
2420
+ copy(dict?: Any$I[], todo?: Any$I[]): Any$I;
2286
2421
  isShape: () => boolean;
2287
2422
  isBody: () => boolean;
2288
2423
  isCompound: () => boolean;
2289
2424
  __iaddedToSpace: () => void;
2290
2425
  __iremovedFromSpace: () => void;
2291
2426
  wake: () => void;
2292
- getSpace: () => Any$E;
2427
+ getSpace: () => Any$I;
2293
2428
  setupcbTypes: () => void;
2294
2429
  immutable_cbTypes: () => void;
2295
- wrap_cbTypes_subber: (pcb: Any$E) => void;
2296
- wrap_cbTypes_adder: (cb: Any$E) => boolean;
2297
- insert_cbtype: (cb: Any$E) => void;
2430
+ wrap_cbTypes_subber: (pcb: Any$I) => void;
2431
+ wrap_cbTypes_adder: (cb: Any$I) => boolean;
2432
+ insert_cbtype: (cb: Any$I) => void;
2298
2433
  alloc_cbSet: () => void;
2299
2434
  dealloc_cbSet: () => void;
2300
2435
  immutable_midstep: (name: string) => void;
2301
- copyto: (ret: Any$E) => void;
2302
- lookup_group: () => Any$E;
2436
+ copyto: (ret: Any$I) => void;
2437
+ lookup_group: () => Any$I;
2303
2438
  /**
2304
2439
  * Initialize prototype by copying ZPP_Interactor methods.
2305
2440
  * Must be called after _zpp is set (during compiled module init).
@@ -2307,7 +2442,7 @@ declare class ZPP_Compound {
2307
2442
  static _init(): void;
2308
2443
  }
2309
2444
 
2310
- type Any$D = any;
2445
+ type Any$H = any;
2311
2446
  /**
2312
2447
  * A compound physics object — a hierarchical grouping of Bodies, Constraints,
2313
2448
  * and other Compounds.
@@ -2316,18 +2451,18 @@ type Any$D = any;
2316
2451
  */
2317
2452
  declare class Compound extends Interactor {
2318
2453
  static __name__: string[];
2319
- static __super__: Any$D;
2454
+ static __super__: Any$H;
2320
2455
  /** Direct access to the extracted internal ZPP_Compound. */
2321
2456
  zpp_inner: ZPP_Compound;
2322
2457
  constructor();
2323
2458
  /** @internal */
2324
2459
  static _wrap(inner: NapeInner): Compound;
2325
2460
  /** Bodies in this compound. */
2326
- get bodies(): Any$D;
2461
+ get bodies(): Any$H;
2327
2462
  /** Constraints in this compound. */
2328
- get constraints(): Any$D;
2463
+ get constraints(): Any$H;
2329
2464
  /** Child compounds in this compound. */
2330
- get compounds(): Any$D;
2465
+ get compounds(): Any$H;
2331
2466
  /** Parent compound, or null if this is a root compound. */
2332
2467
  get compound(): Compound | null;
2333
2468
  set compound(value: Compound | null);
@@ -2341,7 +2476,7 @@ declare class Compound extends Interactor {
2341
2476
  /** Recursively visit all bodies in this compound and its sub-compounds. */
2342
2477
  visitBodies(lambda: (body: Body) => void): void;
2343
2478
  /** Recursively visit all constraints in this compound and its sub-compounds. */
2344
- visitConstraints(lambda: (constraint: Any$D) => void): void;
2479
+ visitConstraints(lambda: (constraint: Any$H) => void): void;
2345
2480
  /** Recursively visit all sub-compounds in this compound. */
2346
2481
  visitCompounds(lambda: (compound: Compound) => void): void;
2347
2482
  /** Calculate the center of mass of all bodies in this compound. */
@@ -2351,13 +2486,13 @@ declare class Compound extends Interactor {
2351
2486
  /** Rotate all bodies in this compound around the given centre point. */
2352
2487
  rotate(centre: Vec2, angle: number): Compound;
2353
2488
  toString(): string;
2354
- get_bodies(): Any$D;
2355
- get_constraints(): Any$D;
2356
- get_compounds(): Any$D;
2357
- get_compound(): Any$D;
2358
- set_compound(compound: Any$D): Any$D;
2359
- get_space(): Any$D;
2360
- set_space(space: Any$D): Any$D;
2489
+ get_bodies(): Any$H;
2490
+ get_constraints(): Any$H;
2491
+ get_compounds(): Any$H;
2492
+ get_compound(): Any$H;
2493
+ set_compound(compound: Any$H): Any$H;
2494
+ get_space(): Any$H;
2495
+ set_space(space: Any$H): Any$H;
2361
2496
  }
2362
2497
 
2363
2498
  /**
@@ -2425,21 +2560,21 @@ declare class MassMode {
2425
2560
  *
2426
2561
  * Converted from nape-compiled.js lines 41496–41827.
2427
2562
  */
2428
- type Any$C = any;
2563
+ type Any$G = any;
2429
2564
  declare class ZPP_Circle {
2430
2565
  static __name__: string[];
2431
- static __super__: Any$C;
2432
- static _nape: Any$C;
2433
- static _zpp: Any$C;
2566
+ static __super__: Any$G;
2567
+ static _nape: Any$G;
2568
+ static _zpp: Any$G;
2434
2569
  static _initialized: boolean;
2435
2570
  radius: number;
2436
- outer_zn: Any$C;
2437
- __class__: Any$C;
2438
- body: Any$C;
2571
+ outer_zn: Any$G;
2572
+ __class__: Any$G;
2573
+ body: Any$G;
2439
2574
  type: number;
2440
- circle: Any$C;
2441
- polygon: Any$C;
2442
- aabb: Any$C;
2575
+ circle: Any$G;
2576
+ polygon: Any$G;
2577
+ aabb: Any$G;
2443
2578
  localCOMx: number;
2444
2579
  localCOMy: number;
2445
2580
  worldCOMx: number;
@@ -2453,25 +2588,25 @@ declare class ZPP_Circle {
2453
2588
  angDrag: number;
2454
2589
  sweepCoef: number;
2455
2590
  sweepRadius: number;
2456
- material: Any$C;
2457
- filter: Any$C;
2458
- wrap_localCOM: Any$C;
2459
- outer: Any$C;
2460
- outer_i: Any$C;
2461
- space: Any$C;
2591
+ material: Any$G;
2592
+ filter: Any$G;
2593
+ wrap_localCOM: Any$G;
2594
+ outer: Any$G;
2595
+ outer_i: Any$G;
2596
+ space: Any$G;
2462
2597
  invalidate_area_inertia: () => void;
2463
2598
  invalidate_angDrag: () => void;
2464
2599
  invalidate_localCOM: () => void;
2465
2600
  immutable_midstep: (name: string) => void;
2466
- setMaterial: (mat: Any$C) => void;
2467
- setFilter: (filt: Any$C) => void;
2468
- insert_cbtype: (cb: Any$C) => void;
2601
+ setMaterial: (mat: Any$G) => void;
2602
+ setFilter: (filt: Any$G) => void;
2603
+ insert_cbtype: (cb: Any$G) => void;
2469
2604
  constructor();
2470
2605
  static _init(): void;
2471
2606
  __clear(): void;
2472
2607
  invalidate_radius(): void;
2473
2608
  localCOM_validate(): void;
2474
- localCOM_invalidate(x: Any$C): void;
2609
+ localCOM_invalidate(x: Any$G): void;
2475
2610
  localCOM_immutable(): void;
2476
2611
  setupLocalCOM(): void;
2477
2612
  __validate_aabb(): void;
@@ -2482,11 +2617,11 @@ declare class ZPP_Circle {
2482
2617
  __scale(sx: number, sy: number): void;
2483
2618
  __translate(x: number, y: number): void;
2484
2619
  __rotate(x: number, y: number): void;
2485
- __transform(m: Any$C): void;
2486
- __copy(): Any$C;
2620
+ __transform(m: Any$G): void;
2621
+ __copy(): Any$G;
2487
2622
  }
2488
2623
 
2489
- type Any$B = any;
2624
+ type Any$F = any;
2490
2625
  /**
2491
2626
  * A circular physics shape.
2492
2627
  *
@@ -2496,7 +2631,7 @@ type Any$B = any;
2496
2631
  */
2497
2632
  declare class Circle extends Shape {
2498
2633
  static __name__: string[];
2499
- static __super__: Any$B;
2634
+ static __super__: Any$F;
2500
2635
  /** Direct access to the extracted internal ZPP_Circle. */
2501
2636
  zpp_inner_zn: ZPP_Circle;
2502
2637
  constructor(radius?: number, localCOM?: Vec2, material?: Material, filter?: InteractionFilter);
@@ -2506,26 +2641,152 @@ declare class Circle extends Shape {
2506
2641
  set radius(value: number);
2507
2642
  }
2508
2643
 
2644
+ /**
2645
+ * ZPP_Polygon — Internal polygon shape for the nape physics engine.
2646
+ *
2647
+ * Extends ZPP_Shape (type=1). Manages vertex rings (local/world),
2648
+ * edge lists, validation, and polygon-specific physics calculations.
2649
+ *
2650
+ * Converted from nape-compiled.js lines 42176–43786.
2651
+ */
2652
+ type Any$E = any;
2653
+ declare class ZPP_Polygon {
2654
+ static __name__: string[];
2655
+ static __super__: Any$E;
2656
+ static _nape: Any$E;
2657
+ static _zpp: Any$E;
2658
+ static _initialized: boolean;
2659
+ outer_zn: Any$E;
2660
+ lverts: Any$E;
2661
+ wrap_lverts: Any$E;
2662
+ gverts: Any$E;
2663
+ wrap_gverts: Any$E;
2664
+ edges: Any$E;
2665
+ wrap_edges: Any$E;
2666
+ edgeCnt: number;
2667
+ reverse_flag: boolean;
2668
+ zip_lverts: boolean;
2669
+ zip_laxi: boolean;
2670
+ zip_gverts: boolean;
2671
+ zip_gaxi: boolean;
2672
+ zip_valid: boolean;
2673
+ zip_sanitation: boolean;
2674
+ validation: Any$E;
2675
+ __class__: Any$E;
2676
+ body: Any$E;
2677
+ type: number;
2678
+ circle: Any$E;
2679
+ polygon: Any$E;
2680
+ aabb: Any$E;
2681
+ localCOMx: number;
2682
+ localCOMy: number;
2683
+ worldCOMx: number;
2684
+ worldCOMy: number;
2685
+ zip_localCOM: boolean;
2686
+ zip_worldCOM: boolean;
2687
+ zip_aabb: boolean;
2688
+ zip_sweepRadius: boolean;
2689
+ zip_area_inertia: boolean;
2690
+ zip_angDrag: boolean;
2691
+ area: number;
2692
+ inertia: number;
2693
+ angDrag: number;
2694
+ sweepCoef: number;
2695
+ sweepRadius: number;
2696
+ material: Any$E;
2697
+ filter: Any$E;
2698
+ wrap_localCOM: Any$E;
2699
+ outer: Any$E;
2700
+ outer_i: Any$E;
2701
+ invalidate_area_inertia: () => void;
2702
+ invalidate_angDrag: () => void;
2703
+ invalidate_localCOM: () => void;
2704
+ invalidate_worldCOM: () => void;
2705
+ validate_area_inertia: () => void;
2706
+ validate_localCOM: () => void;
2707
+ immutable_midstep: (name: string) => void;
2708
+ wake: () => void;
2709
+ setMaterial: (m: Any$E) => void;
2710
+ setFilter: (f: Any$E) => void;
2711
+ insert_cbtype: (cb: Any$E) => void;
2712
+ constructor();
2713
+ static _init(): void;
2714
+ __clear(): void;
2715
+ lverts_pa_invalidate(_x: Any$E): void;
2716
+ lverts_pa_immutable(): void;
2717
+ gverts_pa_validate(): void;
2718
+ lverts_post_adder(x: Any$E): void;
2719
+ lverts_subber(x: Any$E): void;
2720
+ lverts_invalidate(_: Any$E): void;
2721
+ lverts_validate(): void;
2722
+ lverts_modifiable(): void;
2723
+ gverts_validate(): void;
2724
+ edges_validate(): void;
2725
+ getlverts(): void;
2726
+ getgverts(): void;
2727
+ getedges(): void;
2728
+ invalidate_lverts(): void;
2729
+ invalidate_laxi(): void;
2730
+ invalidate_gverts(): void;
2731
+ invalidate_gaxi(): void;
2732
+ validate_lverts(): void;
2733
+ validate_laxi(): void;
2734
+ validate_gverts(): void;
2735
+ validate_gaxi(): void;
2736
+ /** Internal helper: recompute world vertex positions from local verts + body transform */
2737
+ private _validateGverts;
2738
+ cleanup_lvert(x: Any$E): void;
2739
+ splice_collinear(): void;
2740
+ splice_collinear_real(): void;
2741
+ reverse_vertices(): void;
2742
+ valid(): Any$E;
2743
+ /** Helper: check if two edges (u1→v1) and (a→b) do NOT intersect */
2744
+ private _checkNoIntersection;
2745
+ __validate_aabb(): void;
2746
+ _force_validate_aabb(): void;
2747
+ __validate_sweepRadius(): void;
2748
+ __validate_area_inertia(): void;
2749
+ __validate_angDrag(): void;
2750
+ __validate_localCOM(): void;
2751
+ localCOM_validate(): void;
2752
+ localCOM_invalidate(x: Any$E): void;
2753
+ setupLocalCOM(): void;
2754
+ __translate(dx: number, dy: number): void;
2755
+ __scale(sx: number, sy: number): void;
2756
+ __rotate(ax: number, ay: number): void;
2757
+ __transform(mat: Any$E): void;
2758
+ __copy(): Any$E;
2759
+ }
2760
+
2761
+ type Any$D = any;
2509
2762
  /**
2510
2763
  * A convex polygon physics shape.
2511
2764
  *
2765
+ * Fully modernized — uses ZPP_Polygon directly (extracted to TypeScript).
2512
2766
  * Use the static helper methods (`box`, `rect`, `regular`) for common shapes.
2513
2767
  */
2514
2768
  declare class Polygon extends Shape {
2515
- constructor(vertices?: Vec2[] | NapeInner, material?: Material, filter?: InteractionFilter);
2769
+ static __name__: string[];
2770
+ static __super__: Any$D;
2771
+ /** Direct access to the extracted internal ZPP_Polygon. */
2772
+ zpp_inner_zn: ZPP_Polygon;
2773
+ constructor(localVerts?: Vec2[] | Any$D, material?: Material, filter?: InteractionFilter);
2516
2774
  /** @internal */
2517
2775
  static _wrap(inner: NapeInner): Polygon;
2518
- static box(width: number, height: number, weak?: boolean): NapeInner;
2519
- static rect(x: number, y: number, width: number, height: number, weak?: boolean): NapeInner;
2520
- static regular(xRadius: number, yRadius: number, sides: number, angle?: number, weak?: boolean): NapeInner;
2776
+ static rect(x: number, y: number, width: number, height: number, weak?: boolean): Vec2[];
2777
+ static box(width: number, height?: number, weak?: boolean): Vec2[];
2778
+ static regular(xRadius: number, yRadius: number, edgeCount: number, angleOffset?: number, weak?: boolean): Vec2[];
2521
2779
  /** Read-only list of local-space vertices. */
2522
- get localVerts(): NapeInner;
2780
+ get localVerts(): Any$D;
2523
2781
  /** Read-only list of world-space vertices (computed after stepping). */
2524
- get worldVerts(): NapeInner;
2782
+ get worldVerts(): Any$D;
2525
2783
  /** Read-only edge list. */
2526
- get edges(): NapeInner;
2784
+ get edges(): Any$D;
2527
2785
  /** Validate the polygon geometry. */
2528
- validity(): NapeInner;
2786
+ validity(): Any$D;
2787
+ /** @internal */ get_localVerts(): Any$D;
2788
+ /** @internal */ get_worldVerts(): Any$D;
2789
+ /** @internal */ get_edges(): Any$D;
2529
2790
  }
2530
2791
 
2531
2792
  /**
@@ -2536,44 +2797,44 @@ declare class Polygon extends Shape {
2536
2797
  *
2537
2798
  * Converted from nape-compiled.js lines 41828–42175.
2538
2799
  */
2539
- type Any$A = any;
2800
+ type Any$C = any;
2540
2801
  declare class ZPP_Edge {
2541
2802
  static __name__: string[];
2542
2803
  static zpp_pool: ZPP_Edge | null;
2543
2804
  static internal: boolean;
2544
- static _nape: Any$A;
2545
- static _zpp: Any$A;
2546
- static _wrapFn: ((zpp: ZPP_Edge) => Any$A) | null;
2805
+ static _nape: Any$C;
2806
+ static _zpp: Any$C;
2807
+ static _wrapFn: ((zpp: ZPP_Edge) => Any$C) | null;
2547
2808
  next: ZPP_Edge | null;
2548
- polygon: Any$A;
2549
- outer: Any$A;
2809
+ polygon: Any$C;
2810
+ outer: Any$C;
2550
2811
  lnormx: number;
2551
2812
  lnormy: number;
2552
- wrap_lnorm: Any$A;
2813
+ wrap_lnorm: Any$C;
2553
2814
  gnormx: number;
2554
2815
  gnormy: number;
2555
- wrap_gnorm: Any$A;
2816
+ wrap_gnorm: Any$C;
2556
2817
  length: number;
2557
2818
  lprojection: number;
2558
2819
  gprojection: number;
2559
- lp0: Any$A;
2560
- gp0: Any$A;
2561
- lp1: Any$A;
2562
- gp1: Any$A;
2820
+ lp0: Any$C;
2821
+ gp0: Any$C;
2822
+ lp1: Any$C;
2823
+ gp1: Any$C;
2563
2824
  tp0: number;
2564
2825
  tp1: number;
2565
- __class__: Any$A;
2826
+ __class__: Any$C;
2566
2827
  constructor();
2567
2828
  free(): void;
2568
2829
  alloc(): void;
2569
- wrapper(): Any$A;
2830
+ wrapper(): Any$C;
2570
2831
  lnorm_validate(): void;
2571
2832
  gnorm_validate(): void;
2572
2833
  getlnorm(): void;
2573
2834
  getgnorm(): void;
2574
2835
  }
2575
2836
 
2576
- type Any$z = any;
2837
+ type Any$B = any;
2577
2838
  /**
2578
2839
  * An edge of a polygon shape.
2579
2840
  *
@@ -2588,9 +2849,9 @@ declare class Edge {
2588
2849
  zpp_inner: ZPP_Edge;
2589
2850
  constructor();
2590
2851
  /** @internal */
2591
- static _wrap(inner: Any$z): Edge;
2852
+ static _wrap(inner: Any$B): Edge;
2592
2853
  /** Parent polygon (as compiled Polygon wrapper). */
2593
- get polygon(): Any$z;
2854
+ get polygon(): Any$B;
2594
2855
  /** Local-space normal vector (immutable Vec2). */
2595
2856
  get localNormal(): Vec2;
2596
2857
  /** World-space normal vector (immutable Vec2). Requires polygon in a body. */
@@ -2689,17 +2950,17 @@ declare class ArbiterType {
2689
2950
  *
2690
2951
  * Converted from nape-compiled.js lines 29044–29362, 80738–80766.
2691
2952
  */
2692
- type Any$y = any;
2953
+ type Any$A = any;
2693
2954
  declare class ZPP_Arbiter {
2694
2955
  static __name__: string[];
2695
- static _nape: Any$y;
2696
- static _zpp: Any$y;
2956
+ static _nape: Any$A;
2957
+ static _zpp: Any$A;
2697
2958
  static internal: boolean;
2698
2959
  static COL: number;
2699
2960
  static FLUID: number;
2700
2961
  static SENSOR: number;
2701
- static types: Any$y[];
2702
- outer: Any$y;
2962
+ static types: Any$A[];
2963
+ outer: Any$A;
2703
2964
  hnext: ZPP_Arbiter | null;
2704
2965
  id: number;
2705
2966
  di: number;
@@ -2717,31 +2978,31 @@ declare class ZPP_Arbiter {
2717
2978
  fresh: boolean;
2718
2979
  immState: number;
2719
2980
  invalidated: boolean;
2720
- b1: Any$y;
2721
- b2: Any$y;
2722
- ws1: Any$y;
2723
- ws2: Any$y;
2724
- pair: Any$y;
2981
+ b1: Any$A;
2982
+ b2: Any$A;
2983
+ ws1: Any$A;
2984
+ ws2: Any$A;
2985
+ pair: Any$A;
2725
2986
  type: number;
2726
- colarb: Any$y;
2727
- fluidarb: Any$y;
2728
- sensorarb: Any$y;
2729
- __class__: Any$y;
2987
+ colarb: Any$A;
2988
+ fluidarb: Any$A;
2989
+ sensorarb: Any$A;
2990
+ __class__: Any$A;
2730
2991
  constructor();
2731
- wrapper(): Any$y;
2992
+ wrapper(): Any$A;
2732
2993
  inactiveme(): boolean;
2733
2994
  acting(): boolean;
2734
2995
  swap_features(): void;
2735
- lazyRetire(s: Any$y, b: Any$y): void;
2736
- sup_assign(s1: Any$y, s2: Any$y, id: number, di: number): void;
2996
+ lazyRetire(s: Any$A, b: Any$A): void;
2997
+ sup_assign(s1: Any$A, s2: Any$A, id: number, di: number): void;
2737
2998
  sup_retire(): void;
2738
2999
  /** Remove this arbiter from a ZNPList_ZPP_Arbiter */
2739
- static _removeFromArbiterList(list: Any$y, arb: ZPP_Arbiter, zpp: Any$y): void;
3000
+ static _removeFromArbiterList(list: Any$A, arb: ZPP_Arbiter, zpp: Any$A): void;
2740
3001
  /** Add this arbiter to a ZNPList_ZPP_Arbiter */
2741
- static _addToArbiterList(list: Any$y, arb: ZPP_Arbiter, zpp: Any$y): void;
3002
+ static _addToArbiterList(list: Any$A, arb: ZPP_Arbiter, zpp: Any$A): void;
2742
3003
  }
2743
3004
 
2744
- type Any$x = any;
3005
+ type Any$z = any;
2745
3006
  /**
2746
3007
  * Represents an interaction arbiter between two shapes.
2747
3008
  *
@@ -2760,21 +3021,21 @@ declare class Arbiter {
2760
3021
  /** Whether this arbiter is currently sleeping. */
2761
3022
  get isSleeping(): boolean;
2762
3023
  /** The type of this arbiter (COLLISION, SENSOR, or FLUID). */
2763
- get type(): Any$x;
3024
+ get type(): Any$z;
2764
3025
  /** Cast to CollisionArbiter if this is a collision, else null. */
2765
- get collisionArbiter(): Any$x;
3026
+ get collisionArbiter(): Any$z;
2766
3027
  /** Cast to FluidArbiter if this is a fluid interaction, else null. */
2767
- get fluidArbiter(): Any$x;
3028
+ get fluidArbiter(): Any$z;
2768
3029
  /** First shape (lower id). */
2769
- get shape1(): Any$x;
3030
+ get shape1(): Any$z;
2770
3031
  /** Second shape (higher id). */
2771
- get shape2(): Any$x;
3032
+ get shape2(): Any$z;
2772
3033
  /** Body of shape1. */
2773
- get body1(): Any$x;
3034
+ get body1(): Any$z;
2774
3035
  /** Body of shape2. */
2775
- get body2(): Any$x;
3036
+ get body2(): Any$z;
2776
3037
  /** The pre-handler state of this arbiter. */
2777
- get state(): Any$x;
3038
+ get state(): Any$z;
2778
3039
  /** Whether this is a collision arbiter. */
2779
3040
  isCollisionArbiter(): boolean;
2780
3041
  /** Whether this is a fluid arbiter. */
@@ -2785,15 +3046,15 @@ declare class Arbiter {
2785
3046
  * Total impulse of this arbiter. Base implementation returns Vec3(0,0,0).
2786
3047
  * Overridden by CollisionArbiter and FluidArbiter.
2787
3048
  */
2788
- totalImpulse(body?: Any$x, _freshOnly?: boolean): Vec3;
3049
+ totalImpulse(body?: Any$z, _freshOnly?: boolean): Vec3;
2789
3050
  toString(): string;
2790
3051
  /** @internal */
2791
3052
  protected _activeCheck(): void;
2792
3053
  /** @internal */
2793
- protected _checkBody(body: Any$x): void;
3054
+ protected _checkBody(body: Any$z): void;
2794
3055
  }
2795
3056
 
2796
- type Any$w = any;
3057
+ type Any$y = any;
2797
3058
  /**
2798
3059
  * A collision arbiter between two shapes in contact.
2799
3060
  *
@@ -2807,15 +3068,15 @@ declare class CollisionArbiter extends Arbiter {
2807
3068
  static __super__: typeof Arbiter;
2808
3069
  constructor();
2809
3070
  /** Contact points for this collision. */
2810
- get contacts(): Any$w;
3071
+ get contacts(): Any$y;
2811
3072
  /** Collision normal vector. */
2812
- get normal(): Any$w;
3073
+ get normal(): Any$y;
2813
3074
  /** Sum of the radii of the two shapes at the collision point. */
2814
3075
  get radius(): number;
2815
3076
  /** Reference edge of shape1 (if polygon), or null. */
2816
- get referenceEdge1(): Any$w;
3077
+ get referenceEdge1(): Any$y;
2817
3078
  /** Reference edge of shape2 (if polygon), or null. */
2818
- get referenceEdge2(): Any$w;
3079
+ get referenceEdge2(): Any$y;
2819
3080
  /** Coefficient of restitution (elasticity). Mutable in pre-handler only. */
2820
3081
  get elasticity(): number;
2821
3082
  set elasticity(value: number);
@@ -2833,20 +3094,20 @@ declare class CollisionArbiter extends Arbiter {
2833
3094
  /** Whether the second contact point lies on a polygon vertex (poly-circle only). */
2834
3095
  secondVertex(): boolean;
2835
3096
  /** Normal impulse accumulated across all contacts. */
2836
- normalImpulse(body?: Any$w, freshOnly?: boolean): Vec3;
3097
+ normalImpulse(body?: Any$y, freshOnly?: boolean): Vec3;
2837
3098
  /** Tangent (friction) impulse accumulated across all contacts. */
2838
- tangentImpulse(body?: Any$w, freshOnly?: boolean): Vec3;
3099
+ tangentImpulse(body?: Any$y, freshOnly?: boolean): Vec3;
2839
3100
  /** Total impulse (normal + tangent + rolling) accumulated across all contacts. */
2840
- totalImpulse(body?: Any$w, freshOnly?: boolean): Vec3;
3101
+ totalImpulse(body?: Any$y, freshOnly?: boolean): Vec3;
2841
3102
  /** Rolling impulse for this collision. */
2842
- rollingImpulse(body?: Any$w, freshOnly?: boolean): number;
3103
+ rollingImpulse(body?: Any$y, freshOnly?: boolean): number;
2843
3104
  /** @internal Throw if not in pre-handler mutable window. */
2844
3105
  private _mutableCheck;
2845
3106
  /** @internal Accumulate impulse from contacts. */
2846
3107
  private _accumulateImpulse;
2847
3108
  }
2848
3109
 
2849
- type Any$v = any;
3110
+ type Any$x = any;
2850
3111
  /**
2851
3112
  * A fluid arbiter between two shapes with fluid interaction.
2852
3113
  *
@@ -2866,14 +3127,14 @@ declare class FluidArbiter extends Arbiter {
2866
3127
  get overlap(): number;
2867
3128
  set overlap(value: number);
2868
3129
  /** Buoyancy impulse applied by this fluid arbiter. */
2869
- buoyancyImpulse(body?: Any$v): Vec3;
3130
+ buoyancyImpulse(body?: Any$x): Vec3;
2870
3131
  /** Drag impulse applied by this fluid arbiter. */
2871
- dragImpulse(body?: Any$v): Vec3;
3132
+ dragImpulse(body?: Any$x): Vec3;
2872
3133
  /** Total impulse (buoyancy + drag). */
2873
- totalImpulse(body?: Any$v, _freshOnly?: boolean): Vec3;
3134
+ totalImpulse(body?: Any$x, _freshOnly?: boolean): Vec3;
2874
3135
  }
2875
3136
 
2876
- type Any$u = any;
3137
+ type Any$w = any;
2877
3138
  /**
2878
3139
  * Represents a contact point between two colliding shapes.
2879
3140
  *
@@ -2890,7 +3151,7 @@ declare class Contact {
2890
3151
  get _inner(): NapeInner;
2891
3152
  constructor();
2892
3153
  /** The collision arbiter this contact belongs to, or null. */
2893
- get arbiter(): Any$u;
3154
+ get arbiter(): Any$w;
2894
3155
  /** Penetration depth of this contact (positive = overlapping). */
2895
3156
  get penetration(): number;
2896
3157
  /** World-space position of this contact point. */
@@ -2904,30 +3165,63 @@ declare class Contact {
2904
3165
  * @param body - If null, returns world-frame impulse. Otherwise returns
2905
3166
  * impulse on the given body (must be one of the two in contact).
2906
3167
  */
2907
- normalImpulse(body?: Any$u): Vec3;
3168
+ normalImpulse(body?: Any$w): Vec3;
2908
3169
  /**
2909
3170
  * Tangent impulse at this contact point.
2910
3171
  * @param body - If null, returns world-frame impulse. Otherwise returns
2911
3172
  * impulse on the given body.
2912
3173
  */
2913
- tangentImpulse(body?: Any$u): Vec3;
3174
+ tangentImpulse(body?: Any$w): Vec3;
2914
3175
  /**
2915
3176
  * Rolling impulse at this contact point.
2916
3177
  * @param body - If null, returns total rolling impulse. Otherwise returns
2917
3178
  * rolling impulse on the given body.
2918
3179
  */
2919
- rollingImpulse(body?: Any$u): number;
3180
+ rollingImpulse(body?: Any$w): number;
2920
3181
  /**
2921
3182
  * Total impulse (normal + tangent + rolling) at this contact point.
2922
3183
  * @param body - If null, returns world-frame impulse. Otherwise returns
2923
3184
  * impulse on the given body.
2924
3185
  */
2925
- totalImpulse(body?: Any$u): Vec3;
3186
+ totalImpulse(body?: Any$w): Vec3;
3187
+ toString(): string;
3188
+ /** @internal */
3189
+ private _inactiveCheck;
3190
+ /** @internal */
3191
+ private _checkBody;
3192
+ }
3193
+
3194
+ /**
3195
+ * Callback event types.
3196
+ *
3197
+ * - `BEGIN` — interaction just started
3198
+ * - `ONGOING` — interaction continues
3199
+ * - `END` — interaction just ended
3200
+ * - `WAKE` — body/constraint woke up
3201
+ * - `SLEEP` — body/constraint went to sleep
3202
+ * - `BREAK` — constraint was broken
3203
+ * - `PRE` — pre-interaction callback
3204
+ *
3205
+ * Converted from nape-compiled.js lines 516–657.
3206
+ */
3207
+ declare class CbEvent {
3208
+ static __name__: string[];
3209
+ constructor();
3210
+ static get BEGIN(): CbEvent;
3211
+ static get ONGOING(): CbEvent;
3212
+ static get END(): CbEvent;
3213
+ static get WAKE(): CbEvent;
3214
+ static get SLEEP(): CbEvent;
3215
+ static get BREAK(): CbEvent;
3216
+ static get PRE(): CbEvent;
3217
+ static get_BEGIN(): CbEvent;
3218
+ static get_ONGOING(): CbEvent;
3219
+ static get_END(): CbEvent;
3220
+ static get_WAKE(): CbEvent;
3221
+ static get_SLEEP(): CbEvent;
3222
+ static get_BREAK(): CbEvent;
3223
+ static get_PRE(): CbEvent;
2926
3224
  toString(): string;
2927
- /** @internal */
2928
- private _inactiveCheck;
2929
- /** @internal */
2930
- private _checkBody;
2931
3225
  }
2932
3226
 
2933
3227
  /**
@@ -2939,41 +3233,41 @@ declare class Contact {
2939
3233
  *
2940
3234
  * Converted from nape-compiled.js lines 48256–48482.
2941
3235
  */
2942
- type Any$t = any;
3236
+ type Any$v = any;
2943
3237
  declare class ZPP_CbType {
2944
3238
  static __name__: string[];
2945
- static _zpp: Any$t;
2946
- outer: Any$t;
2947
- userData: Any$t;
3239
+ static _zpp: Any$v;
3240
+ outer: Any$v;
3241
+ userData: Any$v;
2948
3242
  id: number;
2949
- cbsets: Any$t;
2950
- interactors: Any$t;
2951
- wrap_interactors: Any$t;
2952
- constraints: Any$t;
2953
- wrap_constraints: Any$t;
2954
- listeners: Any$t;
2955
- bodylisteners: Any$t;
2956
- conlisteners: Any$t;
2957
- __class__: Any$t;
3243
+ cbsets: Any$v;
3244
+ interactors: Any$v;
3245
+ wrap_interactors: Any$v;
3246
+ constraints: Any$v;
3247
+ wrap_constraints: Any$v;
3248
+ listeners: Any$v;
3249
+ bodylisteners: Any$v;
3250
+ conlisteners: Any$v;
3251
+ __class__: Any$v;
2958
3252
  constructor();
2959
3253
  /** Sort comparator by id. */
2960
3254
  static setlt(a: ZPP_CbType, b: ZPP_CbType): boolean;
2961
- addInteractor(intx: Any$t): void;
2962
- remInteractor(intx: Any$t): void;
2963
- addConstraint(con: Any$t): void;
2964
- remConstraint(con: Any$t): void;
2965
- addint(x: Any$t): void;
2966
- removeint(x: Any$t): void;
3255
+ addInteractor(intx: Any$v): void;
3256
+ remInteractor(intx: Any$v): void;
3257
+ addConstraint(con: Any$v): void;
3258
+ remConstraint(con: Any$v): void;
3259
+ addint(x: Any$v): void;
3260
+ removeint(x: Any$v): void;
2967
3261
  invalidateint(): void;
2968
- addbody(x: Any$t): void;
2969
- removebody(x: Any$t): void;
3262
+ addbody(x: Any$v): void;
3263
+ removebody(x: Any$v): void;
2970
3264
  invalidatebody(): void;
2971
- addconstraint(x: Any$t): void;
2972
- removeconstraint(x: Any$t): void;
3265
+ addconstraint(x: Any$v): void;
3266
+ removeconstraint(x: Any$v): void;
2973
3267
  invalidateconstraint(): void;
2974
3268
  }
2975
3269
 
2976
- type Any$s = any;
3270
+ type Any$u = any;
2977
3271
  /**
2978
3272
  * Callback type — used to tag interactors so that listeners
2979
3273
  * can filter which interactions they respond to.
@@ -2994,11 +3288,11 @@ declare class CbType {
2994
3288
  static get_ANY_SHAPE(): CbType;
2995
3289
  static get_ANY_COMPOUND(): CbType;
2996
3290
  get id(): number;
2997
- get userData(): Any$s;
2998
- get interactors(): Any$s;
2999
- get constraints(): Any$s;
3000
- including(includes: Any$s): Any$s;
3001
- excluding(excludes: Any$s): Any$s;
3291
+ get userData(): Any$u;
3292
+ get interactors(): Any$u;
3293
+ get constraints(): Any$u;
3294
+ including(includes: Any$u): Any$u;
3295
+ excluding(excludes: Any$u): Any$u;
3002
3296
  toString(): string;
3003
3297
  static _wrap(inner: any): CbType;
3004
3298
  }
@@ -3059,37 +3353,37 @@ declare class PreFlag {
3059
3353
  *
3060
3354
  * Converted from nape-compiled.js lines 51337–51655.
3061
3355
  */
3062
- type Any$r = any;
3356
+ type Any$t = any;
3063
3357
  declare class ZPP_OptionType {
3064
3358
  static __name__: string[];
3065
- static _nape: Any$r;
3066
- static _zpp: Any$r;
3067
- outer: Any$r;
3068
- handler: ((val: Any$r, included: boolean, added: boolean) => void) | null;
3069
- includes: Any$r;
3070
- excludes: Any$r;
3071
- wrap_includes: Any$r;
3072
- wrap_excludes: Any$r;
3073
- __class__: Any$r;
3359
+ static _nape: Any$t;
3360
+ static _zpp: Any$t;
3361
+ outer: Any$t;
3362
+ handler: ((val: Any$t, included: boolean, added: boolean) => void) | null;
3363
+ includes: Any$t;
3364
+ excludes: Any$t;
3365
+ wrap_includes: Any$t;
3366
+ wrap_excludes: Any$t;
3367
+ __class__: Any$t;
3074
3368
  constructor();
3075
3369
  /** Coerce a value to OptionType (null → new, OptionType → pass-through, CbType → including). */
3076
- static argument(val: Any$r): Any$r;
3370
+ static argument(val: Any$t): Any$t;
3077
3371
  setup_includes(): void;
3078
3372
  setup_excludes(): void;
3079
- excluded(xs: Any$r): boolean;
3080
- included(xs: Any$r): boolean;
3081
- compatible(xs: Any$r): boolean;
3373
+ excluded(xs: Any$t): boolean;
3374
+ included(xs: Any$t): boolean;
3375
+ compatible(xs: Any$t): boolean;
3082
3376
  /** Check whether two sorted-by-id lists share any element. */
3083
- nonemptyintersection(xs: Any$r, ys: Any$r): boolean;
3377
+ nonemptyintersection(xs: Any$t, ys: Any$t): boolean;
3084
3378
  /** Insert into the ordered include or exclude list, using pool nodes. */
3085
3379
  private insertOrdered;
3086
- effect_change(val: Any$r, included: boolean, added: boolean): void;
3087
- append_type(list: Any$r, val: Any$r): void;
3380
+ effect_change(val: Any$t, included: boolean, added: boolean): void;
3381
+ append_type(list: Any$t, val: Any$t): void;
3088
3382
  set(options: ZPP_OptionType): this;
3089
- append(list: Any$r, val: Any$r): void;
3383
+ append(list: Any$t, val: Any$t): void;
3090
3384
  }
3091
3385
 
3092
- type Any$q = any;
3386
+ type Any$s = any;
3093
3387
  /**
3094
3388
  * Composite callback option type — allows including and excluding CbTypes.
3095
3389
  *
@@ -3099,17 +3393,103 @@ declare class OptionType {
3099
3393
  static __name__: string[];
3100
3394
  zpp_inner: ZPP_OptionType;
3101
3395
  get _inner(): NapeInner;
3102
- constructor(includes?: Any$q, excludes?: Any$q);
3103
- get includes(): Any$q;
3104
- get excludes(): Any$q;
3105
- get_includes(): Any$q;
3106
- get_excludes(): Any$q;
3107
- including(includes: Any$q): this;
3108
- excluding(excludes: Any$q): this;
3396
+ constructor(includes?: Any$s, excludes?: Any$s);
3397
+ get includes(): Any$s;
3398
+ get excludes(): Any$s;
3399
+ get_includes(): Any$s;
3400
+ get_excludes(): Any$s;
3401
+ including(includes: Any$s): this;
3402
+ excluding(excludes: Any$s): this;
3109
3403
  toString(): string;
3110
3404
  static _wrap(inner: any): OptionType;
3111
3405
  }
3112
3406
 
3407
+ /**
3408
+ * ZPP_Listener — Internal listener base class for the nape physics engine.
3409
+ *
3410
+ * Base class for ZPP_BodyListener, ZPP_ConstraintListener, and
3411
+ * ZPP_InteractionListener. Holds common properties (space, precedence,
3412
+ * event type, listener type) and provides stub methods for subclass override.
3413
+ *
3414
+ * Converted from nape-compiled.js lines 27259–27304, 112053–112139.
3415
+ */
3416
+ type Any$r = any;
3417
+ declare class ZPP_Listener {
3418
+ static __name__: string[];
3419
+ static _nape: Any$r;
3420
+ static _zpp: Any$r;
3421
+ static internal: boolean;
3422
+ static types: Any$r[];
3423
+ static events: Any$r[];
3424
+ space: Any$r;
3425
+ interaction: Any$r;
3426
+ constraint: Any$r;
3427
+ body: Any$r;
3428
+ precedence: number;
3429
+ event: number;
3430
+ type: number;
3431
+ id: number;
3432
+ outer: Any$r;
3433
+ __class__: Any$r;
3434
+ constructor();
3435
+ /** Sort comparator: higher precedence first, then by id descending. */
3436
+ static setlt(a: ZPP_Listener, b: ZPP_Listener): boolean;
3437
+ swapEvent(_event?: number): void;
3438
+ invalidate_precedence(): void;
3439
+ addedToSpace(): void;
3440
+ removedFromSpace(): void;
3441
+ }
3442
+
3443
+ /**
3444
+ * Listener type classification.
3445
+ *
3446
+ * - `BODY` — body event listener
3447
+ * - `CONSTRAINT` — constraint event listener
3448
+ * - `INTERACTION` — interaction event listener
3449
+ * - `PRE` — pre-interaction listener
3450
+ *
3451
+ * Converted from nape-compiled.js lines 2554–2646.
3452
+ */
3453
+ declare class ListenerType {
3454
+ static __name__: string[];
3455
+ static BODY: ListenerType | null;
3456
+ static CONSTRAINT: ListenerType | null;
3457
+ static INTERACTION: ListenerType | null;
3458
+ static PRE: ListenerType | null;
3459
+ constructor();
3460
+ static get_BODY(): ListenerType;
3461
+ static get_CONSTRAINT(): ListenerType;
3462
+ static get_INTERACTION(): ListenerType;
3463
+ static get_PRE(): ListenerType;
3464
+ toString(): string;
3465
+ }
3466
+
3467
+ /**
3468
+ * Listener — Base class for all physics event listeners.
3469
+ *
3470
+ * Provides common properties (type, event, precedence, space) and
3471
+ * toString() for all listener subclasses.
3472
+ *
3473
+ * Fully modernized from nape-compiled.js lines 231–433.
3474
+ */
3475
+
3476
+ type Any$q = any;
3477
+ declare class Listener {
3478
+ static __name__: string[];
3479
+ zpp_inner: ZPP_Listener;
3480
+ get _inner(): Any$q;
3481
+ constructor();
3482
+ static _wrap(inner: Any$q): Listener;
3483
+ get type(): ListenerType;
3484
+ get event(): CbEvent;
3485
+ set event(event: CbEvent);
3486
+ get precedence(): number;
3487
+ set precedence(precedence: number);
3488
+ get space(): Space | null;
3489
+ set space(space: Space | Any$q | null);
3490
+ toString(): string;
3491
+ }
3492
+
3113
3493
  /**
3114
3494
  * ZPP_BodyListener — Internal body listener for the nape physics engine.
3115
3495
  *
@@ -3289,62 +3669,7 @@ declare class PreListener extends Listener {
3289
3669
  set interactionType(interactionType: InteractionType | null);
3290
3670
  }
3291
3671
 
3292
- /**
3293
- * ZPP_Callback — Internal callback data holder for the nape physics engine.
3294
- *
3295
- * Stores callback event information (listener, event type, interactors, etc.)
3296
- * and forms a doubly-linked list for callback queue management.
3297
- *
3298
- * Converted from nape-compiled.js lines 44587–44794, 133299–133300.
3299
- */
3300
3672
  type Any$i = any;
3301
- declare class ZPP_Callback {
3302
- static __name__: string[];
3303
- static _nape: Any$i;
3304
- static _zpp: Any$i;
3305
- static internal: boolean;
3306
- static zpp_pool: ZPP_Callback | null;
3307
- outer_body: Any$i;
3308
- outer_con: Any$i;
3309
- outer_int: Any$i;
3310
- event: number;
3311
- listener: Any$i;
3312
- space: Any$i;
3313
- index: number;
3314
- next: ZPP_Callback | null;
3315
- prev: ZPP_Callback | null;
3316
- length: number;
3317
- int1: Any$i;
3318
- int2: Any$i;
3319
- set: Any$i;
3320
- wrap_arbiters: Any$i;
3321
- pre_arbiter: Any$i;
3322
- pre_swapped: boolean;
3323
- body: Any$i;
3324
- constraint: Any$i;
3325
- __class__: Any$i;
3326
- wrapper_body(): Any$i;
3327
- wrapper_con(): Any$i;
3328
- wrapper_int(): Any$i;
3329
- push(obj: ZPP_Callback): void;
3330
- push_rev(obj: ZPP_Callback): void;
3331
- pop(): ZPP_Callback;
3332
- pop_rev(): ZPP_Callback;
3333
- empty(): boolean;
3334
- clear(): void;
3335
- splice(o: ZPP_Callback): ZPP_Callback | null;
3336
- rotateL(): void;
3337
- rotateR(): void;
3338
- cycleNext(o: ZPP_Callback): ZPP_Callback | null;
3339
- cyclePrev(o: ZPP_Callback): ZPP_Callback | null;
3340
- at(i: number): ZPP_Callback;
3341
- rev_at(i: number): ZPP_Callback;
3342
- free(): void;
3343
- alloc(): void;
3344
- genarbs(): void;
3345
- }
3346
-
3347
- type Any$h = any;
3348
3673
  /**
3349
3674
  * Base class for all physics engine callbacks.
3350
3675
  *
@@ -3357,12 +3682,12 @@ declare class Callback {
3357
3682
  static __name__: string[];
3358
3683
  zpp_inner: ZPP_Callback | null;
3359
3684
  constructor();
3360
- get event(): Any$h;
3361
- get listener(): Any$h;
3685
+ get event(): Any$i;
3686
+ get listener(): Any$i;
3362
3687
  toString(): string;
3363
3688
  }
3364
3689
 
3365
- type Any$g = any;
3690
+ type Any$h = any;
3366
3691
  /**
3367
3692
  * Callback for body events (WAKE/SLEEP).
3368
3693
  *
@@ -3372,11 +3697,11 @@ type Any$g = any;
3372
3697
  */
3373
3698
  declare class BodyCallback extends Callback {
3374
3699
  static __name__: string[];
3375
- get body(): Any$g;
3700
+ get body(): Any$h;
3376
3701
  toString(): string;
3377
3702
  }
3378
3703
 
3379
- type Any$f = any;
3704
+ type Any$g = any;
3380
3705
  /**
3381
3706
  * Callback for constraint events (WAKE/SLEEP/BREAK).
3382
3707
  *
@@ -3386,11 +3711,11 @@ type Any$f = any;
3386
3711
  */
3387
3712
  declare class ConstraintCallback extends Callback {
3388
3713
  static __name__: string[];
3389
- get constraint(): Any$f;
3714
+ get constraint(): Any$g;
3390
3715
  toString(): string;
3391
3716
  }
3392
3717
 
3393
- type Any$e = any;
3718
+ type Any$f = any;
3394
3719
  /**
3395
3720
  * Callback for interaction events (BEGIN/END/ONGOING).
3396
3721
  *
@@ -3400,13 +3725,13 @@ type Any$e = any;
3400
3725
  */
3401
3726
  declare class InteractionCallback extends Callback {
3402
3727
  static __name__: string[];
3403
- get int1(): Any$e;
3404
- get int2(): Any$e;
3405
- get arbiters(): Any$e;
3728
+ get int1(): Any$f;
3729
+ get int2(): Any$f;
3730
+ get arbiters(): Any$f;
3406
3731
  toString(): string;
3407
3732
  }
3408
3733
 
3409
- type Any$d = any;
3734
+ type Any$e = any;
3410
3735
  /**
3411
3736
  * Callback for pre-interaction events.
3412
3737
  *
@@ -3416,9 +3741,9 @@ type Any$d = any;
3416
3741
  */
3417
3742
  declare class PreCallback extends Callback {
3418
3743
  static __name__: string[];
3419
- get arbiter(): Any$d;
3420
- get int1(): Any$d;
3421
- get int2(): Any$d;
3744
+ get arbiter(): Any$e;
3745
+ get int1(): Any$e;
3746
+ get int2(): Any$e;
3422
3747
  get swapped(): boolean;
3423
3748
  toString(): string;
3424
3749
  }
@@ -3433,24 +3758,24 @@ declare class PreCallback extends Callback {
3433
3758
  * Converted from nape-compiled.js lines 24611–25474.
3434
3759
  */
3435
3760
 
3436
- type Any$c = any;
3761
+ type Any$d = any;
3437
3762
  declare class ZPP_PivotJoint extends ZPP_Constraint {
3438
3763
  static __name__: string[];
3439
3764
  static __super__: typeof ZPP_Constraint;
3440
- static _wrapFn: ((zpp: ZPP_PivotJoint) => Any$c) | null;
3441
- outer_zn: Any$c;
3442
- b1: Any$c;
3443
- b2: Any$c;
3765
+ static _wrapFn: ((zpp: ZPP_PivotJoint) => Any$d) | null;
3766
+ outer_zn: Any$d;
3767
+ b1: Any$d;
3768
+ b2: Any$d;
3444
3769
  a1localx: number;
3445
3770
  a1localy: number;
3446
3771
  a1relx: number;
3447
3772
  a1rely: number;
3448
- wrap_a1: Any$c;
3773
+ wrap_a1: Any$d;
3449
3774
  a2localx: number;
3450
3775
  a2localy: number;
3451
3776
  a2relx: number;
3452
3777
  a2rely: number;
3453
- wrap_a2: Any$c;
3778
+ wrap_a2: Any$d;
3454
3779
  kMassa: number;
3455
3780
  kMassb: number;
3456
3781
  kMassc: number;
@@ -3461,18 +3786,18 @@ declare class ZPP_PivotJoint extends ZPP_Constraint {
3461
3786
  biasx: number;
3462
3787
  biasy: number;
3463
3788
  stepped: boolean;
3464
- __class__: Any$c;
3789
+ __class__: Any$d;
3465
3790
  constructor();
3466
- bodyImpulse(b: Any$c): Any$c;
3791
+ bodyImpulse(b: Any$d): Any$d;
3467
3792
  activeBodies(): void;
3468
3793
  inactiveBodies(): void;
3469
3794
  validate_a1(): void;
3470
- invalidate_a1(x: Any$c): void;
3795
+ invalidate_a1(x: Any$d): void;
3471
3796
  setup_a1(): void;
3472
3797
  validate_a2(): void;
3473
- invalidate_a2(x: Any$c): void;
3798
+ invalidate_a2(x: Any$d): void;
3474
3799
  setup_a2(): void;
3475
- copy(dict: Any$c, todo: Any$c): Any$c;
3800
+ copy(dict: Any$d, todo: Any$d): Any$d;
3476
3801
  validate(): void;
3477
3802
  wake_connected(): void;
3478
3803
  forest(): void;
@@ -3482,10 +3807,10 @@ declare class ZPP_PivotJoint extends ZPP_Constraint {
3482
3807
  warmStart(): void;
3483
3808
  applyImpulseVel(): boolean;
3484
3809
  applyImpulsePos(): boolean;
3485
- draw(_g: Any$c): void;
3810
+ draw(_g: Any$d): void;
3486
3811
  }
3487
3812
 
3488
- type Any$b = any;
3813
+ type Any$c = any;
3489
3814
  /**
3490
3815
  * A pivot (pin) joint that constrains two bodies to share an anchor point.
3491
3816
  *
@@ -3495,7 +3820,7 @@ declare class PivotJoint extends Constraint {
3495
3820
  zpp_inner: ZPP_PivotJoint;
3496
3821
  constructor(body1: Body | null, body2: Body | null, anchor1: Vec2, anchor2: Vec2);
3497
3822
  /** @internal */
3498
- static _wrap(inner: Any$b): PivotJoint;
3823
+ static _wrap(inner: Any$c): PivotJoint;
3499
3824
  get body1(): Body;
3500
3825
  set body1(value: Body | null);
3501
3826
  /** @internal */
@@ -3508,17 +3833,17 @@ declare class PivotJoint extends Constraint {
3508
3833
  set anchor1(value: Vec2);
3509
3834
  get anchor2(): Vec2;
3510
3835
  set anchor2(value: Vec2);
3511
- impulse(): Any$b;
3512
- bodyImpulse(body: Body): Any$b;
3836
+ impulse(): Any$c;
3837
+ bodyImpulse(body: Body): Any$c;
3513
3838
  visitBodies(lambda: (body: Body) => void): void;
3514
- /** @internal */ get_body1(): Any$b;
3515
- /** @internal */ set_body1(v: Any$b): Any$b;
3516
- /** @internal */ get_body2(): Any$b;
3517
- /** @internal */ set_body2(v: Any$b): Any$b;
3518
- /** @internal */ get_anchor1(): Any$b;
3519
- /** @internal */ set_anchor1(v: Any$b): Any$b;
3520
- /** @internal */ get_anchor2(): Any$b;
3521
- /** @internal */ set_anchor2(v: Any$b): Any$b;
3839
+ /** @internal */ get_body1(): Any$c;
3840
+ /** @internal */ set_body1(v: Any$c): Any$c;
3841
+ /** @internal */ get_body2(): Any$c;
3842
+ /** @internal */ set_body2(v: Any$c): Any$c;
3843
+ /** @internal */ get_anchor1(): Any$c;
3844
+ /** @internal */ set_anchor1(v: Any$c): Any$c;
3845
+ /** @internal */ get_anchor2(): Any$c;
3846
+ /** @internal */ set_anchor2(v: Any$c): Any$c;
3522
3847
  /** @internal backward compat alias for zpp_inner */
3523
3848
  get zpp_inner_zn(): ZPP_PivotJoint;
3524
3849
  set zpp_inner_zn(v: ZPP_PivotJoint);
@@ -3534,12 +3859,12 @@ declare class PivotJoint extends Constraint {
3534
3859
  * Converted from nape-compiled.js lines 22329–23204.
3535
3860
  */
3536
3861
 
3537
- type Any$a = any;
3862
+ type Any$b = any;
3538
3863
  declare class ZPP_DistanceJoint extends ZPP_Constraint {
3539
3864
  static __name__: string[];
3540
3865
  static __super__: typeof ZPP_Constraint;
3541
- static _wrapFn: ((zpp: ZPP_DistanceJoint) => Any$a) | null;
3542
- outer_zn: Any$a;
3866
+ static _wrapFn: ((zpp: ZPP_DistanceJoint) => Any$b) | null;
3867
+ outer_zn: Any$b;
3543
3868
  jointMin: number;
3544
3869
  jointMax: number;
3545
3870
  slack: boolean;
@@ -3548,8 +3873,8 @@ declare class ZPP_DistanceJoint extends ZPP_Constraint {
3548
3873
  ny: number;
3549
3874
  cx1: number;
3550
3875
  cx2: number;
3551
- b1: Any$a;
3552
- b2: Any$a;
3876
+ b1: Any$b;
3877
+ b2: Any$b;
3553
3878
  a1localx: number;
3554
3879
  a1localy: number;
3555
3880
  a1relx: number;
@@ -3558,27 +3883,27 @@ declare class ZPP_DistanceJoint extends ZPP_Constraint {
3558
3883
  a2localy: number;
3559
3884
  a2relx: number;
3560
3885
  a2rely: number;
3561
- wrap_a1: Any$a;
3562
- wrap_a2: Any$a;
3886
+ wrap_a1: Any$b;
3887
+ wrap_a2: Any$b;
3563
3888
  kMass: number;
3564
3889
  jAcc: number;
3565
3890
  jMax: number;
3566
3891
  gamma: number;
3567
3892
  bias: number;
3568
3893
  stepped: boolean;
3569
- __class__: Any$a;
3894
+ __class__: Any$b;
3570
3895
  constructor();
3571
3896
  is_slack(): boolean;
3572
- bodyImpulse(b: Any$a): Any$a;
3897
+ bodyImpulse(b: Any$b): Any$b;
3573
3898
  activeBodies(): void;
3574
3899
  inactiveBodies(): void;
3575
3900
  validate_a1(): void;
3576
- invalidate_a1(x: Any$a): void;
3901
+ invalidate_a1(x: Any$b): void;
3577
3902
  setup_a1(): void;
3578
3903
  validate_a2(): void;
3579
- invalidate_a2(x: Any$a): void;
3904
+ invalidate_a2(x: Any$b): void;
3580
3905
  setup_a2(): void;
3581
- copy(dict: Any$a, todo: Any$a): Any$a;
3906
+ copy(dict: Any$b, todo: Any$b): Any$b;
3582
3907
  validate(): void;
3583
3908
  wake_connected(): void;
3584
3909
  forest(): void;
@@ -3588,7 +3913,7 @@ declare class ZPP_DistanceJoint extends ZPP_Constraint {
3588
3913
  warmStart(): void;
3589
3914
  applyImpulseVel(): boolean;
3590
3915
  applyImpulsePos(): boolean;
3591
- draw(_g: Any$a): void;
3916
+ draw(_g: Any$b): void;
3592
3917
  /**
3593
3918
  * Creates (or reuses from pool) a public Vec2 wrapper for a constraint anchor
3594
3919
  * point stored as (localx, localy). Installs the given validate and invalidate
@@ -3596,10 +3921,10 @@ declare class ZPP_DistanceJoint extends ZPP_Constraint {
3596
3921
  *
3597
3922
  * Shared by all anchor-based joints (DistanceJoint, PivotJoint, LineJoint, etc.)
3598
3923
  */
3599
- static _setupAnchorVec2(localx: number, localy: number, validateFn: (() => void) | null, invalidateFn: ((vec: Any$a) => void) | null): Any$a;
3924
+ static _setupAnchorVec2(localx: number, localy: number, validateFn: (() => void) | null, invalidateFn: ((vec: Any$b) => void) | null): Any$b;
3600
3925
  }
3601
3926
 
3602
- type Any$9 = any;
3927
+ type Any$a = any;
3603
3928
  /**
3604
3929
  * Constrains the distance between two anchor points on two bodies.
3605
3930
  *
@@ -3609,7 +3934,7 @@ declare class DistanceJoint extends Constraint {
3609
3934
  zpp_inner: ZPP_DistanceJoint;
3610
3935
  constructor(body1: Body | null, body2: Body | null, anchor1: Vec2, anchor2: Vec2, jointMin: number, jointMax: number);
3611
3936
  /** @internal */
3612
- static _wrap(inner: Any$9): DistanceJoint;
3937
+ static _wrap(inner: Any$a): DistanceJoint;
3613
3938
  get body1(): Body;
3614
3939
  set body1(value: Body | null);
3615
3940
  /** @internal */
@@ -3627,17 +3952,17 @@ declare class DistanceJoint extends Constraint {
3627
3952
  get jointMax(): number;
3628
3953
  set jointMax(value: number);
3629
3954
  isSlack(): boolean;
3630
- impulse(): Any$9;
3631
- bodyImpulse(body: Body): Any$9;
3955
+ impulse(): Any$a;
3956
+ bodyImpulse(body: Body): Any$a;
3632
3957
  visitBodies(lambda: (body: Body) => void): void;
3633
- /** @internal */ get_body1(): Any$9;
3634
- /** @internal */ set_body1(v: Any$9): Any$9;
3635
- /** @internal */ get_body2(): Any$9;
3636
- /** @internal */ set_body2(v: Any$9): Any$9;
3637
- /** @internal */ get_anchor1(): Any$9;
3638
- /** @internal */ set_anchor1(v: Any$9): Any$9;
3639
- /** @internal */ get_anchor2(): Any$9;
3640
- /** @internal */ set_anchor2(v: Any$9): Any$9;
3958
+ /** @internal */ get_body1(): Any$a;
3959
+ /** @internal */ set_body1(v: Any$a): Any$a;
3960
+ /** @internal */ get_body2(): Any$a;
3961
+ /** @internal */ set_body2(v: Any$a): Any$a;
3962
+ /** @internal */ get_anchor1(): Any$a;
3963
+ /** @internal */ set_anchor1(v: Any$a): Any$a;
3964
+ /** @internal */ get_anchor2(): Any$a;
3965
+ /** @internal */ set_anchor2(v: Any$a): Any$a;
3641
3966
  /** @internal */ get_jointMin(): number;
3642
3967
  /** @internal */ set_jointMin(v: number): number;
3643
3968
  /** @internal */ get_jointMax(): number;
@@ -3656,53 +3981,53 @@ declare class DistanceJoint extends Constraint {
3656
3981
  * Converted from nape-compiled.js lines 21441–21912.
3657
3982
  */
3658
3983
 
3659
- type Any$8 = any;
3984
+ type Any$9 = any;
3660
3985
  declare class ZPP_AngleJoint extends ZPP_Constraint {
3661
3986
  static __name__: string[];
3662
- static _wrapFn: ((zpp: ZPP_AngleJoint) => Any$8) | null;
3663
- outer_zn: Any$8;
3987
+ static _wrapFn: ((zpp: ZPP_AngleJoint) => Any$9) | null;
3988
+ outer_zn: Any$9;
3664
3989
  ratio: number;
3665
3990
  jointMin: number;
3666
3991
  jointMax: number;
3667
3992
  slack: boolean;
3668
3993
  equal: boolean;
3669
3994
  scale: number;
3670
- b1: Any$8;
3671
- b2: Any$8;
3995
+ b1: Any$9;
3996
+ b2: Any$9;
3672
3997
  kMass: number;
3673
3998
  jAcc: number;
3674
3999
  jMax: number;
3675
4000
  gamma: number;
3676
4001
  bias: number;
3677
4002
  stepped: boolean;
3678
- __class__: Any$8;
4003
+ __class__: Any$9;
3679
4004
  constructor();
3680
4005
  is_slack(): boolean;
3681
- bodyImpulse(b: Any$8): Any$8;
4006
+ bodyImpulse(b: Any$9): Any$9;
3682
4007
  activeBodies(): void;
3683
4008
  inactiveBodies(): void;
3684
- copy(dict?: Any$8, todo?: Any$8): Any$8;
4009
+ copy(dict?: Any$9, todo?: Any$9): Any$9;
3685
4010
  validate(): void;
3686
4011
  wake_connected(): void;
3687
4012
  forest(): void;
3688
- pair_exists(id: Any$8, di: Any$8): boolean;
4013
+ pair_exists(id: Any$9, di: Any$9): boolean;
3689
4014
  clearcache(): void;
3690
4015
  preStep(dt: number): boolean;
3691
4016
  warmStart(): void;
3692
4017
  applyImpulseVel(): boolean;
3693
4018
  applyImpulsePos(): boolean;
3694
- draw(_g: Any$8): void;
4019
+ draw(_g: Any$9): void;
3695
4020
  /**
3696
4021
  * Small-angle-optimized body rotation. Used by all joints' applyImpulsePos.
3697
4022
  */
3698
- static _rotateBody(body: Any$8, dr: number): void;
4023
+ static _rotateBody(body: Any$9, dr: number): void;
3699
4024
  /**
3700
4025
  * Dict-lookup / deferred-todo body copying. Used by all joints' copy().
3701
4026
  */
3702
- static _copyBody(dict: Any$8, todo: Any$8, srcBody: Any$8, ret: Any$8, field: string): void;
4027
+ static _copyBody(dict: Any$9, todo: Any$9, srcBody: Any$9, ret: Any$9, field: string): void;
3703
4028
  }
3704
4029
 
3705
- type Any$7 = any;
4030
+ type Any$8 = any;
3706
4031
  /**
3707
4032
  * Constrains the relative angle between two bodies.
3708
4033
  *
@@ -3712,7 +4037,7 @@ declare class AngleJoint extends Constraint {
3712
4037
  zpp_inner: ZPP_AngleJoint;
3713
4038
  constructor(body1: Body | null, body2: Body | null, jointMin: number, jointMax: number, ratio?: number);
3714
4039
  /** @internal */
3715
- static _wrap(inner: Any$7): AngleJoint;
4040
+ static _wrap(inner: Any$8): AngleJoint;
3716
4041
  get body1(): Body;
3717
4042
  set body1(value: Body | null);
3718
4043
  /** @internal */
@@ -3728,13 +4053,13 @@ declare class AngleJoint extends Constraint {
3728
4053
  get ratio(): number;
3729
4054
  set ratio(value: number);
3730
4055
  isSlack(): boolean;
3731
- impulse(): Any$7;
3732
- bodyImpulse(body: Body): Any$7;
4056
+ impulse(): Any$8;
4057
+ bodyImpulse(body: Body): Any$8;
3733
4058
  visitBodies(lambda: (body: Body) => void): void;
3734
- /** @internal */ get_body1(): Any$7;
3735
- /** @internal */ set_body1(v: Any$7): Any$7;
3736
- /** @internal */ get_body2(): Any$7;
3737
- /** @internal */ set_body2(v: Any$7): Any$7;
4059
+ /** @internal */ get_body1(): Any$8;
4060
+ /** @internal */ set_body1(v: Any$8): Any$8;
4061
+ /** @internal */ get_body2(): Any$8;
4062
+ /** @internal */ set_body2(v: Any$8): Any$8;
3738
4063
  /** @internal */ get_jointMin(): number;
3739
4064
  /** @internal */ set_jointMin(v: number): number;
3740
4065
  /** @internal */ get_jointMax(): number;
@@ -3756,24 +4081,24 @@ declare class AngleJoint extends Constraint {
3756
4081
  * Converted from nape-compiled.js lines 28055–29046.
3757
4082
  */
3758
4083
 
3759
- type Any$6 = any;
4084
+ type Any$7 = any;
3760
4085
  declare class ZPP_WeldJoint extends ZPP_Constraint {
3761
4086
  static __name__: string[];
3762
4087
  static __super__: typeof ZPP_Constraint;
3763
- static _wrapFn: ((zpp: ZPP_WeldJoint) => Any$6) | null;
3764
- outer_zn: Any$6;
3765
- b1: Any$6;
3766
- b2: Any$6;
4088
+ static _wrapFn: ((zpp: ZPP_WeldJoint) => Any$7) | null;
4089
+ outer_zn: Any$7;
4090
+ b1: Any$7;
4091
+ b2: Any$7;
3767
4092
  a1localx: number;
3768
4093
  a1localy: number;
3769
4094
  a1relx: number;
3770
4095
  a1rely: number;
3771
- wrap_a1: Any$6;
4096
+ wrap_a1: Any$7;
3772
4097
  a2localx: number;
3773
4098
  a2localy: number;
3774
4099
  a2relx: number;
3775
4100
  a2rely: number;
3776
- wrap_a2: Any$6;
4101
+ wrap_a2: Any$7;
3777
4102
  phase: number;
3778
4103
  kMassa: number;
3779
4104
  kMassb: number;
@@ -3790,18 +4115,18 @@ declare class ZPP_WeldJoint extends ZPP_Constraint {
3790
4115
  biasy: number;
3791
4116
  biasz: number;
3792
4117
  stepped: boolean;
3793
- __class__: Any$6;
4118
+ __class__: Any$7;
3794
4119
  constructor();
3795
- bodyImpulse(b: Any$6): Any$6;
4120
+ bodyImpulse(b: Any$7): Any$7;
3796
4121
  activeBodies(): void;
3797
4122
  inactiveBodies(): void;
3798
4123
  validate_a1(): void;
3799
- invalidate_a1(x: Any$6): void;
4124
+ invalidate_a1(x: Any$7): void;
3800
4125
  setup_a1(): void;
3801
4126
  validate_a2(): void;
3802
- invalidate_a2(x: Any$6): void;
4127
+ invalidate_a2(x: Any$7): void;
3803
4128
  setup_a2(): void;
3804
- copy(dict: Any$6, todo: Any$6): Any$6;
4129
+ copy(dict: Any$7, todo: Any$7): Any$7;
3805
4130
  validate(): void;
3806
4131
  wake_connected(): void;
3807
4132
  forest(): void;
@@ -3811,10 +4136,10 @@ declare class ZPP_WeldJoint extends ZPP_Constraint {
3811
4136
  warmStart(): void;
3812
4137
  applyImpulseVel(): boolean;
3813
4138
  applyImpulsePos(): boolean;
3814
- draw(_g: Any$6): void;
4139
+ draw(_g: Any$7): void;
3815
4140
  }
3816
4141
 
3817
- type Any$5 = any;
4142
+ type Any$6 = any;
3818
4143
  /**
3819
4144
  * Weld joint — constrains two bodies to maintain a fixed relative
3820
4145
  * position and angle (like gluing them together).
@@ -3825,7 +4150,7 @@ declare class WeldJoint extends Constraint {
3825
4150
  zpp_inner: ZPP_WeldJoint;
3826
4151
  constructor(body1: Body | null, body2: Body | null, anchor1: Vec2, anchor2: Vec2, phase?: number);
3827
4152
  /** @internal */
3828
- static _wrap(inner: Any$5): WeldJoint;
4153
+ static _wrap(inner: Any$6): WeldJoint;
3829
4154
  get body1(): Body;
3830
4155
  set body1(value: Body | null);
3831
4156
  /** @internal */
@@ -3840,17 +4165,17 @@ declare class WeldJoint extends Constraint {
3840
4165
  set anchor2(value: Vec2);
3841
4166
  get phase(): number;
3842
4167
  set phase(value: number);
3843
- impulse(): Any$5;
3844
- bodyImpulse(body: Body): Any$5;
4168
+ impulse(): Any$6;
4169
+ bodyImpulse(body: Body): Any$6;
3845
4170
  visitBodies(lambda: (body: Body) => void): void;
3846
- /** @internal */ get_body1(): Any$5;
3847
- /** @internal */ set_body1(v: Any$5): Any$5;
3848
- /** @internal */ get_body2(): Any$5;
3849
- /** @internal */ set_body2(v: Any$5): Any$5;
3850
- /** @internal */ get_anchor1(): Any$5;
3851
- /** @internal */ set_anchor1(v: Any$5): Any$5;
3852
- /** @internal */ get_anchor2(): Any$5;
3853
- /** @internal */ set_anchor2(v: Any$5): Any$5;
4171
+ /** @internal */ get_body1(): Any$6;
4172
+ /** @internal */ set_body1(v: Any$6): Any$6;
4173
+ /** @internal */ get_body2(): Any$6;
4174
+ /** @internal */ set_body2(v: Any$6): Any$6;
4175
+ /** @internal */ get_anchor1(): Any$6;
4176
+ /** @internal */ set_anchor1(v: Any$6): Any$6;
4177
+ /** @internal */ get_anchor2(): Any$6;
4178
+ /** @internal */ set_anchor2(v: Any$6): Any$6;
3854
4179
  /** @internal */ get_phase(): number;
3855
4180
  /** @internal */ set_phase(v: number): number;
3856
4181
  /** @internal backward compat alias for zpp_inner */
@@ -3867,29 +4192,29 @@ declare class WeldJoint extends Constraint {
3867
4192
  * Converted from nape-compiled.js lines 23892–24197.
3868
4193
  */
3869
4194
 
3870
- type Any$4 = any;
4195
+ type Any$5 = any;
3871
4196
  declare class ZPP_MotorJoint extends ZPP_Constraint {
3872
4197
  static __name__: string[];
3873
- static _wrapFn: ((zpp: ZPP_MotorJoint) => Any$4) | null;
3874
- outer_zn: Any$4;
4198
+ static _wrapFn: ((zpp: ZPP_MotorJoint) => Any$5) | null;
4199
+ outer_zn: Any$5;
3875
4200
  ratio: number;
3876
4201
  rate: number;
3877
- b1: Any$4;
3878
- b2: Any$4;
4202
+ b1: Any$5;
4203
+ b2: Any$5;
3879
4204
  kMass: number;
3880
4205
  jAcc: number;
3881
4206
  jMax: number;
3882
4207
  stepped: boolean;
3883
- __class__: Any$4;
4208
+ __class__: Any$5;
3884
4209
  constructor();
3885
- bodyImpulse(b: Any$4): Any$4;
4210
+ bodyImpulse(b: Any$5): Any$5;
3886
4211
  activeBodies(): void;
3887
4212
  inactiveBodies(): void;
3888
- copy(dict?: Any$4, todo?: Any$4): Any$4;
4213
+ copy(dict?: Any$5, todo?: Any$5): Any$5;
3889
4214
  validate(): void;
3890
4215
  wake_connected(): void;
3891
4216
  forest(): void;
3892
- pair_exists(id: Any$4, di: Any$4): boolean;
4217
+ pair_exists(id: Any$5, di: Any$5): boolean;
3893
4218
  clearcache(): void;
3894
4219
  preStep(dt: number): boolean;
3895
4220
  warmStart(): void;
@@ -3897,7 +4222,7 @@ declare class ZPP_MotorJoint extends ZPP_Constraint {
3897
4222
  applyImpulsePos(): boolean;
3898
4223
  }
3899
4224
 
3900
- type Any$3 = any;
4225
+ type Any$4 = any;
3901
4226
  /**
3902
4227
  * Motor joint — applies angular velocity to rotate bodies relative to each other.
3903
4228
  *
@@ -3907,7 +4232,7 @@ declare class MotorJoint extends Constraint {
3907
4232
  zpp_inner: ZPP_MotorJoint;
3908
4233
  constructor(body1: Body | null, body2: Body | null, rate?: number, ratio?: number);
3909
4234
  /** @internal */
3910
- static _wrap(inner: Any$3): MotorJoint;
4235
+ static _wrap(inner: Any$4): MotorJoint;
3911
4236
  get body1(): Body;
3912
4237
  set body1(value: Body | null);
3913
4238
  /** @internal */
@@ -3920,13 +4245,13 @@ declare class MotorJoint extends Constraint {
3920
4245
  set rate(value: number);
3921
4246
  get ratio(): number;
3922
4247
  set ratio(value: number);
3923
- impulse(): Any$3;
3924
- bodyImpulse(body: Body): Any$3;
4248
+ impulse(): Any$4;
4249
+ bodyImpulse(body: Body): Any$4;
3925
4250
  visitBodies(lambda: (body: Body) => void): void;
3926
- /** @internal */ get_body1(): Any$3;
3927
- /** @internal */ set_body1(v: Any$3): Any$3;
3928
- /** @internal */ get_body2(): Any$3;
3929
- /** @internal */ set_body2(v: Any$3): Any$3;
4251
+ /** @internal */ get_body1(): Any$4;
4252
+ /** @internal */ set_body1(v: Any$4): Any$4;
4253
+ /** @internal */ get_body2(): Any$4;
4254
+ /** @internal */ set_body2(v: Any$4): Any$4;
3930
4255
  /** @internal */ get_rate(): number;
3931
4256
  /** @internal */ set_rate(v: number): number;
3932
4257
  /** @internal */ get_ratio(): number;
@@ -3946,12 +4271,12 @@ declare class MotorJoint extends Constraint {
3946
4271
  * Converted from nape-compiled.js lines 23205–23304.
3947
4272
  */
3948
4273
 
3949
- type Any$2 = any;
4274
+ type Any$3 = any;
3950
4275
  declare class ZPP_LineJoint extends ZPP_Constraint {
3951
4276
  static __name__: string[];
3952
4277
  static __super__: typeof ZPP_Constraint;
3953
- static _wrapFn: ((zpp: ZPP_LineJoint) => Any$2) | null;
3954
- outer_zn: Any$2;
4278
+ static _wrapFn: ((zpp: ZPP_LineJoint) => Any$3) | null;
4279
+ outer_zn: Any$3;
3955
4280
  scale: number;
3956
4281
  jointMin: number;
3957
4282
  jointMax: number;
@@ -3960,35 +4285,35 @@ declare class ZPP_LineJoint extends ZPP_Constraint {
3960
4285
  dot2: number;
3961
4286
  cx1: number;
3962
4287
  cx2: number;
3963
- b1: Any$2;
4288
+ b1: Any$3;
3964
4289
  a1localx: number;
3965
4290
  a1localy: number;
3966
4291
  a1relx: number;
3967
4292
  a1rely: number;
3968
- wrap_a1: Any$2;
3969
- b2: Any$2;
4293
+ wrap_a1: Any$3;
4294
+ b2: Any$3;
3970
4295
  a2localx: number;
3971
4296
  a2localy: number;
3972
4297
  a2relx: number;
3973
4298
  a2rely: number;
3974
- wrap_a2: Any$2;
3975
- zip_n: Any$2;
4299
+ wrap_a2: Any$3;
4300
+ zip_n: Any$3;
3976
4301
  nlocalx: number;
3977
4302
  nlocaly: number;
3978
4303
  nrelx: number;
3979
4304
  nrely: number;
3980
- wrap_n: Any$2;
4305
+ wrap_n: Any$3;
3981
4306
  kMassa: number;
3982
4307
  kMassb: number;
3983
4308
  kMassc: number;
3984
4309
  jAccx: number;
3985
4310
  jAccy: number;
3986
- jMax: Any$2;
3987
- gamma: Any$2;
4311
+ jMax: Any$3;
4312
+ gamma: Any$3;
3988
4313
  biasx: number;
3989
4314
  biasy: number;
3990
4315
  stepped: boolean;
3991
- __class__: Any$2;
4316
+ __class__: Any$3;
3992
4317
  constructor();
3993
4318
  /**
3994
4319
  * Creates or recycles a Vec2 from the public pool, sets its x/y,
@@ -3997,19 +4322,19 @@ declare class ZPP_LineJoint extends ZPP_Constraint {
3997
4322
  */
3998
4323
  private _setupVec2;
3999
4324
  validate_a1(): void;
4000
- invalidate_a1(x: Any$2): void;
4325
+ invalidate_a1(x: Any$3): void;
4001
4326
  setup_a1(): void;
4002
4327
  validate_a2(): void;
4003
- invalidate_a2(x: Any$2): void;
4328
+ invalidate_a2(x: Any$3): void;
4004
4329
  setup_a2(): void;
4005
4330
  validate_n(): void;
4006
- invalidate_n(x: Any$2): void;
4331
+ invalidate_n(x: Any$3): void;
4007
4332
  setup_n(): void;
4008
4333
  validate_norm(): void;
4009
- bodyImpulse(b: Any$2): Any$2;
4334
+ bodyImpulse(b: Any$3): Any$3;
4010
4335
  activeBodies(): void;
4011
4336
  inactiveBodies(): void;
4012
- copy(dict: Any$2, todo: Any$2): Any$2;
4337
+ copy(dict: Any$3, todo: Any$3): Any$3;
4013
4338
  validate(): void;
4014
4339
  wake_connected(): void;
4015
4340
  forest(): void;
@@ -4019,10 +4344,10 @@ declare class ZPP_LineJoint extends ZPP_Constraint {
4019
4344
  warmStart(): void;
4020
4345
  applyImpulseVel(): boolean;
4021
4346
  applyImpulsePos(): boolean;
4022
- draw(_g: Any$2): void;
4347
+ draw(_g: Any$3): void;
4023
4348
  }
4024
4349
 
4025
- type Any$1 = any;
4350
+ type Any$2 = any;
4026
4351
  /**
4027
4352
  * Line joint — constrains body2's anchor to slide along a line
4028
4353
  * defined by body1's anchor and direction.
@@ -4033,7 +4358,7 @@ declare class LineJoint extends Constraint {
4033
4358
  zpp_inner: ZPP_LineJoint;
4034
4359
  constructor(body1: Body | null, body2: Body | null, anchor1: Vec2, anchor2: Vec2, direction: Vec2, jointMin: number, jointMax: number);
4035
4360
  /** @internal */
4036
- static _wrap(inner: Any$1): LineJoint;
4361
+ static _wrap(inner: Any$2): LineJoint;
4037
4362
  get body1(): Body;
4038
4363
  set body1(value: Body | null);
4039
4364
  /** @internal */
@@ -4052,19 +4377,19 @@ declare class LineJoint extends Constraint {
4052
4377
  set jointMin(value: number);
4053
4378
  get jointMax(): number;
4054
4379
  set jointMax(value: number);
4055
- impulse(): Any$1;
4056
- bodyImpulse(body: Body): Any$1;
4380
+ impulse(): Any$2;
4381
+ bodyImpulse(body: Body): Any$2;
4057
4382
  visitBodies(lambda: (body: Body) => void): void;
4058
- /** @internal */ get_body1(): Any$1;
4059
- /** @internal */ set_body1(v: Any$1): Any$1;
4060
- /** @internal */ get_body2(): Any$1;
4061
- /** @internal */ set_body2(v: Any$1): Any$1;
4062
- /** @internal */ get_anchor1(): Any$1;
4063
- /** @internal */ set_anchor1(v: Any$1): Any$1;
4064
- /** @internal */ get_anchor2(): Any$1;
4065
- /** @internal */ set_anchor2(v: Any$1): Any$1;
4066
- /** @internal */ get_direction(): Any$1;
4067
- /** @internal */ set_direction(v: Any$1): Any$1;
4383
+ /** @internal */ get_body1(): Any$2;
4384
+ /** @internal */ set_body1(v: Any$2): Any$2;
4385
+ /** @internal */ get_body2(): Any$2;
4386
+ /** @internal */ set_body2(v: Any$2): Any$2;
4387
+ /** @internal */ get_anchor1(): Any$2;
4388
+ /** @internal */ set_anchor1(v: Any$2): Any$2;
4389
+ /** @internal */ get_anchor2(): Any$2;
4390
+ /** @internal */ set_anchor2(v: Any$2): Any$2;
4391
+ /** @internal */ get_direction(): Any$2;
4392
+ /** @internal */ set_direction(v: Any$2): Any$2;
4068
4393
  /** @internal */ get_jointMin(): number;
4069
4394
  /** @internal */ set_jointMin(v: number): number;
4070
4395
  /** @internal */ get_jointMax(): number;
@@ -4074,13 +4399,108 @@ declare class LineJoint extends Constraint {
4074
4399
  set zpp_inner_zn(v: ZPP_LineJoint);
4075
4400
  }
4076
4401
 
4402
+ /**
4403
+ * ZPP_PulleyJoint — Internal 4-body, 1-DOF pulley constraint.
4404
+ *
4405
+ * Constrains (dist(b1,b2) + ratio * dist(b3,b4)) to [jointMin, jointMax].
4406
+ * Supports mechanical advantage ratio, slack detection, stiffness/damping,
4407
+ * and large-error pre-correction in applyImpulsePos.
4408
+ *
4409
+ * Converted from nape-compiled.js lines 25475–25367.
4410
+ */
4411
+
4412
+ type Any$1 = any;
4413
+ declare class ZPP_PulleyJoint extends ZPP_Constraint {
4414
+ static __name__: string[];
4415
+ static __super__: typeof ZPP_Constraint;
4416
+ static _wrapFn: ((zpp: ZPP_PulleyJoint) => Any$1) | null;
4417
+ outer_zn: Any$1;
4418
+ ratio: number;
4419
+ jointMin: number;
4420
+ jointMax: number;
4421
+ slack: boolean;
4422
+ equal: boolean;
4423
+ n12x: number;
4424
+ n12y: number;
4425
+ n34x: number;
4426
+ n34y: number;
4427
+ cx1: number;
4428
+ cx2: number;
4429
+ cx3: number;
4430
+ cx4: number;
4431
+ b1: Any$1;
4432
+ a1localx: number;
4433
+ a1localy: number;
4434
+ a1relx: number;
4435
+ a1rely: number;
4436
+ wrap_a1: Any$1;
4437
+ b2: Any$1;
4438
+ a2localx: number;
4439
+ a2localy: number;
4440
+ a2relx: number;
4441
+ a2rely: number;
4442
+ wrap_a2: Any$1;
4443
+ b3: Any$1;
4444
+ a3localx: number;
4445
+ a3localy: number;
4446
+ a3relx: number;
4447
+ a3rely: number;
4448
+ wrap_a3: Any$1;
4449
+ b4: Any$1;
4450
+ a4localx: number;
4451
+ a4localy: number;
4452
+ a4relx: number;
4453
+ a4rely: number;
4454
+ wrap_a4: Any$1;
4455
+ kMass: number;
4456
+ jAcc: number;
4457
+ jMax: number;
4458
+ gamma: number;
4459
+ bias: number;
4460
+ stepped: boolean;
4461
+ __class__: Any$1;
4462
+ constructor();
4463
+ is_slack(): boolean;
4464
+ bodyImpulse(b: Any$1): Any$1;
4465
+ activeBodies(): void;
4466
+ inactiveBodies(): void;
4467
+ validate_a1(): void;
4468
+ invalidate_a1(x: Any$1): void;
4469
+ setup_a1(): void;
4470
+ validate_a2(): void;
4471
+ invalidate_a2(x: Any$1): void;
4472
+ setup_a2(): void;
4473
+ validate_a3(): void;
4474
+ invalidate_a3(x: Any$1): void;
4475
+ setup_a3(): void;
4476
+ validate_a4(): void;
4477
+ invalidate_a4(x: Any$1): void;
4478
+ setup_a4(): void;
4479
+ copy(dict: Any$1, todo: Any$1): Any$1;
4480
+ validate(): void;
4481
+ wake_connected(): void;
4482
+ forest(): void;
4483
+ pair_exists(id: number, di: number): boolean;
4484
+ clearcache(): void;
4485
+ preStep(dt: number): boolean;
4486
+ warmStart(): void;
4487
+ applyImpulseVel(): boolean;
4488
+ applyImpulsePos(): boolean;
4489
+ draw(_g: Any$1): void;
4490
+ }
4491
+
4077
4492
  type Any = any;
4078
4493
  /**
4079
- * Pulley joint — constrains the sum of distances between four anchor points
4080
- * on four bodies.
4494
+ * Pulley joint — constrains the weighted sum of distances between
4495
+ * four anchor points on four bodies.
4496
+ *
4497
+ * Fully modernized — uses ZPP_PulleyJoint directly (extracted to TypeScript).
4081
4498
  */
4082
4499
  declare class PulleyJoint extends Constraint {
4500
+ zpp_inner: ZPP_PulleyJoint;
4083
4501
  constructor(body1: Body | null, body2: Body | null, body3: Body | null, body4: Body | null, anchor1: Vec2, anchor2: Vec2, anchor3: Vec2, anchor4: Vec2, jointMin: number, jointMax: number, ratio?: number);
4502
+ /** @internal Helper to set an anchor during construction. */
4503
+ private _setAnchorInit;
4084
4504
  /** @internal */
4085
4505
  static _wrap(inner: Any): PulleyJoint;
4086
4506
  get body1(): Body;
@@ -4091,6 +4511,14 @@ declare class PulleyJoint extends Constraint {
4091
4511
  set body3(value: Body | null);
4092
4512
  get body4(): Body;
4093
4513
  set body4(value: Body | null);
4514
+ /** @internal */
4515
+ private _setBody1;
4516
+ /** @internal */
4517
+ private _setBody2;
4518
+ /** @internal */
4519
+ private _setBody3;
4520
+ /** @internal */
4521
+ private _setBody4;
4094
4522
  get anchor1(): Vec2;
4095
4523
  set anchor1(value: Vec2);
4096
4524
  get anchor2(): Vec2;
@@ -4105,6 +4533,35 @@ declare class PulleyJoint extends Constraint {
4105
4533
  set jointMax(value: number);
4106
4534
  get ratio(): number;
4107
4535
  set ratio(value: number);
4536
+ isSlack(): boolean;
4537
+ impulse(): Any;
4538
+ bodyImpulse(body: Body): Any;
4539
+ visitBodies(lambda: (body: Body) => void): void;
4540
+ /** @internal */ get_body1(): Any;
4541
+ /** @internal */ set_body1(v: Any): Any;
4542
+ /** @internal */ get_body2(): Any;
4543
+ /** @internal */ set_body2(v: Any): Any;
4544
+ /** @internal */ get_body3(): Any;
4545
+ /** @internal */ set_body3(v: Any): Any;
4546
+ /** @internal */ get_body4(): Any;
4547
+ /** @internal */ set_body4(v: Any): Any;
4548
+ /** @internal */ get_anchor1(): Any;
4549
+ /** @internal */ set_anchor1(v: Any): Any;
4550
+ /** @internal */ get_anchor2(): Any;
4551
+ /** @internal */ set_anchor2(v: Any): Any;
4552
+ /** @internal */ get_anchor3(): Any;
4553
+ /** @internal */ set_anchor3(v: Any): Any;
4554
+ /** @internal */ get_anchor4(): Any;
4555
+ /** @internal */ set_anchor4(v: Any): Any;
4556
+ /** @internal */ get_jointMin(): number;
4557
+ /** @internal */ set_jointMin(v: number): number;
4558
+ /** @internal */ get_jointMax(): number;
4559
+ /** @internal */ set_jointMax(v: number): number;
4560
+ /** @internal */ get_ratio(): number;
4561
+ /** @internal */ set_ratio(v: number): number;
4562
+ /** @internal backward compat alias for zpp_inner */
4563
+ get zpp_inner_zn(): ZPP_PulleyJoint;
4564
+ set zpp_inner_zn(v: ZPP_PulleyJoint);
4108
4565
  }
4109
4566
 
4110
4567
  declare const VERSION: string;