@perplexdotgg/bounce 1.5.2 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/bounce.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createClass, ChildType, NumberType, LazyReferenceListType, BooleanType, LazyReferenceType, ReferenceListType, ReferenceType } from "monomorph";
1
+ import { props, createClass, ChildType, NumberType, LazyReferenceListType, BooleanType, LazyReferenceType, ReferenceListType, ReferenceType } from "monomorph";
2
2
  const mat3Keys = ["e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8"];
3
- const mat3Props = {
3
+ const mat3Props = props({
4
4
  e0: 0,
5
5
  e1: 0,
6
6
  e2: 0,
@@ -10,8 +10,8 @@ const mat3Props = {
10
10
  e6: 0,
11
11
  e7: 0,
12
12
  e8: 0
13
- };
14
- class Mat3 extends createClass(mat3Props) {
13
+ });
14
+ class Mat3 extends createClass()(mat3Props) {
15
15
  adjointMatrix(a3) {
16
16
  let a00 = a3.e0, a01 = a3.e1, a02 = a3.e2;
17
17
  let a10 = a3.e3, a11 = a3.e4, a12 = a3.e5;
@@ -420,12 +420,12 @@ function squaredDistance(a3, b3) {
420
420
  let z = b3.z - a3.z;
421
421
  return x2 * x2 + y4 * y4 + z * z;
422
422
  }
423
- const vec3Props = {
423
+ const vec3Props = props({
424
424
  x: 0,
425
425
  y: 0,
426
426
  z: 0
427
- };
428
- class Vec3 extends createClass(vec3Props) {
427
+ });
428
+ class Vec3 extends createClass()(vec3Props) {
429
429
  constructor(data, index, pool) {
430
430
  if (Array.isArray(data)) {
431
431
  data = {
@@ -923,24 +923,24 @@ const rb = /* @__PURE__ */ Vec3.create();
923
923
  const temp = /* @__PURE__ */ Vec3.create();
924
924
  const rotatedVector = /* @__PURE__ */ Vec3.create();
925
925
  const rotationMatrix$3 = /* @__PURE__ */ Mat3.create();
926
- const lineProps = {
926
+ const lineProps = props({
927
927
  a: Vec3,
928
928
  b: Vec3
929
- };
930
- class Line extends createClass(lineProps) {
929
+ });
930
+ class Line extends createClass()(lineProps) {
931
931
  setFromPointAndDirection(point2, direction2, length) {
932
932
  this.a.copy(point2);
933
933
  this.b.addScaledToVector(point2, direction2, length);
934
934
  }
935
935
  }
936
936
  const quatKeys = ["x", "y", "z", "w"];
937
- const quatProps = {
937
+ const quatProps = props({
938
938
  x: 0,
939
939
  y: 0,
940
940
  z: 0,
941
941
  w: 1
942
- };
943
- class Quat extends createClass(quatProps) {
942
+ });
943
+ class Quat extends createClass()(quatProps) {
944
944
  constructor(data, index, pool) {
945
945
  if (Array.isArray(data)) {
946
946
  if (data.length && data.length < 4) {
@@ -1160,7 +1160,7 @@ const rotationMatrix$2 = /* @__PURE__ */ Mat3.create();
1160
1160
  const scaling = /* @__PURE__ */ Vec3.create();
1161
1161
  const conjugatedRotation = /* @__PURE__ */ Quat.create();
1162
1162
  const rotatedTranslation = /* @__PURE__ */ Vec3.create();
1163
- const mat4Props = {
1163
+ const mat4Props = props({
1164
1164
  e0: 0,
1165
1165
  e1: 0,
1166
1166
  e2: 0,
@@ -1177,8 +1177,8 @@ const mat4Props = {
1177
1177
  e13: 0,
1178
1178
  e14: 0,
1179
1179
  e15: 0
1180
- };
1181
- class Mat4 extends createClass(mat4Props) {
1180
+ });
1181
+ class Mat4 extends createClass()(mat4Props) {
1182
1182
  multiply3x3(out, a3) {
1183
1183
  const x2 = a3.x;
1184
1184
  const y4 = a3.y;
@@ -1730,11 +1730,11 @@ class Mat4 extends createClass(mat4Props) {
1730
1730
  }
1731
1731
  const rotation$3 = /* @__PURE__ */ Quat.create();
1732
1732
  const cross_bn_cn = /* @__PURE__ */ Vec3.create();
1733
- const planeProps = {
1733
+ const planeProps = props({
1734
1734
  normal: Vec3,
1735
1735
  constant: 0
1736
- };
1737
- class Plane extends createClass(planeProps) {
1736
+ });
1737
+ class Plane extends createClass()(planeProps) {
1738
1738
  toObject() {
1739
1739
  return {
1740
1740
  normal: this.normal.toObject(),
@@ -1802,11 +1802,11 @@ class Plane extends createClass(planeProps) {
1802
1802
  return fraction;
1803
1803
  }
1804
1804
  }
1805
- const segmentProps = {
1805
+ const segmentProps = props({
1806
1806
  pointA: Vec3,
1807
1807
  pointB: Vec3
1808
- };
1809
- class Segment extends createClass(segmentProps) {
1808
+ });
1809
+ class Segment extends createClass()(segmentProps) {
1810
1810
  computeCenter(out) {
1811
1811
  out.addVectors(this.pointA, this.pointB);
1812
1812
  out.scaleVector(out, 0.5);
@@ -1826,12 +1826,12 @@ const newMax = /* @__PURE__ */ Vec3.create();
1826
1826
  const col = /* @__PURE__ */ Vec3.create();
1827
1827
  const a$2 = /* @__PURE__ */ Vec3.create();
1828
1828
  const b$1 = /* @__PURE__ */ Vec3.create();
1829
- const aabbProps = {
1829
+ const aabbProps = props({
1830
1830
  min: Vec3,
1831
1831
  max: Vec3,
1832
1832
  centroid: ChildType(Vec3, void 0, true)
1833
- };
1834
- class Aabb extends createClass(aabbProps) {
1833
+ });
1834
+ class Aabb extends createClass()(aabbProps) {
1835
1835
  computeSupport(out, direction2) {
1836
1836
  out.x = direction2.x < 0 ? this.min.x : this.max.x;
1837
1837
  out.y = direction2.y < 0 ? this.min.y : this.max.y;
@@ -2105,7 +2105,7 @@ const aabbCenter = /* @__PURE__ */ Vec3.create();
2105
2105
  const aabbHalfExtents = /* @__PURE__ */ Vec3.create();
2106
2106
  const segmentCenter = /* @__PURE__ */ Vec3.create();
2107
2107
  const segmentHalfExtents = /* @__PURE__ */ Vec3.create();
2108
- const triangleProps$1 = {
2108
+ const triangleProps$1 = props({
2109
2109
  computedBounds: ChildType(Aabb, void 0, true),
2110
2110
  normal: ChildType(Vec3, void 0, true),
2111
2111
  a: Vec3,
@@ -2116,10 +2116,10 @@ const triangleProps$1 = {
2116
2116
  // aabb: { struct: Aabb, readOnly: true },
2117
2117
  // activeEdges: { struct: Uint32, optional: true },
2118
2118
  // translation: { struct: Vec3, optional: true },
2119
- };
2119
+ });
2120
2120
  const ab$5 = /* @__PURE__ */ Vec3.create();
2121
2121
  const ac$3 = /* @__PURE__ */ Vec3.create();
2122
- let Triangle$1 = class Triangle extends createClass(triangleProps$1) {
2122
+ let Triangle$1 = class Triangle extends createClass()(triangleProps$1) {
2123
2123
  // type: ShapeType.triangle = ShapeType.triangle;
2124
2124
  computeNormal(out) {
2125
2125
  ab$5.subtractVectors(this.b, this.a);
@@ -2192,13 +2192,13 @@ let Triangle$1 = class Triangle extends createClass(triangleProps$1) {
2192
2192
  out.transform(centerOfMassTransform2);
2193
2193
  }
2194
2194
  };
2195
- const faceProps = {
2195
+ const faceProps = props({
2196
2196
  numVertices: 0,
2197
2197
  buffer: LazyReferenceListType(() => Vec3)
2198
- };
2198
+ });
2199
2199
  const triangle$1 = /* @__PURE__ */ Triangle$1.create();
2200
2200
  const tempVertex = /* @__PURE__ */ Vec3.create();
2201
- class Face extends createClass(faceProps) {
2201
+ class Face extends createClass()(faceProps) {
2202
2202
  clear() {
2203
2203
  this.numVertices = 0;
2204
2204
  }
@@ -2294,7 +2294,7 @@ var ConstraintType = /* @__PURE__ */ ((ConstraintType2) => {
2294
2294
  ConstraintType2[ConstraintType2["hingeConstraint"] = 3] = "hingeConstraint";
2295
2295
  return ConstraintType2;
2296
2296
  })(ConstraintType || {});
2297
- const baseConstraintProps = {
2297
+ const baseConstraintProps = props({
2298
2298
  // unless we use require here, this file will be imported after it is needed
2299
2299
  bodyA: LazyReferenceType((() => Body)),
2300
2300
  bodyB: LazyReferenceType((() => Body)),
@@ -2304,10 +2304,10 @@ const baseConstraintProps = {
2304
2304
  /* local */
2305
2305
  ),
2306
2306
  isEnabled: BooleanType(true)
2307
- };
2307
+ });
2308
2308
  const localToWorldTransformA$1 = /* @__PURE__ */ Mat4.create();
2309
2309
  const point$1 = /* @__PURE__ */ Vec3.create();
2310
- const contactManifoldProps = {
2310
+ const contactManifoldProps = props({
2311
2311
  // meta data
2312
2312
  bodyA: LazyReferenceType((() => Body)),
2313
2313
  bodyB: LazyReferenceType((() => Body)),
@@ -2323,8 +2323,8 @@ const contactManifoldProps = {
2323
2323
  contactPointsA: ReferenceListType(Vec3),
2324
2324
  contactPointsB: ReferenceListType(Vec3),
2325
2325
  lambdas: ReferenceListType(Vec3)
2326
- };
2327
- class ContactManifold extends createClass(contactManifoldProps) {
2326
+ });
2327
+ class ContactManifold extends createClass()(contactManifoldProps) {
2328
2328
  get maxContacts() {
2329
2329
  return this.contactPointsA.maxLength;
2330
2330
  }
@@ -2444,21 +2444,21 @@ class ContactManifoldPool {
2444
2444
  return manifold;
2445
2445
  }
2446
2446
  }
2447
- const contactPairProps = {
2447
+ const contactPairProps = props({
2448
2448
  bodyA: LazyReferenceType((() => Body)),
2449
2449
  bodyB: LazyReferenceType((() => Body)),
2450
2450
  firstContactManifold: ReferenceType(ContactManifold),
2451
2451
  translationAB: Vec3,
2452
2452
  rotationAB: Quat
2453
- };
2454
- class ContactPair extends createClass(contactPairProps) {
2453
+ });
2454
+ class ContactPair extends createClass()(contactPairProps) {
2455
2455
  get key() {
2456
2456
  return createContactPairKey(this.bodyA, this.bodyB);
2457
2457
  }
2458
2458
  }
2459
2459
  function createContactPairKey(bodyA, bodyB) {
2460
- const keyA = `${bodyA.type}:${bodyA.index}`;
2461
- const keyB = `${bodyB.type}:${bodyB.index}`;
2460
+ const keyA = `${bodyA.type}:${bodyA.poolIndex}`;
2461
+ const keyB = `${bodyB.type}:${bodyB.poolIndex}`;
2462
2462
  return keyA < keyB ? `${keyA}|${keyB}` : `${keyB}|${keyA}`;
2463
2463
  }
2464
2464
  const linearVelocityA = /* @__PURE__ */ Vec3.create();
@@ -2468,7 +2468,7 @@ const angularVelocityA = /* @__PURE__ */ Vec3.create();
2468
2468
  const angularVelocityB = /* @__PURE__ */ Vec3.create();
2469
2469
  const inverseInertiaA$2 = /* @__PURE__ */ Mat3.create();
2470
2470
  const inverseInertiaB$2 = /* @__PURE__ */ Mat3.create();
2471
- const directionalConstraintProps = {
2471
+ const directionalConstraintProps = props({
2472
2472
  mR1PlusUxAxis: Vec3,
2473
2473
  mR2xAxis: Vec3,
2474
2474
  mInvI1_R1PlusUxAxis: Vec3,
@@ -2477,10 +2477,8 @@ const directionalConstraintProps = {
2477
2477
  bias: 0,
2478
2478
  softness: 0,
2479
2479
  totalLambda: 0
2480
- };
2481
- class DirectionalConstraint extends createClass(
2482
- directionalConstraintProps
2483
- ) {
2480
+ });
2481
+ class DirectionalConstraint extends createClass()(directionalConstraintProps) {
2484
2482
  isSpringActive() {
2485
2483
  return this.softness !== 0;
2486
2484
  }
@@ -2610,16 +2608,14 @@ class DirectionalConstraint extends createClass(
2610
2608
  }
2611
2609
  }
2612
2610
  }
2613
- const contactConstraintProps = {
2611
+ const contactConstraintProps = props({
2614
2612
  normalConstraint: DirectionalConstraint,
2615
2613
  tangentConstraint: DirectionalConstraint,
2616
2614
  bitangentConstraint: DirectionalConstraint,
2617
2615
  localPositionA: Vec3,
2618
2616
  localPositionB: Vec3
2619
- };
2620
- class ContactConstraint extends createClass(
2621
- contactConstraintProps
2622
- ) {
2617
+ });
2618
+ class ContactConstraint extends createClass()(contactConstraintProps) {
2623
2619
  getLambda(out, index) {
2624
2620
  out.x = this.normalConstraint.totalLambda;
2625
2621
  out.y = this.tangentConstraint.totalLambda;
@@ -2641,7 +2637,7 @@ class ContactConstraint extends createClass(
2641
2637
  this.normalConstraint.warmStart(bodyA, bodyB, inverseMassA, inverseMassB, normal4);
2642
2638
  }
2643
2639
  }
2644
- const manifoldConstraintProps = {
2640
+ const manifoldConstraintProps = props({
2645
2641
  bodyA: LazyReferenceType((() => Body)),
2646
2642
  bodyB: LazyReferenceType((() => Body)),
2647
2643
  subShapeIdA: 0,
@@ -2655,10 +2651,8 @@ const manifoldConstraintProps = {
2655
2651
  inverseMassB: 0,
2656
2652
  contactConstraints: ReferenceListType(ContactConstraint),
2657
2653
  numContacts: 0
2658
- };
2659
- class ManifoldConstraint extends createClass(
2660
- manifoldConstraintProps
2661
- ) {
2654
+ });
2655
+ class ManifoldConstraint extends createClass()(manifoldConstraintProps) {
2662
2656
  updateTangentDirections() {
2663
2657
  this.worldSpaceTangent.computeNormalizedPerpendicular(this.worldSpaceNormal);
2664
2658
  this.worldSpaceBitangent.crossVectors(this.worldSpaceNormal, this.worldSpaceTangent);
@@ -2758,14 +2752,14 @@ function computeClosestPowersOfTwo(n2) {
2758
2752
  const next = 1 << Math.ceil(Math.log2(n2));
2759
2753
  return { previous, next };
2760
2754
  }
2761
- const isometryProps = {
2755
+ const isometryProps = props({
2762
2756
  matrix: Mat4
2763
- };
2757
+ });
2764
2758
  const tempTranslation = /* @__PURE__ */ Vec3.create();
2765
2759
  const tempRotation = /* @__PURE__ */ Quat.create();
2766
2760
  const rotation$2 = /* @__PURE__ */ Mat3.create();
2767
2761
  const inverseMatrix = /* @__PURE__ */ Mat4.create();
2768
- class Isometry extends createClass(isometryProps) {
2762
+ class Isometry extends createClass()(isometryProps) {
2769
2763
  fromRotationAndTranslation(rotation2, translation) {
2770
2764
  if (rotation2) {
2771
2765
  tempRotation.copy(rotation2);
@@ -2839,12 +2833,12 @@ class ArrayPool {
2839
2833
  return null;
2840
2834
  }
2841
2835
  const instance = this.array[this._count];
2842
- instance.index = this._count;
2836
+ instance.poolIndex = this._count;
2843
2837
  this._count++;
2844
2838
  return instance;
2845
2839
  }
2846
2840
  remove(instance) {
2847
- const index = instance.index;
2841
+ const index = instance.poolIndex;
2848
2842
  const lastIndex = this._count - 1;
2849
2843
  if (index === lastIndex) {
2850
2844
  this._count--;
@@ -2852,8 +2846,8 @@ class ArrayPool {
2852
2846
  }
2853
2847
  this.array[index] = this.array[lastIndex];
2854
2848
  this.array[lastIndex] = instance;
2855
- this.array[index].index = index;
2856
- this.array[lastIndex].index = lastIndex;
2849
+ this.array[index].poolIndex = index;
2850
+ this.array[lastIndex].poolIndex = lastIndex;
2857
2851
  this._count--;
2858
2852
  }
2859
2853
  clear() {
@@ -3313,11 +3307,11 @@ class TransformedConvexObject {
3313
3307
  out.transformFromMat4(this.transform.matrix);
3314
3308
  }
3315
3309
  }
3316
- const transformedConvexShapeProps = {
3310
+ const transformedConvexShapeProps = props({
3317
3311
  transform: Isometry
3318
- };
3312
+ });
3319
3313
  const direction = /* @__PURE__ */ Vec3.create();
3320
- class TransformedConvexShape extends createClass(
3314
+ class TransformedConvexShape extends createClass()(
3321
3315
  transformedConvexShapeProps
3322
3316
  ) {
3323
3317
  constructor() {
@@ -3331,12 +3325,10 @@ class TransformedConvexShape extends createClass(
3331
3325
  out.transformByMat4(this.transform.matrix);
3332
3326
  }
3333
3327
  }
3334
- const convexRadiusObjectProps = {
3328
+ const convexRadiusObjectProps = props({
3335
3329
  radius: 0
3336
- };
3337
- class ConvexRadiusObject extends createClass(
3338
- convexRadiusObjectProps
3339
- ) {
3330
+ });
3331
+ class ConvexRadiusObject extends createClass()(convexRadiusObjectProps) {
3340
3332
  constructor() {
3341
3333
  super();
3342
3334
  this.convexShape = null;
@@ -3383,10 +3375,10 @@ var ShapeType = /* @__PURE__ */ ((ShapeType2) => {
3383
3375
  ShapeType2[ShapeType2["triangleMesh"] = 7] = "triangleMesh";
3384
3376
  return ShapeType2;
3385
3377
  })(ShapeType || {});
3386
- const sphereNoConvexProps = {
3378
+ const sphereNoConvexProps = props({
3387
3379
  radius: 0
3388
- };
3389
- class SphereNoConvex extends createClass(sphereNoConvexProps) {
3380
+ });
3381
+ class SphereNoConvex extends createClass()(sphereNoConvexProps) {
3390
3382
  getConvexRadius() {
3391
3383
  return this.radius;
3392
3384
  }
@@ -3394,10 +3386,10 @@ class SphereNoConvex extends createClass(sphereNoConvexProps) {
3394
3386
  out.zero();
3395
3387
  }
3396
3388
  }
3397
- const sphereWithConvexProps = {
3389
+ const sphereWithConvexProps = props({
3398
3390
  radius: 0
3399
- };
3400
- class SphereWithConvex extends createClass(sphereWithConvexProps) {
3391
+ });
3392
+ class SphereWithConvex extends createClass()(sphereWithConvexProps) {
3401
3393
  getConvexRadius() {
3402
3394
  return 0;
3403
3395
  }
@@ -3410,7 +3402,7 @@ class SphereWithConvex extends createClass(sphereWithConvexProps) {
3410
3402
  }
3411
3403
  }
3412
3404
  }
3413
- const sphereProps = {
3405
+ const sphereProps = props({
3414
3406
  computedCenterOfMass: ChildType(Vec3, void 0, true),
3415
3407
  computedVolume: NumberType(0, true),
3416
3408
  computedAabb: ChildType(Aabb, void 0, true),
@@ -3418,11 +3410,11 @@ const sphereProps = {
3418
3410
  copyForDiff: LazyReferenceType((() => Sphere)),
3419
3411
  sphereNoConvex: ChildType(SphereNoConvex, void 0, true),
3420
3412
  sphereWithConvex: ChildType(SphereWithConvex, void 0, true)
3421
- };
3413
+ });
3422
3414
  const afterConstructorCode$a = `
3423
3415
  this.world = null;
3424
3416
  `;
3425
- class Sphere extends createClass(sphereProps, { afterConstructorCode: afterConstructorCode$a }) {
3417
+ class Sphere extends createClass({ afterConstructorCode: afterConstructorCode$a })(sphereProps) {
3426
3418
  constructor() {
3427
3419
  super(...arguments);
3428
3420
  this.type = ShapeType.sphere;
@@ -3518,12 +3510,12 @@ const isometry$8 = /* @__PURE__ */ Isometry.create();
3518
3510
  const absLocalSurfacePosition = /* @__PURE__ */ Vec3.create();
3519
3511
  const tempVector$4 = /* @__PURE__ */ Vec3.create();
3520
3512
  const defaultConvexRadius = 0.05;
3521
- const boxSupportProps = {
3513
+ const boxSupportProps = props({
3522
3514
  convexRadius: 0,
3523
3515
  // TODO: cannot used undefined default for this, possibly due to it being used as a deeply nested prop
3524
3516
  computedAabb: ChildType(Aabb, {}, true)
3525
- };
3526
- class BoxSupport extends createClass(boxSupportProps) {
3517
+ });
3518
+ class BoxSupport extends createClass()(boxSupportProps) {
3527
3519
  computeSupport(out, direction2) {
3528
3520
  this.computedAabb.computeSupport(out, direction2);
3529
3521
  }
@@ -3531,7 +3523,7 @@ class BoxSupport extends createClass(boxSupportProps) {
3531
3523
  return this.convexRadius;
3532
3524
  }
3533
3525
  }
3534
- const boxProps = {
3526
+ const boxProps = props({
3535
3527
  computedCenterOfMass: ChildType(Vec3, void 0, true),
3536
3528
  computedVolume: NumberType(0, true),
3537
3529
  computedAabb: ChildType(Aabb, void 0, true),
@@ -3541,11 +3533,11 @@ const boxProps = {
3541
3533
  depth: 0,
3542
3534
  boxSupport: ChildType(BoxSupport, void 0, true),
3543
3535
  copyForDiff: LazyReferenceType((() => Box))
3544
- };
3536
+ });
3545
3537
  const afterConstructorCode$9 = `
3546
3538
  this.world = null;
3547
3539
  `;
3548
- class Box extends createClass(boxProps, { afterConstructorCode: afterConstructorCode$9 }) {
3540
+ class Box extends createClass({ afterConstructorCode: afterConstructorCode$9 })(boxProps) {
3549
3541
  constructor() {
3550
3542
  super(...arguments);
3551
3543
  this.type = ShapeType.box;
@@ -3662,23 +3654,23 @@ function updateShape$6(shape) {
3662
3654
  updateVolume$4(shape);
3663
3655
  updateLocalBounds$6(shape);
3664
3656
  }
3665
- const bodyPairNodeProps = {
3657
+ const bodyPairNodeProps = props({
3666
3658
  bodyA: LazyReferenceType((() => Body)),
3667
3659
  bodyB: LazyReferenceType((() => Body)),
3668
3660
  edgeA: LazyReferenceType((() => BodyPairEdge)),
3669
3661
  edgeB: LazyReferenceType((() => BodyPairEdge))
3670
- };
3671
- class BodyPairNode extends createClass(bodyPairNodeProps) {
3662
+ });
3663
+ class BodyPairNode extends createClass()(bodyPairNodeProps) {
3672
3664
  containsStaticBody() {
3673
3665
  return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
3674
3666
  }
3675
3667
  }
3676
- const bodyPairEdgeProps = {
3668
+ const bodyPairEdgeProps = props({
3677
3669
  node: LazyReferenceType((() => BodyPairNode)),
3678
3670
  next: LazyReferenceType((() => BodyPairEdge)),
3679
3671
  prev: LazyReferenceType((() => BodyPairEdge))
3680
- };
3681
- class BodyPairEdge extends createClass(bodyPairEdgeProps) {
3672
+ });
3673
+ class BodyPairEdge extends createClass()(bodyPairEdgeProps) {
3682
3674
  }
3683
3675
  class BodyPairsModule {
3684
3676
  constructor(bodyPool, nodesPool, edgesPool) {
@@ -3743,7 +3735,7 @@ class BodyPairsModule {
3743
3735
  * @returns
3744
3736
  */
3745
3737
  createPair(bodyA, bodyB) {
3746
- if (bodyA.type === bodyB.type && bodyA.index > bodyB.index) {
3738
+ if (bodyA.type === bodyB.type && bodyA.poolIndex > bodyB.poolIndex) {
3747
3739
  const temp2 = bodyA;
3748
3740
  bodyA = bodyB;
3749
3741
  bodyB = temp2;
@@ -3917,12 +3909,12 @@ class BodyPairsModule {
3917
3909
  }
3918
3910
  }
3919
3911
  }
3920
- const rayProps = {
3912
+ const rayProps = props({
3921
3913
  origin: Vec3,
3922
3914
  direction: Vec3,
3923
3915
  length: 0
3924
- };
3925
- class Ray extends createClass(rayProps) {
3916
+ });
3917
+ class Ray extends createClass()(rayProps) {
3926
3918
  intersectsAabb(aabb) {
3927
3919
  return aabb.intersectsRay(this);
3928
3920
  }
@@ -4036,15 +4028,15 @@ const ray$4 = /* @__PURE__ */ Ray.create();
4036
4028
  const halfExtents$2 = /* @__PURE__ */ Vec3.create();
4037
4029
  const nodeBounds$1 = /* @__PURE__ */ Aabb.create();
4038
4030
  const bodyBounds$1 = /* @__PURE__ */ Aabb.create();
4039
- const bvhNodeProps$1 = {
4031
+ const bvhNodeProps$1 = props({
4040
4032
  parent: LazyReferenceType((() => BvhNode)),
4041
4033
  left: LazyReferenceType((() => BvhNode)),
4042
4034
  right: LazyReferenceType((() => BvhNode)),
4043
4035
  computedBounds: ChildType(Aabb, void 0, true),
4044
4036
  height: 0,
4045
4037
  objects: LazyReferenceListType((() => Body))
4046
- };
4047
- class BvhNode extends createClass(bvhNodeProps$1) {
4038
+ });
4039
+ class BvhNode extends createClass()(bvhNodeProps$1) {
4048
4040
  // objects: Body[] = [];
4049
4041
  isLeaf() {
4050
4042
  return this.left === null && this.right === null;
@@ -4568,20 +4560,20 @@ class BvhTree {
4568
4560
  }
4569
4561
  }
4570
4562
  }
4571
- const basicTransformProps = {
4563
+ const basicTransformProps = props({
4572
4564
  position: Vec3,
4573
4565
  rotation: Quat,
4574
4566
  scale: 1
4575
- };
4576
- class BasicTransform extends createClass(basicTransformProps) {
4567
+ });
4568
+ class BasicTransform extends createClass()(basicTransformProps) {
4577
4569
  equals(other, tolerance = 1e-6) {
4578
4570
  return this.position.equals(other.position, tolerance) && this.rotation.equals(other.rotation, tolerance) && Math.abs(this.scale - other.scale) < tolerance;
4579
4571
  }
4580
4572
  }
4581
- const numberValueProps = {
4573
+ const numberValueProps = props({
4582
4574
  value: 0
4583
- };
4584
- class NumberValue extends createClass(numberValueProps) {
4575
+ });
4576
+ class NumberValue extends createClass()(numberValueProps) {
4585
4577
  toObject() {
4586
4578
  return {
4587
4579
  value: this.value
@@ -4643,12 +4635,12 @@ class ConvexHullWithConvex {
4643
4635
  throw new Error("Method not implemented.");
4644
4636
  }
4645
4637
  }
4646
- const convexHullPointProps = {
4638
+ const convexHullPointProps = props({
4647
4639
  position: Vec3,
4648
4640
  numFaces: 0,
4649
4641
  faces: Vec3
4650
- };
4651
- class ConvexHullPoint extends createClass(convexHullPointProps) {
4642
+ });
4643
+ class ConvexHullPoint extends createClass()(convexHullPointProps) {
4652
4644
  toObject() {
4653
4645
  return {
4654
4646
  position: this.position.toObject(),
@@ -4657,11 +4649,11 @@ class ConvexHullPoint extends createClass(convexHullPointProps) {
4657
4649
  };
4658
4650
  }
4659
4651
  }
4660
- const convexHullFaceProps = {
4652
+ const convexHullFaceProps = props({
4661
4653
  firstVertex: 0,
4662
4654
  numVertices: 0
4663
- };
4664
- class ConvexHullFace extends createClass(convexHullFaceProps) {
4655
+ });
4656
+ class ConvexHullFace extends createClass()(convexHullFaceProps) {
4665
4657
  toObject() {
4666
4658
  return {
4667
4659
  firstVertex: this.firstVertex,
@@ -4669,7 +4661,7 @@ class ConvexHullFace extends createClass(convexHullFaceProps) {
4669
4661
  };
4670
4662
  }
4671
4663
  }
4672
- const convexHullProps = {
4664
+ const convexHullProps = props({
4673
4665
  computedCenterOfMass: ChildType(Vec3, void 0, true),
4674
4666
  computedVolume: NumberType(0, true),
4675
4667
  computedAabb: ChildType(Aabb, void 0, true),
@@ -4688,14 +4680,14 @@ const convexHullProps = {
4688
4680
  // { array: Float64Array(f), itemMaxCount: f / 3, itemSize: 3 } [Vec3], transformed points used by ConvexHullNoConvex
4689
4681
  translation: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
4690
4682
  copyForDiff: LazyReferenceType((() => ConvexHull))
4691
- };
4683
+ });
4692
4684
  const afterConstructorCode$8 = `
4693
- this.world = null;
4694
- this.shapeNoConvex = null;
4695
- this.shapeWithConvex = null;
4696
- this.type = ${ShapeType.convexHull};
4685
+ this.world = null;
4686
+ this.shapeNoConvex = null;
4687
+ this.shapeWithConvex = null;
4688
+ this.type = ${ShapeType.convexHull};
4697
4689
  `;
4698
- class ConvexHull extends createClass(convexHullProps, { afterConstructorCode: afterConstructorCode$8 }) {
4690
+ class ConvexHull extends createClass({ afterConstructorCode: afterConstructorCode$8 })(convexHullProps) {
4699
4691
  computeSupportShape(inMode, inScale) {
4700
4692
  if (this.convexRadius === 0) {
4701
4693
  this.shapeWithConvex.shape = this;
@@ -4880,14 +4872,12 @@ const vertex = /* @__PURE__ */ Vec3.create();
4880
4872
  const multiplier = /* @__PURE__ */ Vec3.create();
4881
4873
  const transform$1 = /* @__PURE__ */ Mat4.create();
4882
4874
  const isometry$6 = /* @__PURE__ */ Isometry.create();
4883
- const cylinderSupportShapeProps = {
4875
+ const cylinderSupportShapeProps = props({
4884
4876
  halfHeight: 0,
4885
4877
  radius: 0,
4886
4878
  convexRadius: 0
4887
- };
4888
- class CylinderSupportShape extends createClass(
4889
- cylinderSupportShapeProps
4890
- ) {
4879
+ });
4880
+ class CylinderSupportShape extends createClass()(cylinderSupportShapeProps) {
4891
4881
  getConvexRadius() {
4892
4882
  return this.convexRadius;
4893
4883
  }
@@ -4910,7 +4900,7 @@ class CylinderSupportShape extends createClass(
4910
4900
  throw new Error("Method not implemented.");
4911
4901
  }
4912
4902
  }
4913
- const cylinderProps = {
4903
+ const cylinderProps = props({
4914
4904
  computedCenterOfMass: ChildType(Vec3, void 0, true),
4915
4905
  computedVolume: NumberType(0, true),
4916
4906
  computedAabb: ChildType(Aabb, void 0, true),
@@ -4920,11 +4910,11 @@ const cylinderProps = {
4920
4910
  translation: ChildType(Vec3, void 0, true),
4921
4911
  supportShape: ChildType(CylinderSupportShape, void 0, true),
4922
4912
  copyForDiff: LazyReferenceType((() => Cylinder))
4923
- };
4913
+ });
4924
4914
  const afterConstructorCode$7 = `
4925
4915
  this.world = null;
4926
4916
  `;
4927
- class Cylinder extends createClass(cylinderProps, { afterConstructorCode: afterConstructorCode$7 }) {
4917
+ class Cylinder extends createClass({ afterConstructorCode: afterConstructorCode$7 })(cylinderProps) {
4928
4918
  constructor() {
4929
4919
  super(...arguments);
4930
4920
  this.type = ShapeType.cylinder;
@@ -5080,11 +5070,11 @@ const support = /* @__PURE__ */ Vec3.create();
5080
5070
  const supportTop = /* @__PURE__ */ Vec3.create();
5081
5071
  const negatedScaledHalfHeightOfCylinder = /* @__PURE__ */ Vec3.create();
5082
5072
  const supportBottom = /* @__PURE__ */ Vec3.create();
5083
- const capsuleNoConvexProps = {
5073
+ const capsuleNoConvexProps = props({
5084
5074
  halfHeightOfCylinder: Vec3,
5085
5075
  convexRadius: 0
5086
- };
5087
- class CapsuleNoConvex extends createClass(capsuleNoConvexProps) {
5076
+ });
5077
+ class CapsuleNoConvex extends createClass()(capsuleNoConvexProps) {
5088
5078
  computeSupport(out, direction2) {
5089
5079
  if (direction2.y > 0) {
5090
5080
  out.copy(this.halfHeightOfCylinder);
@@ -5099,13 +5089,11 @@ class CapsuleNoConvex extends createClass(capsuleNoConvexProps) {
5099
5089
  throw new Error("Method not implemented.");
5100
5090
  }
5101
5091
  }
5102
- const capsuleWithConvexProps = {
5092
+ const capsuleWithConvexProps = props({
5103
5093
  halfHeightOfCylinder: Vec3,
5104
5094
  radius: 0
5105
- };
5106
- class CapsuleWithConvex extends createClass(
5107
- capsuleWithConvexProps
5108
- ) {
5095
+ });
5096
+ class CapsuleWithConvex extends createClass()(capsuleWithConvexProps) {
5109
5097
  computeSupport(out, direction2) {
5110
5098
  const len = direction2.length();
5111
5099
  if (len > 0) {
@@ -5126,7 +5114,7 @@ class CapsuleWithConvex extends createClass(
5126
5114
  throw new Error("Method not implemented.");
5127
5115
  }
5128
5116
  }
5129
- const capsuleProps = {
5117
+ const capsuleProps = props({
5130
5118
  computedCenterOfMass: ChildType(Vec3, void 0, true),
5131
5119
  computedVolume: NumberType(0, true),
5132
5120
  computedAabb: ChildType(Aabb, void 0, true),
@@ -5135,11 +5123,11 @@ const capsuleProps = {
5135
5123
  copyForDiff: LazyReferenceType((() => Capsule)),
5136
5124
  capsuleNoConvex: ChildType(CapsuleNoConvex, void 0, true),
5137
5125
  capsuleWithConvex: ChildType(CapsuleWithConvex, void 0, true)
5138
- };
5126
+ });
5139
5127
  const afterConstructorCode$6 = `
5140
5128
  this.world = null;
5141
5129
  `;
5142
- class Capsule extends createClass(capsuleProps, { afterConstructorCode: afterConstructorCode$6 }) {
5130
+ class Capsule extends createClass({ afterConstructorCode: afterConstructorCode$6 })(capsuleProps) {
5143
5131
  constructor() {
5144
5132
  super(...arguments);
5145
5133
  this.type = ShapeType.capsule;
@@ -5284,7 +5272,7 @@ function updateShape$3(shape) {
5284
5272
  updateVolume$2(shape);
5285
5273
  updateLocalBounds$3(shape);
5286
5274
  }
5287
- const transformedShapeProps = {
5275
+ const transformedShapeProps = props({
5288
5276
  shapeType: NumberType(ShapeType.box),
5289
5277
  // we need to do "as 'shape' ..." otherwise they are just 'string' and not the actual specific keys
5290
5278
  ["shape" + ShapeType.box]: ReferenceType(Box, void 0, true),
@@ -5296,14 +5284,11 @@ const transformedShapeProps = {
5296
5284
  ["shape" + ShapeType.sphere]: ReferenceType(Sphere, void 0, true),
5297
5285
  // triangleMesh not supported
5298
5286
  transform: BasicTransform
5299
- };
5287
+ });
5300
5288
  const afterConstructorCode$5 = `
5301
5289
  this.world = null;
5302
5290
  `;
5303
- class TransformedShape extends createClass(
5304
- transformedShapeProps,
5305
- { afterConstructorCode: afterConstructorCode$5 }
5306
- ) {
5291
+ class TransformedShape extends createClass({ afterConstructorCode: afterConstructorCode$5 })(transformedShapeProps) {
5307
5292
  get shape() {
5308
5293
  return this["shape" + this.shapeType];
5309
5294
  }
@@ -5325,18 +5310,18 @@ const transformedCenterOfMass = /* @__PURE__ */ Vec3.create();
5325
5310
  const transformSubshapeToCompound = /* @__PURE__ */ Isometry.create();
5326
5311
  const subShapeDirection = /* @__PURE__ */ Vec3.create();
5327
5312
  const subShapeToWorld = /* @__PURE__ */ Isometry.create();
5328
- const compoundShapeProps = {
5313
+ const compoundShapeProps = props({
5329
5314
  computedCenterOfMass: ChildType(Vec3, {}, true),
5330
5315
  computedVolume: NumberType(0, true),
5331
5316
  computedAabb: ChildType(Aabb, {}, true),
5332
5317
  copyForDiff: LazyReferenceType((() => CompoundShape)),
5333
5318
  shapes: ReferenceListType(TransformedShape)
5334
- };
5319
+ });
5335
5320
  const afterConstructorCode$4 = `
5336
5321
  this.world = null;
5337
5322
  `;
5338
5323
  const tempTransform = /* @__PURE__ */ BasicTransform.create();
5339
- class CompoundShape extends createClass(compoundShapeProps, { afterConstructorCode: afterConstructorCode$4 }) {
5324
+ class CompoundShape extends createClass({ afterConstructorCode: afterConstructorCode$4 })(compoundShapeProps) {
5340
5325
  constructor() {
5341
5326
  super(...arguments);
5342
5327
  this.type = ShapeType.compoundShape;
@@ -5540,7 +5525,7 @@ const d = /* @__PURE__ */ Vec3.create();
5540
5525
  const scale$1 = /* @__PURE__ */ Vec3.create();
5541
5526
  const blockAabb = /* @__PURE__ */ Aabb.create();
5542
5527
  const normal$1 = /* @__PURE__ */ Vec3.create();
5543
- const heightMapProps = {
5528
+ const heightMapProps = props({
5544
5529
  computedCenterOfMass: ChildType(Vec3, void 0, true),
5545
5530
  computedVolume: NumberType(0, true),
5546
5531
  computedAabb: ChildType(Aabb, {}, true),
@@ -5553,18 +5538,18 @@ const heightMapProps = {
5553
5538
  // maxHeights: PoolReferenceType(Vec1),
5554
5539
  // levels: PoolReferenceType(Vec1),
5555
5540
  // activeEdges: PoolReferenceType(Vec1),
5556
- };
5541
+ });
5557
5542
  const afterConstructorCode$3 = `
5558
- this.world = null;
5559
- this.heights = [];
5560
- this.minHeights = [];
5561
- this.maxHeights = [];
5562
- this.levels = [];
5563
- this.activeEdges = [];
5564
- this.stack = [];
5565
- this.children = [0, 0, 0, 0];
5543
+ this.world = null;
5544
+ this.heights = [];
5545
+ this.minHeights = [];
5546
+ this.maxHeights = [];
5547
+ this.levels = [];
5548
+ this.activeEdges = [];
5549
+ this.stack = [];
5550
+ this.children = [0, 0, 0, 0];
5566
5551
  `;
5567
- class HeightMap extends createClass(heightMapProps, { afterConstructorCode: afterConstructorCode$3 }) {
5552
+ class HeightMap extends createClass({ afterConstructorCode: afterConstructorCode$3 })(heightMapProps) {
5568
5553
  constructor() {
5569
5554
  super(...arguments);
5570
5555
  this.type = ShapeType.heightMap;
@@ -5691,8 +5676,8 @@ class HeightMap extends createClass(heightMapProps, { afterConstructorCode: afte
5691
5676
  }
5692
5677
  }
5693
5678
  /**
5694
- * this function visits every block and triangle of the heightMap. take care when using it on high resolution heightMaps. it is intended to generate a debug visualization of the heightMap.
5695
- */
5679
+ * this function visits every block and triangle of the heightMap. take care when using it on high resolution heightMaps. it is intended to generate a debug visualization of the heightMap.
5680
+ */
5696
5681
  createTriangulatedVerticesAndNormalsArray() {
5697
5682
  const vertices = [];
5698
5683
  const normals = [];
@@ -5795,15 +5780,15 @@ function updateShape$1(shape) {
5795
5780
  updateVolume(shape);
5796
5781
  updateLocalBounds$1(shape);
5797
5782
  }
5798
- const bvhNodeProps = {
5783
+ const bvhNodeProps = props({
5799
5784
  parent: LazyReferenceType((() => TriangleMeshBvhNode)),
5800
5785
  left: LazyReferenceType((() => TriangleMeshBvhNode)),
5801
5786
  right: LazyReferenceType((() => TriangleMeshBvhNode)),
5802
5787
  computedBounds: ChildType(Aabb, void 0, true),
5803
5788
  depth: NumberType(0, true),
5804
5789
  objects: LazyReferenceListType((() => Triangle$1))
5805
- };
5806
- class TriangleMeshBvhNode extends createClass(bvhNodeProps) {
5790
+ });
5791
+ class TriangleMeshBvhNode extends createClass()(bvhNodeProps) {
5807
5792
  /**
5808
5793
  * if bvh node is an internal node, this will be an empty list
5809
5794
  * if bvh node is a leaf node, this will contain refs to the objects in the leaf
@@ -5858,12 +5843,10 @@ function splitObjects(objects) {
5858
5843
  const rightObjects = objects.slice(mid);
5859
5844
  return [leftObjects, rightObjects];
5860
5845
  }
5861
- const triangleMeshBvhTreeProps = {
5846
+ const triangleMeshBvhTreeProps = props({
5862
5847
  nodes: ReferenceListType(TriangleMeshBvhNode)
5863
- };
5864
- class TriangleMeshBvhTree extends createClass(
5865
- triangleMeshBvhTreeProps
5866
- ) {
5848
+ });
5849
+ class TriangleMeshBvhTree extends createClass()(triangleMeshBvhTreeProps) {
5867
5850
  constructor() {
5868
5851
  super(...arguments);
5869
5852
  this.intersectStack = [];
@@ -6058,7 +6041,7 @@ const halfExtents$1 = /* @__PURE__ */ Vec3.create();
6058
6041
  const nodeBounds = /* @__PURE__ */ Aabb.create();
6059
6042
  const bodyBounds = /* @__PURE__ */ Aabb.create();
6060
6043
  const isometry$2 = /* @__PURE__ */ Isometry.create();
6061
- const triangleMeshProps = {
6044
+ const triangleMeshProps = props({
6062
6045
  computedCenterOfMass: ChildType(Vec3, void 0, true),
6063
6046
  computedVolume: NumberType(0, true),
6064
6047
  computedAabb: ChildType(Aabb, void 0, true),
@@ -6069,11 +6052,11 @@ const triangleMeshProps = {
6069
6052
  triangles: ReferenceListType(Triangle$1),
6070
6053
  copyForDiff: LazyReferenceType((() => TriangleMesh)),
6071
6054
  bvh: LazyReferenceType((() => TriangleMeshBvhTree))
6072
- };
6055
+ });
6073
6056
  const afterConstructorCode$2 = `
6074
6057
  this.world = null;
6075
6058
  `;
6076
- class TriangleMesh extends createClass(triangleMeshProps, { afterConstructorCode: afterConstructorCode$2 }) {
6059
+ class TriangleMesh extends createClass({ afterConstructorCode: afterConstructorCode$2 })(triangleMeshProps) {
6077
6060
  constructor() {
6078
6061
  super(...arguments);
6079
6062
  this.type = ShapeType.triangleMesh;
@@ -6161,7 +6144,7 @@ function updateShape(shape) {
6161
6144
  updateCopyForDiff(shape);
6162
6145
  updateLocalBounds(shape);
6163
6146
  }
6164
- const constraintOptionsProps = {
6147
+ const constraintOptionsProps = props({
6165
6148
  /**
6166
6149
  * Value used to scale the amount of position error to correct per solve iteration. Expected to be in the interval [0, 1]
6167
6150
  */
@@ -6174,12 +6157,10 @@ const constraintOptionsProps = {
6174
6157
  * Value used to scale the strength of the constraint. recommend to tune in the interval of [0, 1], with 0 being no correction, 1 being full correction
6175
6158
  */
6176
6159
  strength: 1
6177
- };
6178
- class ConstraintOptions extends createClass(
6179
- constraintOptionsProps
6180
- ) {
6160
+ });
6161
+ class ConstraintOptions extends createClass()(constraintOptionsProps) {
6181
6162
  }
6182
- const pointConstraintComponentProps = {
6163
+ const pointConstraintComponentProps = props({
6183
6164
  bodyA: LazyReferenceType((() => Body)),
6184
6165
  bodyB: LazyReferenceType((() => Body)),
6185
6166
  options: ChildType(ConstraintOptions, {
@@ -6193,8 +6174,8 @@ const pointConstraintComponentProps = {
6193
6174
  effectiveInverseInertiaA: ChildType(Mat3, void 0, true),
6194
6175
  effectiveInverseInertiaB: ChildType(Mat3, void 0, true),
6195
6176
  totalLambda: ChildType(Vec3, void 0, true)
6196
- };
6197
- class PointConstraintComponent extends createClass(pointConstraintComponentProps) {
6177
+ });
6178
+ class PointConstraintComponent extends createClass()(pointConstraintComponentProps) {
6198
6179
  deactivate() {
6199
6180
  this.effectiveMass.zero();
6200
6181
  this.totalLambda.zero();
@@ -6303,15 +6284,15 @@ const lambda$2 = /* @__PURE__ */ Vec3.create();
6303
6284
  const transformWorldToLocalA$2 = /* @__PURE__ */ Isometry.create();
6304
6285
  const transformWorldToLocalB$2 = /* @__PURE__ */ Isometry.create();
6305
6286
  const transformLocalToWorld$3 = /* @__PURE__ */ Mat4.create();
6306
- const pointConstraintProps = {
6287
+ const pointConstraintProps = props({
6307
6288
  ...baseConstraintProps,
6308
6289
  positionA: Vec3,
6309
6290
  positionB: Vec3,
6310
6291
  localPositionA: ChildType(Vec3, void 0, true),
6311
6292
  localPositionB: ChildType(Vec3, void 0, true),
6312
6293
  translationComponent: PointConstraintComponent
6313
- };
6314
- class PointConstraint extends createClass(pointConstraintProps) {
6294
+ });
6295
+ class PointConstraint extends createClass()(pointConstraintProps) {
6315
6296
  constructor() {
6316
6297
  super(...arguments);
6317
6298
  this.type = ConstraintType.pointConstraint;
@@ -6380,7 +6361,7 @@ PointConstraint.create = function() {
6380
6361
  constraint.world.sleepModule.wakeBodyUp(constraint.bodyB);
6381
6362
  return constraint;
6382
6363
  };
6383
- const rotationEulerComponentProps = {
6364
+ const rotationEulerComponentProps = props({
6384
6365
  bodyA: LazyReferenceType((() => Body)),
6385
6366
  bodyB: LazyReferenceType((() => Body)),
6386
6367
  options: ChildType(ConstraintOptions, {
@@ -6392,10 +6373,8 @@ const rotationEulerComponentProps = {
6392
6373
  mInvI2: ChildType(Mat3, void 0, true),
6393
6374
  effectiveMassRotationComponent: ChildType(Mat3, void 0, true),
6394
6375
  totalLambdaRotationComponent: ChildType(Vec3, void 0, true)
6395
- };
6396
- class RotationEulerComponent extends createClass(
6397
- rotationEulerComponentProps
6398
- ) {
6376
+ });
6377
+ class RotationEulerComponent extends createClass()(rotationEulerComponentProps) {
6399
6378
  deactivate() {
6400
6379
  this.effectiveMassRotationComponent.zero();
6401
6380
  this.totalLambdaRotationComponent.zero();
@@ -6487,7 +6466,7 @@ const anchor = /* @__PURE__ */ Vec3.create();
6487
6466
  const transformWorldToLocalA$1 = /* @__PURE__ */ Mat4.create();
6488
6467
  const transformWorldToLocalB$1 = /* @__PURE__ */ Mat4.create();
6489
6468
  const inverseRotationB = /* @__PURE__ */ Quat.create();
6490
- const fixedConstraintProps = {
6469
+ const fixedConstraintProps = props({
6491
6470
  ...baseConstraintProps,
6492
6471
  positionA: ChildType(Vec3),
6493
6472
  positionB: ChildType(Vec3),
@@ -6506,8 +6485,8 @@ const fixedConstraintProps = {
6506
6485
  inverseInitialRotationAToB: ChildType(Quat, void 0, true),
6507
6486
  translationComponent: PointConstraintComponent,
6508
6487
  rotationComponent: RotationEulerComponent
6509
- };
6510
- class FixedConstraint extends createClass(fixedConstraintProps) {
6488
+ });
6489
+ class FixedConstraint extends createClass()(fixedConstraintProps) {
6511
6490
  constructor() {
6512
6491
  super(...arguments);
6513
6492
  this.type = ConstraintType.fixedConstraint;
@@ -6640,7 +6619,7 @@ var SpringMode = /* @__PURE__ */ ((SpringMode2) => {
6640
6619
  SpringMode2[SpringMode2["UseStiffness"] = 1] = "UseStiffness";
6641
6620
  return SpringMode2;
6642
6621
  })(SpringMode || {});
6643
- const springProps = {
6622
+ const springProps = props({
6644
6623
  mode: NumberType(
6645
6624
  0
6646
6625
  /* UseFrequency */
@@ -6648,8 +6627,8 @@ const springProps = {
6648
6627
  damping: 0,
6649
6628
  frequency: 0,
6650
6629
  stiffness: 0
6651
- };
6652
- class Spring extends createClass(springProps) {
6630
+ });
6631
+ class Spring extends createClass()(springProps) {
6653
6632
  hasStiffness() {
6654
6633
  return this.frequency > 0;
6655
6634
  }
@@ -6657,11 +6636,11 @@ class Spring extends createClass(springProps) {
6657
6636
  return this.frequency >= 0 && this.damping >= 0 && this.stiffness >= 0;
6658
6637
  }
6659
6638
  }
6660
- const springComponentProps = {
6639
+ const springComponentProps = props({
6661
6640
  bias: 0,
6662
6641
  softness: 0
6663
- };
6664
- class SpringComponent extends createClass(springComponentProps) {
6642
+ });
6643
+ class SpringComponent extends createClass()(springComponentProps) {
6665
6644
  getBias(lambda2) {
6666
6645
  return this.softness * lambda2 + this.bias;
6667
6646
  }
@@ -6703,7 +6682,7 @@ const inverseInertiaA$1 = /* @__PURE__ */ Mat3.create();
6703
6682
  const inverseInertiaB$1 = /* @__PURE__ */ Mat3.create();
6704
6683
  const linearImpulse = /* @__PURE__ */ Vec3.create();
6705
6684
  const angularImpulse = /* @__PURE__ */ Vec3.create();
6706
- const axisComponentProps = {
6685
+ const axisComponentProps = props({
6707
6686
  bodyA: LazyReferenceType((() => Body)),
6708
6687
  bodyB: LazyReferenceType((() => Body)),
6709
6688
  options: ChildType(ConstraintOptions, {
@@ -6718,8 +6697,8 @@ const axisComponentProps = {
6718
6697
  effectiveMass: 0,
6719
6698
  totalLambda: 0,
6720
6699
  springComponent: SpringComponent
6721
- };
6722
- class AxisComponent extends createClass(axisComponentProps) {
6700
+ });
6701
+ class AxisComponent extends createClass()(axisComponentProps) {
6723
6702
  deactivate() {
6724
6703
  this.effectiveMass = 0;
6725
6704
  this.totalLambda = 0;
@@ -6874,7 +6853,7 @@ const localToWorldTransformB = /* @__PURE__ */ Mat4.create();
6874
6853
  const armA = /* @__PURE__ */ Vec3.create();
6875
6854
  const armB = /* @__PURE__ */ Vec3.create();
6876
6855
  const vectorAB$5 = /* @__PURE__ */ Vec3.create();
6877
- const distanceConstraintProps = {
6856
+ const distanceConstraintProps = props({
6878
6857
  ...baseConstraintProps,
6879
6858
  positionA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6880
6859
  positionB: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
@@ -6889,8 +6868,8 @@ const distanceConstraintProps = {
6889
6868
  worldNormal: ChildType(Vec3, void 0, true),
6890
6869
  minLambda: NumberType(0, true),
6891
6870
  maxLambda: NumberType(0, true)
6892
- };
6893
- class DistanceConstraint extends createClass(distanceConstraintProps) {
6871
+ });
6872
+ class DistanceConstraint extends createClass()(distanceConstraintProps) {
6894
6873
  constructor() {
6895
6874
  super(...arguments);
6896
6875
  this.type = ConstraintType.distanceConstraint;
@@ -7037,7 +7016,7 @@ var MotorMode = /* @__PURE__ */ ((MotorMode2) => {
7037
7016
  MotorMode2[MotorMode2["Velocity"] = 2] = "Velocity";
7038
7017
  return MotorMode2;
7039
7018
  })(MotorMode || {});
7040
- const motorProps = {
7019
+ const motorProps = props({
7041
7020
  spring: ChildType(Spring, { mode: SpringMode.UseFrequency, damping: 1, frequency: 2, stiffness: 2 }),
7042
7021
  minForce: NumberType(-Infinity),
7043
7022
  maxForce: NumberType(Infinity),
@@ -7047,8 +7026,8 @@ const motorProps = {
7047
7026
  0
7048
7027
  /* Off */
7049
7028
  )
7050
- };
7051
- class Motor extends createClass(motorProps) {
7029
+ });
7030
+ class Motor extends createClass()(motorProps) {
7052
7031
  isValid() {
7053
7032
  return this.spring.isValid() && this.minForce <= this.maxForce && this.minTorque <= this.maxTorque;
7054
7033
  }
@@ -7060,7 +7039,7 @@ const perpendicular$1 = /* @__PURE__ */ Vec3.create();
7060
7039
  const summedInverseInertia = /* @__PURE__ */ Mat3.create();
7061
7040
  const massBA = /* @__PURE__ */ Vec3.create();
7062
7041
  const massCA = /* @__PURE__ */ Vec3.create();
7063
- const hingeComponentProps = {
7042
+ const hingeComponentProps = props({
7064
7043
  bodyA: LazyReferenceType((() => Body)),
7065
7044
  bodyB: LazyReferenceType((() => Body)),
7066
7045
  options: ChildType(ConstraintOptions, {
@@ -7081,7 +7060,7 @@ const hingeComponentProps = {
7081
7060
  inverseInertiaB: ChildType(Mat3, void 0, true),
7082
7061
  totalLambdaA: NumberType(0, true),
7083
7062
  totalLambdaB: NumberType(0, true)
7084
- };
7063
+ });
7085
7064
  function getOrthogonalVector(out, a3) {
7086
7065
  if (Math.abs(a3.x) > Math.abs(a3.y)) {
7087
7066
  out.fromArray([a3.z, 0, -a3.x]);
@@ -7089,7 +7068,7 @@ function getOrthogonalVector(out, a3) {
7089
7068
  out.fromArray([0, a3.z, -a3.y]);
7090
7069
  }
7091
7070
  }
7092
- class HingeComponent extends createClass(hingeComponentProps) {
7071
+ class HingeComponent extends createClass()(hingeComponentProps) {
7093
7072
  deactivate() {
7094
7073
  this.effectiveMass00 = 0;
7095
7074
  this.effectiveMass01 = 0;
@@ -7207,7 +7186,7 @@ class HingeComponent extends createClass(hingeComponentProps) {
7207
7186
  const spinBA = /* @__PURE__ */ Vec3.create();
7208
7187
  const deltaSpin$1 = /* @__PURE__ */ Vec3.create();
7209
7188
  const inverseEffectiveMass = /* @__PURE__ */ Vec3.create();
7210
- const angleComponentProps = {
7189
+ const angleComponentProps = props({
7211
7190
  bodyA: LazyReferenceType((() => Body)),
7212
7191
  bodyB: LazyReferenceType((() => Body)),
7213
7192
  options: ChildType(ConstraintOptions, {
@@ -7220,8 +7199,8 @@ const angleComponentProps = {
7220
7199
  effectiveInverseInertiaA: ChildType(Vec3, void 0, true),
7221
7200
  effectiveInverseInertiaB: ChildType(Vec3, void 0, true),
7222
7201
  totalLambda: NumberType(0, true)
7223
- };
7224
- class AngleComponent extends createClass(angleComponentProps) {
7202
+ });
7203
+ class AngleComponent extends createClass()(angleComponentProps) {
7225
7204
  deactivate() {
7226
7205
  this.effectiveMass = 0;
7227
7206
  this.totalLambda = 0;
@@ -7374,7 +7353,7 @@ const rotateLocalToWorldB = /* @__PURE__ */ Mat3.create();
7374
7353
  const worldHingeA = /* @__PURE__ */ Vec3.create();
7375
7354
  const worldHingeB = /* @__PURE__ */ Vec3.create();
7376
7355
  const transformLocalToWorld = /* @__PURE__ */ Mat4.create();
7377
- const hingeConstraintProps = {
7356
+ const hingeConstraintProps = props({
7378
7357
  ...baseConstraintProps,
7379
7358
  // init data
7380
7359
  pointA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
@@ -7406,8 +7385,8 @@ const hingeConstraintProps = {
7406
7385
  rotationConstraintPart: HingeComponent,
7407
7386
  rotationLimitsConstraintPart: AngleComponent,
7408
7387
  motorConstraintPart: AngleComponent
7409
- };
7410
- class HingeConstraint extends createClass(hingeConstraintProps) {
7388
+ });
7389
+ class HingeConstraint extends createClass()(hingeConstraintProps) {
7411
7390
  constructor() {
7412
7391
  super(...arguments);
7413
7392
  this.type = ConstraintType.hingeConstraint;
@@ -7710,7 +7689,7 @@ HingeConstraint.create = function() {
7710
7689
  constraint.world.sleepModule.wakeBodyUp(constraint.bodyB);
7711
7690
  return constraint;
7712
7691
  };
7713
- const constraintPairNodeProps = {
7692
+ const constraintPairNodeProps = props({
7714
7693
  bodyA: LazyReferenceType((() => Body)),
7715
7694
  bodyB: LazyReferenceType((() => Body)),
7716
7695
  edgeA: LazyReferenceType((() => ConstraintPairEdge)),
@@ -7720,14 +7699,13 @@ const constraintPairNodeProps = {
7720
7699
  constraintFixed: LazyReferenceType((() => FixedConstraint)),
7721
7700
  constraintDistance: LazyReferenceType((() => DistanceConstraint)),
7722
7701
  constraintHinge: LazyReferenceType((() => HingeConstraint))
7723
- };
7702
+ });
7724
7703
  const afterConstructorCode$1 = `
7725
7704
  this.world = null;
7726
7705
  this.constraints = [null, null, null, null];
7727
7706
  `;
7728
- class ConstraintPairNode extends createClass(
7729
- constraintPairNodeProps,
7730
- { afterConstructorCode: afterConstructorCode$1 }
7707
+ class ConstraintPairNode extends createClass({ afterConstructorCode: afterConstructorCode$1 })(
7708
+ constraintPairNodeProps
7731
7709
  ) {
7732
7710
  containsStaticBody() {
7733
7711
  return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
@@ -7745,14 +7723,12 @@ class ConstraintPairNode extends createClass(
7745
7723
  this.constraintType = value.type;
7746
7724
  }
7747
7725
  }
7748
- const constraintPairEdgeProps = {
7726
+ const constraintPairEdgeProps = props({
7749
7727
  node: LazyReferenceType((() => ConstraintPairNode)),
7750
7728
  next: LazyReferenceType((() => ConstraintPairEdge)),
7751
7729
  prev: LazyReferenceType((() => ConstraintPairEdge))
7752
- };
7753
- class ConstraintPairEdge extends createClass(
7754
- constraintPairEdgeProps
7755
- ) {
7730
+ });
7731
+ class ConstraintPairEdge extends createClass()(constraintPairEdgeProps) {
7756
7732
  }
7757
7733
  class ConstraintPairsModule {
7758
7734
  constructor(constraintPairNodePool, constraintPairEdgePool) {
@@ -7993,7 +7969,7 @@ var ColliderType = /* @__PURE__ */ ((ColliderType2) => {
7993
7969
  ColliderType2[ColliderType2["attractor"] = 3] = "attractor";
7994
7970
  return ColliderType2;
7995
7971
  })(ColliderType || {});
7996
- const bodyProps = {
7972
+ const bodyProps = props({
7997
7973
  type: NumberType(
7998
7974
  0
7999
7975
  /* dynamic */
@@ -8043,15 +8019,13 @@ const bodyProps = {
8043
8019
  isSleepingEnabled: BooleanType(true),
8044
8020
  linearDamping: -1,
8045
8021
  angularDamping: -1,
8046
- firstPotentialConstraintPairEdge: LazyReferenceType(
8047
- (() => ConstraintPairEdge)
8048
- ),
8022
+ firstPotentialConstraintPairEdge: LazyReferenceType((() => ConstraintPairEdge)),
8049
8023
  visitGeneration: NumberType(0, true)
8050
- };
8024
+ });
8051
8025
  const afterConstructorCode = `
8052
8026
  this.world = null;
8053
8027
  `;
8054
- class Body extends createClass(bodyProps, { afterConstructorCode }) {
8028
+ class Body extends createClass({ afterConstructorCode })(bodyProps) {
8055
8029
  get shape() {
8056
8030
  return this["shape" + this.shapeType];
8057
8031
  }
@@ -8406,7 +8380,7 @@ function updateBody(body2, updateBroadphase = true) {
8406
8380
  body2.markBodyAsDirty();
8407
8381
  }
8408
8382
  }
8409
- const castResultProps = {
8383
+ const castResultProps = props({
8410
8384
  status: NumberType(
8411
8385
  2
8412
8386
  /* Indeterminate */
@@ -8430,8 +8404,8 @@ const castResultProps = {
8430
8404
  faceB: Face,
8431
8405
  fraction: 0,
8432
8406
  isBackFaceHit: BooleanType(false)
8433
- };
8434
- class CastResult extends createClass(castResultProps) {
8407
+ });
8408
+ class CastResult extends createClass()(castResultProps) {
8435
8409
  /**
8436
8410
  * swaps the A and B data
8437
8411
  */
@@ -8507,21 +8481,21 @@ function computeBarycentricCoordinates2d(outBarycentric, a3, b3, squaredToleranc
8507
8481
  }
8508
8482
  outBarycentric.isValid = true;
8509
8483
  }
8510
- const closestPointResultProps = {
8484
+ const closestPointResultProps = props({
8511
8485
  point: Vec3,
8512
8486
  pointSet: 0
8513
- };
8514
- class ClosestPointResult extends createClass(
8515
- closestPointResultProps
8516
- ) {
8487
+ });
8488
+ class ClosestPointResult extends createClass()(closestPointResultProps) {
8517
8489
  }
8518
- const barycentricCoordinatesResultProps = {
8490
+ const barycentricCoordinatesResultProps = props({
8519
8491
  u: 0,
8520
8492
  v: 0,
8521
8493
  w: 0,
8522
8494
  isValid: BooleanType(false)
8523
- };
8524
- class BarycentricCoordinatesResult extends createClass(barycentricCoordinatesResultProps) {
8495
+ });
8496
+ class BarycentricCoordinatesResult extends createClass()(
8497
+ barycentricCoordinatesResultProps
8498
+ ) {
8525
8499
  }
8526
8500
  const ab$3 = /* @__PURE__ */ Vec3.create();
8527
8501
  const ac$2 = /* @__PURE__ */ Vec3.create();
@@ -8732,13 +8706,13 @@ function computeClosestPointOnTriangle(outClosestPoint, inA, inB, inC, mustInclu
8732
8706
  tempVector$2.addVectors(tempVector$2, c);
8733
8707
  outClosestPoint.point.scaleVector(n$1, tempVector$2.dot(n$1) / (3 * normalLengthSquared));
8734
8708
  }
8735
- const vec4Props = {
8709
+ const vec4Props = props({
8736
8710
  x: 0,
8737
8711
  y: 0,
8738
8712
  z: 0,
8739
8713
  w: 0
8740
- };
8741
- class Vec4 extends createClass(vec4Props) {
8714
+ });
8715
+ class Vec4 extends createClass()(vec4Props) {
8742
8716
  }
8743
8717
  const ab$1 = /* @__PURE__ */ Vec3.create();
8744
8718
  const ac = /* @__PURE__ */ Vec3.create();
@@ -8840,32 +8814,30 @@ function computeClosestPointOnTetrahedron(result2, inA, inB, inC, inD, mustInclu
8840
8814
  }
8841
8815
  }
8842
8816
  }
8843
- const closestPointToSimplexProps = {
8817
+ const closestPointToSimplexProps = props({
8844
8818
  point: Vec3,
8845
8819
  squaredDistance: 0,
8846
8820
  pointSet: 0,
8847
8821
  closestPointFound: BooleanType(false)
8848
- };
8849
- class ClosestPointToSimplex extends createClass(
8850
- closestPointToSimplexProps
8851
- ) {
8822
+ });
8823
+ class ClosestPointToSimplex extends createClass()(closestPointToSimplexProps) {
8852
8824
  }
8853
- const gjkClosestPointsProps = {
8825
+ const gjkClosestPointsProps = props({
8854
8826
  squaredDistance: 0,
8855
8827
  penetrationAxis: Vec3,
8856
8828
  pointA: Vec3,
8857
8829
  pointB: Vec3
8858
- };
8859
- class GjkClosestPoints extends createClass(gjkClosestPointsProps) {
8830
+ });
8831
+ class GjkClosestPoints extends createClass()(gjkClosestPointsProps) {
8860
8832
  }
8861
- const gjkCastShapeResultProps = {
8833
+ const gjkCastShapeResultProps = props({
8862
8834
  isHitFound: false,
8863
8835
  lambda: 1,
8864
8836
  separatingAxis: Vec3,
8865
8837
  pointA: Vec3,
8866
8838
  pointB: Vec3
8867
- };
8868
- class GjkCastShapeResult extends createClass(gjkCastShapeResultProps) {
8839
+ });
8840
+ class GjkCastShapeResult extends createClass()(gjkCastShapeResultProps) {
8869
8841
  }
8870
8842
  const transformedConvexObject = /* @__PURE__ */ new TransformedConvexObject();
8871
8843
  const y0 = /* @__PURE__ */ Vec3.create();
@@ -9354,7 +9326,7 @@ var CollisionStatus = /* @__PURE__ */ ((CollisionStatus2) => {
9354
9326
  CollisionStatus2[CollisionStatus2["Indeterminate"] = 2] = "Indeterminate";
9355
9327
  return CollisionStatus2;
9356
9328
  })(CollisionStatus || {});
9357
- const collisionResultProps = {
9329
+ const collisionResultProps = props({
9358
9330
  status: NumberType(
9359
9331
  2
9360
9332
  /* Indeterminate */
@@ -9376,8 +9348,8 @@ const collisionResultProps = {
9376
9348
  isBackFace: BooleanType(false),
9377
9349
  faceA: Face,
9378
9350
  faceB: Face
9379
- };
9380
- class CollisionResult extends createClass(collisionResultProps) {
9351
+ });
9352
+ class CollisionResult extends createClass()(collisionResultProps) {
9381
9353
  /**
9382
9354
  * swaps the A and B data
9383
9355
  */
@@ -9436,15 +9408,15 @@ var BackFaceMode = /* @__PURE__ */ ((BackFaceMode2) => {
9436
9408
  BackFaceMode2[BackFaceMode2["CollideWithBackFaces"] = 1] = "CollideWithBackFaces";
9437
9409
  return BackFaceMode2;
9438
9410
  })(BackFaceMode || {});
9439
- const edgeProps = {
9411
+ const edgeProps = props({
9440
9412
  neighbourTriangle: LazyReferenceType((() => Triangle2)),
9441
9413
  neighbourEdge: 0,
9442
9414
  startIndex: 0
9443
- };
9444
- class Edge extends createClass(edgeProps) {
9415
+ });
9416
+ class Edge extends createClass()(edgeProps) {
9445
9417
  //
9446
9418
  }
9447
- const triangleProps = {
9419
+ const triangleProps = props({
9448
9420
  edge0: Edge,
9449
9421
  edge1: Edge,
9450
9422
  edge2: Edge,
@@ -9458,7 +9430,7 @@ const triangleProps = {
9458
9430
  removed: BooleanType(false),
9459
9431
  inQueue: BooleanType(false),
9460
9432
  iteration: 0
9461
- };
9433
+ });
9462
9434
  const vectorAB$4 = /* @__PURE__ */ Vec3.create();
9463
9435
  const y10 = /* @__PURE__ */ Vec3.create();
9464
9436
  const y20 = /* @__PURE__ */ Vec3.create();
@@ -9537,7 +9509,7 @@ function initTriangle(m, inIdx0, inIdx1, inIdx2, inPositions, minTriangleArea, b
9537
9509
  }
9538
9510
  }
9539
9511
  }
9540
- class Triangle2 extends createClass(triangleProps) {
9512
+ class Triangle2 extends createClass()(triangleProps) {
9541
9513
  isFacing(inPosition) {
9542
9514
  vectorAB$4.subtractVectors(inPosition, this.centroid);
9543
9515
  return this.normal.dot(vectorAB$4) > 0;
@@ -10047,15 +10019,13 @@ const p10 = /* @__PURE__ */ Vec3.create();
10047
10019
  const p12 = /* @__PURE__ */ Vec3.create();
10048
10020
  const q10 = /* @__PURE__ */ Vec3.create();
10049
10021
  const q12 = /* @__PURE__ */ Vec3.create();
10050
- const penetrationDepthProps = {
10022
+ const penetrationDepthProps = props({
10051
10023
  status: 0,
10052
10024
  penetrationAxis: Vec3,
10053
10025
  pointA: Vec3,
10054
10026
  pointB: Vec3
10055
- };
10056
- class PenetrationDepth extends createClass(
10057
- penetrationDepthProps
10058
- ) {
10027
+ });
10028
+ class PenetrationDepth extends createClass()(penetrationDepthProps) {
10059
10029
  }
10060
10030
  const transformed_a = /* @__PURE__ */ new TransformedConvexObject();
10061
10031
  const closest = /* @__PURE__ */ GjkClosestPoints.create();
@@ -11320,13 +11290,15 @@ class CollideShapesModule {
11320
11290
  );
11321
11291
  }
11322
11292
  }
11323
- const estimateCollisionResponseResultProps = {
11293
+ const estimateCollisionResponseResultProps = props({
11324
11294
  deltaLinearVelocityA: Vec3,
11325
11295
  deltaAngularVelocityA: Vec3,
11326
11296
  deltaLinearVelocityB: Vec3,
11327
11297
  deltaAngularVelocityB: Vec3
11328
- };
11329
- class EstimateCollisionResponseResult extends createClass(estimateCollisionResponseResultProps) {
11298
+ });
11299
+ class EstimateCollisionResponseResult extends createClass()(
11300
+ estimateCollisionResponseResultProps
11301
+ ) {
11330
11302
  }
11331
11303
  function estimateCollisionResponse(result2, manifold, timeStepSizeSeconds) {
11332
11304
  result2.reset();
@@ -11993,11 +11965,11 @@ class ManifoldCache {
11993
11965
  const contactPairCacheMaxDeltaPositionSquared = squared(1e-3);
11994
11966
  const contactPairCacheCosMaxDeltaRotationDiv2 = Math.cos(degreesToRadians(2) / 2);
11995
11967
  const negatedPenetrationAxis = /* @__PURE__ */ Vec3.create();
11996
- const vec3BufferProps = {
11968
+ const vec3BufferProps = props({
11997
11969
  numItems: 0,
11998
11970
  vec3List: ReferenceListType(Vec3)
11999
- };
12000
- class Vec3Buffer extends createClass(vec3BufferProps) {
11971
+ });
11972
+ class Vec3Buffer extends createClass()(vec3BufferProps) {
12001
11973
  getVec3(out, index) {
12002
11974
  out.copy(this.vec3List.getAtIndex(index));
12003
11975
  }
@@ -12500,10 +12472,10 @@ class BvhModule {
12500
12472
  startOffset = this.world.pools.bvhNodes.toArray(array, startOffset);
12501
12473
  startOffset = this.world.pools.bodyPairNode.toArray(array, startOffset);
12502
12474
  startOffset = this.world.pools.bodyPairEdge.toArray(array, startOffset);
12503
- array[startOffset++] = this.dynamicTree.root?.index ?? -1;
12504
- array[startOffset++] = this.dynamicTree.root?.version ?? -1;
12505
- array[startOffset++] = this.staticTree.root?.index ?? -1;
12506
- array[startOffset++] = this.staticTree.root?.version ?? -1;
12475
+ array[startOffset++] = this.dynamicTree.root?.poolIndex ?? -1;
12476
+ array[startOffset++] = this.dynamicTree.root?.poolVersion ?? -1;
12477
+ array[startOffset++] = this.staticTree.root?.poolIndex ?? -1;
12478
+ array[startOffset++] = this.staticTree.root?.poolVersion ?? -1;
12507
12479
  return startOffset;
12508
12480
  }
12509
12481
  fromArray(array, startOffset) {
@@ -12531,21 +12503,21 @@ class BvhModule {
12531
12503
  edgeA: this.world.pools.bodyPairEdge,
12532
12504
  edgeB: this.world.pools.bodyPairEdge
12533
12505
  }, startOffsetBodyPairNode);
12534
- const dynamicTreeRootIndex = array[startOffset++];
12535
- const dynamicTreeRootVersion = array[startOffset++];
12536
- const staticTreeRootIndex = array[startOffset++];
12537
- const staticTreeRootVersion = array[startOffset++];
12538
- if (dynamicTreeRootIndex >= 0) {
12539
- this.dynamicTree.root = this.world.pools.bvhNodes.array[dynamicTreeRootIndex];
12540
- if (dynamicTreeRootVersion !== this.dynamicTree.root.version) {
12506
+ const dynamicTreeRootPoolIndex = array[startOffset++];
12507
+ const dynamicTreeRootPoolVersion = array[startOffset++];
12508
+ const staticTreeRootPoolIndex = array[startOffset++];
12509
+ const staticTreeRootPoolVersion = array[startOffset++];
12510
+ if (dynamicTreeRootPoolIndex >= 0) {
12511
+ this.dynamicTree.root = this.world.pools.bvhNodes.array[dynamicTreeRootPoolIndex];
12512
+ if (dynamicTreeRootPoolVersion !== this.dynamicTree.root.poolVersion) {
12541
12513
  this.dynamicTree.root = null;
12542
12514
  }
12543
12515
  } else {
12544
12516
  this.dynamicTree.root = null;
12545
12517
  }
12546
- if (staticTreeRootIndex >= 0) {
12547
- this.staticTree.root = this.world.pools.bvhNodes.array[staticTreeRootIndex];
12548
- if (staticTreeRootVersion !== this.staticTree.root.version) {
12518
+ if (staticTreeRootPoolIndex >= 0) {
12519
+ this.staticTree.root = this.world.pools.bvhNodes.array[staticTreeRootPoolIndex];
12520
+ if (staticTreeRootPoolVersion !== this.staticTree.root.poolVersion) {
12549
12521
  this.staticTree.root = null;
12550
12522
  }
12551
12523
  } else {
@@ -15273,7 +15245,7 @@ class World {
15273
15245
  if (bodyA === bodyB) {
15274
15246
  continue;
15275
15247
  }
15276
- if (bodyA.index > bodyB.index) {
15248
+ if (bodyA.poolIndex > bodyB.poolIndex) {
15277
15249
  continue;
15278
15250
  }
15279
15251
  yield [bodyA, bodyB];
@@ -15294,7 +15266,7 @@ class World {
15294
15266
  if (bodyA === bodyB) {
15295
15267
  continue;
15296
15268
  }
15297
- if (bodyA.index > bodyB.index) {
15269
+ if (bodyA.poolIndex > bodyB.poolIndex) {
15298
15270
  continue;
15299
15271
  }
15300
15272
  if (bodyA.computedBounds.intersectsAabb(bodyB.computedBounds) === false) {