@daneren2005/shared-memory-physics 1.6.0 → 1.6.2

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.js CHANGED
@@ -347,7 +347,7 @@ var De = 0, Oe = 1, ke = class extends t {
347
347
  attach(e, t, n) {
348
348
  return new ke(t.getBlock(n), n);
349
349
  }
350
- }, je = 0, Me = 1, Ne = 2, Pe = 3, Fe = 4, Ie = 5, Le = 6, Re = 7, ze = 8, Be = class extends t {
350
+ }, je = 0, Me = 1, Ne = 2, Pe = 3, Fe = 4, Ie = 5, Le = 6, Re = 7, ze = 8, Be = 9, Ve = 10, He = 11, Ue = class extends t {
351
351
  get x() {
352
352
  return this.block[0];
353
353
  }
@@ -396,9 +396,27 @@ var De = 0, Oe = 1, ke = class extends t {
396
396
  set tick(e) {
397
397
  a(this.block, 7, e);
398
398
  }
399
- }, Ve = {
399
+ get totalDuration() {
400
+ return this.block[8];
401
+ }
402
+ set totalDuration(e) {
403
+ this.block[8] = e;
404
+ }
405
+ get syncedDuration() {
406
+ return this.block[9];
407
+ }
408
+ set syncedDuration(e) {
409
+ this.block[9] = e;
410
+ }
411
+ get remainingDuration() {
412
+ return this.block[10];
413
+ }
414
+ set remainingDuration(e) {
415
+ this.block[10] = e;
416
+ }
417
+ }, We = {
400
418
  type: Float32Array,
401
- size: 8,
419
+ size: 11,
402
420
  loadProperties: ["interpolate"],
403
421
  toBlock(e) {
404
422
  let t = e.x ?? 0, n = e.y ?? 0;
@@ -410,33 +428,36 @@ var De = 0, Oe = 1, ke = class extends t {
410
428
  0,
411
429
  0,
412
430
  0,
431
+ 0,
432
+ 0,
433
+ 0,
413
434
  0
414
435
  ];
415
436
  },
416
437
  attach(e, t, n) {
417
- return new Be(t.getBlock(n), n);
438
+ return new Ue(t.getBlock(n), n);
418
439
  }
419
440
  };
420
- function He(e) {
441
+ function Ge(e) {
421
442
  let { transform: t, interpolation: n } = e.components;
422
- !t || !n || (n.prevX = n.x = t.x, n.prevY = n.y = t.y);
443
+ !t || !n || (n.prevX = n.x = t.x, n.prevY = n.y = t.y, n.remainingDuration = 0, n.syncedDuration = n.totalDuration);
423
444
  }
424
- function Ue(e, t) {
445
+ function Ke(e, t) {
425
446
  let { transform: n, velocity: r, interpolation: i } = e.components;
426
447
  if (!n || !r || !i) return;
427
448
  let a = 1 - (t.stepFraction < 0 ? 0 : t.stepFraction > 1 ? 1 : t.stepFraction), o = t.stepMs / 1e3, s = n.x, c = n.y, l = r.velocityX * o * a, u = r.velocityY * o * a;
428
- i.prevX = s, i.prevY = c, n.x = s + l, n.y = c + u, i.x = s, i.y = c, i.duration = t.stepMs * a, i.progress = 0, i.syncedTick = t.tick, i.tick = t.tick;
449
+ i.prevX = s, i.prevY = c, n.x = s + l, n.y = c + u, i.x = s, i.y = c, i.duration = t.stepMs * a, i.progress = 0, i.syncedTick = t.tick, i.totalDuration += i.duration, i.syncedDuration = i.totalDuration, i.remainingDuration = i.duration, i.tick = t.tick;
429
450
  }
430
451
  //#endregion
431
452
  //#region src/components/registry.ts
432
- var We = {
453
+ var qe = {
433
454
  transform: T,
434
455
  velocity: j,
435
456
  body: we,
436
457
  polygon: m,
437
458
  bounciness: Ae,
438
459
  dynamics: te,
439
- interpolation: Ve
460
+ interpolation: We
440
461
  }, z = {
441
462
  x: 0,
442
463
  y: 0
@@ -454,65 +475,65 @@ function U(e, t, n) {
454
475
  return e === 2 ? t <= 0 : e === 3 ? n <= 0 : t <= 0 || n <= 0;
455
476
  }
456
477
  function W(e, t, n, r) {
457
- return e === 2 ? t / 2 : e === 3 ? Math.abs(Math.cos(r)) * V(t, n) + n / 2 : $e(t, n, r);
478
+ return e === 2 ? t / 2 : e === 3 ? Math.abs(Math.cos(r)) * V(t, n) + n / 2 : nt(t, n, r);
458
479
  }
459
480
  function G(e, t, n, r) {
460
- return e === 2 ? t / 2 : e === 3 ? Math.abs(Math.sin(r)) * V(t, n) + n / 2 : et(t, n, r);
481
+ return e === 2 ? t / 2 : e === 3 ? Math.abs(Math.sin(r)) * V(t, n) + n / 2 : rt(t, n, r);
461
482
  }
462
- function Ge(e, t, n, r, i, a, o, s, c, l, u, d) {
483
+ function Je(e, t, n, r, i, a, o, s, c, l, u, d) {
463
484
  if (U(e, r, i) || U(o, l, u)) return !1;
464
485
  let f = e !== 1, p = o !== 1;
465
- if (!f && !p) return tt(t, n, r, i, a, s, c, l, u, d);
466
- if (f && !p) return Ge(o, s, c, l, u, d, e, t, n, r, i, a);
486
+ if (!f && !p) return it(t, n, r, i, a, s, c, l, u, d);
487
+ if (f && !p) return Je(o, s, c, l, u, d, e, t, n, r, i, a);
467
488
  let m = K(o, l, u), h = Math.cos(d) * m, g = Math.sin(d) * m, _ = H(o, l, u);
468
- if (!f) return rt(s - h, c - g, s + h, c + g, t, n, r, i, a) < _ * _;
489
+ if (!f) return ot(s - h, c - g, s + h, c + g, t, n, r, i, a) < _ * _;
469
490
  let v = K(e, r, i), y = Math.cos(a) * v, b = Math.sin(a) * v, x = H(e, r, i) + _;
470
- return nt(t - y, n - b, t + y, n + b, s - h, c - g, s + h, c + g) < x * x;
491
+ return at(t - y, n - b, t + y, n + b, s - h, c - g, s + h, c + g) < x * x;
471
492
  }
472
493
  function K(e, t, n) {
473
494
  return e === 3 ? V(t, n) : 0;
474
495
  }
475
- function Ke(e, t, n, r, i, a, o, s, c, l, u, d, f) {
496
+ function Ye(e, t, n, r, i, a, o, s, c, l, u, d, f) {
476
497
  let p = e !== 1, m = o !== 1;
477
- return !p && !m ? qe(t, n, r, i, a, s, c, l, u, d, f) : p && m ? Je(e, t, n, r, i, a, o, s, c, l, u, d, f) : p ? Ye(s, c, l, u, d, e, t, n, r, i, a, f) : Ye(t, n, r, i, a, o, s, c, l, u, d, f) ? (f.x = -f.x, f.y = -f.y, !0) : !1;
498
+ return !p && !m ? Xe(t, n, r, i, a, s, c, l, u, d, f) : p && m ? Ze(e, t, n, r, i, a, o, s, c, l, u, d, f) : p ? Qe(s, c, l, u, d, e, t, n, r, i, a, f) : Qe(t, n, r, i, a, o, s, c, l, u, d, f) ? (f.x = -f.x, f.y = -f.y, !0) : !1;
478
499
  }
479
- function qe(e, t, n, r, i, a, o, s, c, l, u) {
500
+ function Xe(e, t, n, r, i, a, o, s, c, l, u) {
480
501
  let d = Math.cos(i), f = Math.sin(i), p = Math.cos(l), m = Math.sin(l), h = n / 2, g = r / 2, _ = s / 2, v = c / 2, y = e - a, b = t - o, x = q(d, f, y, b, h, g, d, f, _, v, p, m);
481
502
  u.x = d, u.y = f;
482
503
  let S = q(-f, d, y, b, h, g, d, f, _, v, p, m);
483
- return S < x && (x = S, u.x = -f, u.y = d), S = q(p, m, y, b, h, g, d, f, _, v, p, m), S < x && (x = S, u.x = p, u.y = m), S = q(-m, p, y, b, h, g, d, f, _, v, p, m), S < x && (u.x = -m, u.y = p), Ze(y, b, u), !0;
504
+ return S < x && (x = S, u.x = -f, u.y = d), S = q(p, m, y, b, h, g, d, f, _, v, p, m), S < x && (x = S, u.x = p, u.y = m), S = q(-m, p, y, b, h, g, d, f, _, v, p, m), S < x && (u.x = -m, u.y = p), et(y, b, u), !0;
484
505
  }
485
- function Je(e, t, n, r, i, a, o, s, c, l, u, d, f) {
486
- let p = K(e, r, i), m = Math.cos(a) * p, h = Math.sin(a) * p, g = K(o, l, u), _ = Math.cos(d) * g, v = Math.sin(d) * g, y = Math.sqrt(nt(t - m, n - h, t + m, n + h, s - _, c - v, s + _, c + v, z));
487
- return y > 0 ? (f.x = z.x / y, f.y = z.y / y, !0) : Qe(t - s, n - c, f);
506
+ function Ze(e, t, n, r, i, a, o, s, c, l, u, d, f) {
507
+ let p = K(e, r, i), m = Math.cos(a) * p, h = Math.sin(a) * p, g = K(o, l, u), _ = Math.cos(d) * g, v = Math.sin(d) * g, y = Math.sqrt(at(t - m, n - h, t + m, n + h, s - _, c - v, s + _, c + v, z));
508
+ return y > 0 ? (f.x = z.x / y, f.y = z.y / y, !0) : tt(t - s, n - c, f);
488
509
  }
489
- function Ye(e, t, n, r, i, a, o, s, c, l, u, d) {
490
- let f = K(a, c, l), p = Math.cos(u) * f, m = Math.sin(u) * f, h = Math.sqrt(rt(o - p, s - m, o + p, s + m, e, t, n, r, i, z));
510
+ function Qe(e, t, n, r, i, a, o, s, c, l, u, d) {
511
+ let f = K(a, c, l), p = Math.cos(u) * f, m = Math.sin(u) * f, h = Math.sqrt(ot(o - p, s - m, o + p, s + m, e, t, n, r, i, z));
491
512
  if (h > 0) return d.x = z.x / h, d.y = z.y / h, !0;
492
- let g = Math.cos(i), _ = Math.sin(i), v = o - e, y = s - t, b = v * g + y * _, x = -v * _ + y * g, S = p * g + m * _, C = -p * _ + m * g, w = H(a, c, l), T = n / 2, E = r / 2, D = Xe(1, 0, b, x, S, C, w, T, E);
513
+ let g = Math.cos(i), _ = Math.sin(i), v = o - e, y = s - t, b = v * g + y * _, x = -v * _ + y * g, S = p * g + m * _, C = -p * _ + m * g, w = H(a, c, l), T = n / 2, E = r / 2, D = $e(1, 0, b, x, S, C, w, T, E);
493
514
  d.x = 1, d.y = 0;
494
- let O = Xe(0, 1, b, x, S, C, w, T, E);
495
- O < D && (D = O, d.x = 0, d.y = 1), Qe(-C, S, B) && (O = Xe(B.x, B.y, b, x, S, C, w, T, E), O < D && (d.x = B.x, d.y = B.y)), Ze(b, x, d);
515
+ let O = $e(0, 1, b, x, S, C, w, T, E);
516
+ O < D && (D = O, d.x = 0, d.y = 1), tt(-C, S, B) && (O = $e(B.x, B.y, b, x, S, C, w, T, E), O < D && (d.x = B.x, d.y = B.y)), et(b, x, d);
496
517
  let k = d.x, A = d.y;
497
518
  return d.x = k * g - A * _, d.y = k * _ + A * g, !0;
498
519
  }
499
- function Xe(e, t, n, r, i, a, o, s, c) {
520
+ function $e(e, t, n, r, i, a, o, s, c) {
500
521
  return s * Math.abs(e) + c * Math.abs(t) + (Math.abs(i * e + a * t) + o) - Math.abs(n * e + r * t);
501
522
  }
502
- function Ze(e, t, n) {
523
+ function et(e, t, n) {
503
524
  e * n.x + t * n.y < 0 && (n.x = -n.x, n.y = -n.y);
504
525
  }
505
- function Qe(e, t, n) {
526
+ function tt(e, t, n) {
506
527
  let r = Math.sqrt(e * e + t * t);
507
528
  return r === 0 ? !1 : (n.x = e / r, n.y = t / r, !0);
508
529
  }
509
- function $e(e, t, n) {
530
+ function nt(e, t, n) {
510
531
  return (Math.abs(Math.cos(n)) * e + Math.abs(Math.sin(n)) * t) / 2;
511
532
  }
512
- function et(e, t, n) {
533
+ function rt(e, t, n) {
513
534
  return (Math.abs(Math.sin(n)) * e + Math.abs(Math.cos(n)) * t) / 2;
514
535
  }
515
- function tt(e, t, n, r, i, a, o, s, c, l) {
536
+ function it(e, t, n, r, i, a, o, s, c, l) {
516
537
  if (n <= 0 || r <= 0 || s <= 0 || c <= 0) return !1;
517
538
  let u = Math.cos(i), d = Math.sin(i), f = Math.cos(l), p = Math.sin(l), m = n / 2, h = r / 2, g = s / 2, _ = c / 2, v = a - e, y = o - t;
518
539
  return q(u, d, v, y, m, h, u, d, g, _, f, p) > 0 && q(-d, u, v, y, m, h, u, d, g, _, f, p) > 0 && q(f, p, v, y, m, h, u, d, g, _, f, p) > 0 && q(-p, f, v, y, m, h, u, d, g, _, f, p) > 0;
@@ -520,7 +541,7 @@ function tt(e, t, n, r, i, a, o, s, c, l) {
520
541
  function q(e, t, n, r, i, a, o, s, c, l, u, d) {
521
542
  return i * Math.abs(o * e + s * t) + a * Math.abs(-s * e + o * t) + (c * Math.abs(u * e + d * t) + l * Math.abs(-d * e + u * t)) - Math.abs(n * e + r * t);
522
543
  }
523
- function nt(e, t, n, r, i, a, o, s, c) {
544
+ function at(e, t, n, r, i, a, o, s, c) {
524
545
  let l = n - e, u = r - t, d = o - i, f = s - a, p = e - i, m = t - a, h = l * l + u * u, g = d * d + f * f, _ = d * p + f * m, v = 0, y = 0;
525
546
  if (h <= 0 && g <= 0) return c && (c.x = p, c.y = m), p * p + m * m;
526
547
  if (h <= 0) y = Y(_ / g);
@@ -535,28 +556,28 @@ function nt(e, t, n, r, i, a, o, s, c) {
535
556
  let b = e + l * v - (i + d * y), x = t + u * v - (a + f * y);
536
557
  return c && (c.x = b, c.y = x), b * b + x * x;
537
558
  }
538
- function rt(e, t, n, r, i, a, o, s, c, l) {
559
+ function ot(e, t, n, r, i, a, o, s, c, l) {
539
560
  let u = Math.cos(c), d = Math.sin(c), f = o / 2, p = s / 2, m = e - i, h = t - a, g = n - i, _ = r - a, v = m * u + h * d, y = -m * d + h * u, b = g * u + _ * d, x = -g * d + _ * u;
540
- if (!at(v, y, b, x, f, p)) return l && (l.x = 0, l.y = 0), 0;
541
- if (!l) return Math.min(ot(v, y, f, p), ot(b, x, f, p), J(-f, -p, v, y, b, x), J(f, -p, v, y, b, x), J(f, p, v, y, b, x), J(-f, p, v, y, b, x));
542
- let S = ot(v, y, f, p, l);
543
- S = it(S, ot(b, x, f, p, B), B, l, !1), S = it(S, J(-f, -p, v, y, b, x, B), B, l, !0), S = it(S, J(f, -p, v, y, b, x, B), B, l, !0), S = it(S, J(f, p, v, y, b, x, B), B, l, !0), S = it(S, J(-f, p, v, y, b, x, B), B, l, !0);
561
+ if (!ct(v, y, b, x, f, p)) return l && (l.x = 0, l.y = 0), 0;
562
+ if (!l) return Math.min(lt(v, y, f, p), lt(b, x, f, p), J(-f, -p, v, y, b, x), J(f, -p, v, y, b, x), J(f, p, v, y, b, x), J(-f, p, v, y, b, x));
563
+ let S = lt(v, y, f, p, l);
564
+ S = st(S, lt(b, x, f, p, B), B, l, !1), S = st(S, J(-f, -p, v, y, b, x, B), B, l, !0), S = st(S, J(f, -p, v, y, b, x, B), B, l, !0), S = st(S, J(f, p, v, y, b, x, B), B, l, !0), S = st(S, J(-f, p, v, y, b, x, B), B, l, !0);
544
565
  let C = l.x, w = l.y;
545
566
  return l.x = C * u - w * d, l.y = C * d + w * u, S;
546
567
  }
547
- function it(e, t, n, r, i) {
568
+ function st(e, t, n, r, i) {
548
569
  return t >= e ? e : (r.x = i ? -n.x : n.x, r.y = i ? -n.y : n.y, t);
549
570
  }
550
571
  function J(e, t, n, r, i, a, o) {
551
572
  let s = i - n, c = a - r, l = s * s + c * c, u = l > 0 ? Y(((e - n) * s + (t - r) * c) / l) : 0, d = e - (n + s * u), f = t - (r + c * u);
552
573
  return o && (o.x = d, o.y = f), d * d + f * f;
553
574
  }
554
- function at(e, t, n, r, i, a) {
575
+ function ct(e, t, n, r, i, a) {
555
576
  if (Math.max(e, n) < -i || Math.min(e, n) > i || Math.max(t, r) < -a || Math.min(t, r) > a) return !0;
556
577
  let o = -(r - t), s = n - e;
557
578
  return Math.abs(o * e + s * t) > i * Math.abs(o) + a * Math.abs(s);
558
579
  }
559
- function ot(e, t, n, r, i) {
580
+ function lt(e, t, n, r, i) {
560
581
  let a = Math.abs(e) - n, o = Math.abs(t) - r, s = a > 0 ? a : 0, c = o > 0 ? o : 0;
561
582
  return i && (i.x = e < 0 ? -s : s, i.y = t < 0 ? -c : c), s * s + c * c;
562
583
  }
@@ -574,23 +595,23 @@ function X(e) {
574
595
  maxY: l + s
575
596
  };
576
597
  }
577
- function st(e, t, n, r, i) {
598
+ function ut(e, t, n, r, i) {
578
599
  return e.minX <= r && e.maxX >= t && e.minY <= i && e.maxY >= n;
579
600
  }
580
- function ct(e, t) {
601
+ function dt(e, t) {
581
602
  return t > e ? t - e : Math.max(1, Math.abs(e)) * 2 ** -52;
582
603
  }
583
604
  //#endregion
584
605
  //#region src/world.ts
585
- function lt(e, t) {
606
+ function ft(e, t) {
586
607
  t.spatialMapMemory = e.spatialMap.getSharedMemory();
587
608
  }
588
- function ut(e) {
609
+ function pt(e) {
589
610
  if (e.spatialMap) return e.spatialMap;
590
611
  if (!e.heap || !e.spatialMapMemory) throw Error("Spatial system world is missing its shared MemoryHeap or spatial map");
591
612
  return e.spatialMap = new o(e.heap, e.spatialMapMemory), e.spatialMap;
592
613
  }
593
- var dt = class extends e {
614
+ var mt = class extends e {
594
615
  spatialMap;
595
616
  spatialIds = /* @__PURE__ */ new Set();
596
617
  constructor(e, t = {}) {
@@ -621,12 +642,12 @@ var dt = class extends e {
621
642
  }
622
643
  searchSpatial(e, t, n, r, i) {
623
644
  if (n < e || r < t) return [];
624
- let a = [], o = Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(r) ? this.spatialMap.search(e, t, ct(e, n), ct(t, r)) : this.spatialIds;
645
+ let a = [], o = Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(r) ? this.spatialMap.search(e, t, dt(e, n), dt(t, r)) : this.spatialIds;
625
646
  for (let s of o) {
626
647
  let o = this.getEntityByEid(s);
627
648
  if (!o || i && !i(o)) continue;
628
649
  let c = o.components, l = c.transform?.block;
629
- l && st(X({
650
+ l && ut(X({
630
651
  transform: l,
631
652
  body: c.body?.block
632
653
  }), e, t, n, r) && a.push(o);
@@ -648,10 +669,10 @@ var dt = class extends e {
648
669
  return t ? [t] : [];
649
670
  });
650
671
  }
651
- }, ft = {
672
+ }, ht = {
652
673
  min: 0,
653
674
  max: 0
654
- }, pt = {
675
+ }, gt = {
655
676
  min: 0,
656
677
  max: 0
657
678
  }, Z = {
@@ -660,40 +681,40 @@ var dt = class extends e {
660
681
  x: 0,
661
682
  y: 0
662
683
  };
663
- function mt(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
664
- return gt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, !1);
684
+ function _t(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
685
+ return yt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, !1);
665
686
  }
666
- function ht(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
667
- return Z.depth = Infinity, !gt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, !0) || Z.depth === Infinity ? !1 : (m.x = Z.x, m.y = Z.y, !0);
687
+ function vt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
688
+ return Z.depth = Infinity, !yt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, !0) || Z.depth === Infinity ? !1 : (m.x = Z.x, m.y = Z.y, !0);
668
689
  }
669
- function gt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
670
- return !(e === 4 && (!t || !_t(t, n, r, i, a, o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m)) || s === 4 && (!c || !_t(c, l, u, d, f, p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m)) || e === 1 && !vt(o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || s === 1 && !vt(p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || Tt(e) && c && !yt(e, n, r, i, a, o, c, l, u, d, f, p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || Tt(s) && t && !yt(s, l, u, d, f, p, t, n, r, i, a, o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m));
690
+ function yt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
691
+ return !(e === 4 && (!t || !bt(t, n, r, i, a, o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m)) || s === 4 && (!c || !bt(c, l, u, d, f, p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m)) || e === 1 && !xt(o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || s === 1 && !xt(p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || Ot(e) && c && !St(e, n, r, i, a, o, c, l, u, d, f, p, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) || Ot(s) && t && !St(s, l, u, d, f, p, t, n, r, i, a, o, e, t, n, r, i, a, o, s, c, l, u, d, f, p, m));
671
692
  }
672
- function _t(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b) {
693
+ function bt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b) {
673
694
  let x = e[0], S = Math.cos(a), C = Math.sin(a);
674
695
  for (let a = 0; a < x; a++) {
675
- let w = (a + 1) % x, T = St(e, a, t, r, i, S, C), E = Ct(e, a, n, r, i, S, C), D = St(e, w, t, r, i, S, C);
676
- if (!bt(E - Ct(e, w, n, r, i, S, C), D - T, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b)) return !1;
696
+ let w = (a + 1) % x, T = Tt(e, a, t, r, i, S, C), E = Et(e, a, n, r, i, S, C), D = Tt(e, w, t, r, i, S, C);
697
+ if (!Ct(E - Et(e, w, n, r, i, S, C), D - T, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b)) return !1;
677
698
  }
678
699
  return !0;
679
700
  }
680
- function vt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
701
+ function xt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
681
702
  let g = Math.cos(e), _ = Math.sin(e);
682
- return bt(g, _, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) && bt(-_, g, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h);
703
+ return Ct(g, _, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) && Ct(-_, g, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h);
683
704
  }
684
- function yt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E) {
705
+ function St(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E) {
685
706
  let D = e === 3 ? V(r, i) : 0, O = Math.cos(a) * D, k = Math.sin(a) * D, A = t - O, j = n - k, M = t + O, N = n + k, ee = o[0], P = Math.cos(d), F = Math.sin(d);
686
707
  for (let e = 0; e < ee; e++) {
687
- let t = St(o, e, s, l, u, P, F), n = Ct(o, e, c, l, u, P, F), r = wt(A, j, M, N, t, n), i = A + (M - A) * r, a = j + (N - j) * r;
688
- if (!bt(t - i, n - a, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E)) return !1;
708
+ let t = Tt(o, e, s, l, u, P, F), n = Et(o, e, c, l, u, P, F), r = Dt(A, j, M, N, t, n), i = A + (M - A) * r, a = j + (N - j) * r;
709
+ if (!Ct(t - i, n - a, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E)) return !1;
689
710
  }
690
711
  return !0;
691
712
  }
692
- function bt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
713
+ function Ct(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
693
714
  let _ = Math.hypot(e, t);
694
715
  if (_ === 0) return !0;
695
- e /= _, t /= _, xt(n, r, i, a, o, s, c, e, t, ft), xt(l, u, d, f, p, m, h, e, t, pt);
696
- let v = ft.max - pt.min, y = pt.max - ft.min;
716
+ e /= _, t /= _, wt(n, r, i, a, o, s, c, e, t, ht), wt(l, u, d, f, p, m, h, e, t, gt);
717
+ let v = ht.max - gt.min, y = gt.max - ht.min;
697
718
  if (!g && (v <= 0 || y <= 0)) return !1;
698
719
  if (g) {
699
720
  let n, r;
@@ -701,7 +722,7 @@ function bt(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g) {
701
722
  }
702
723
  return !0;
703
724
  }
704
- function xt(e, t, n, r, i, a, o, s, c, l) {
725
+ function wt(e, t, n, r, i, a, o, s, c, l) {
705
726
  let u = n * s + r * c;
706
727
  if (e === 2) {
707
728
  let e = i / 2;
@@ -725,48 +746,48 @@ function xt(e, t, n, r, i, a, o, s, c, l) {
725
746
  let d = t[0], f = Math.cos(o), p = Math.sin(o);
726
747
  l.min = Infinity, l.max = -Infinity;
727
748
  for (let e = 0; e < d; e++) {
728
- let o = St(t, e, n, i, a, f, p), u = Ct(t, e, r, i, a, f, p), d = o * s + u * c;
749
+ let o = Tt(t, e, n, i, a, f, p), u = Et(t, e, r, i, a, f, p), d = o * s + u * c;
729
750
  l.min = Math.min(l.min, d), l.max = Math.max(l.max, d);
730
751
  }
731
752
  }
732
- function St(e, t, n, r, i, a, o) {
753
+ function Tt(e, t, n, r, i, a, o) {
733
754
  let s = 1 + t * 2;
734
755
  return n + e[s] * r * a - e[s + 1] * i * o;
735
756
  }
736
- function Ct(e, t, n, r, i, a, o) {
757
+ function Et(e, t, n, r, i, a, o) {
737
758
  let s = 1 + t * 2;
738
759
  return n + e[s] * r * o + e[s + 1] * i * a;
739
760
  }
740
- function wt(e, t, n, r, i, a) {
761
+ function Dt(e, t, n, r, i, a) {
741
762
  let o = n - e, s = r - t, c = o * o + s * s;
742
763
  return c === 0 ? 0 : Math.min(1, Math.max(0, ((i - e) * o + (a - t) * s) / c));
743
764
  }
744
- function Tt(e) {
765
+ function Ot(e) {
745
766
  return e === 2 || e === 3;
746
767
  }
747
- function Et(e, t, n, r, i, a) {
748
- if (Pt(n, r, "Force"), Pt(i, a, "Impulse"), n === 0 && r === 0 && i === 0 && a === 0) return;
749
- let o = e.get(t) ?? Nt(), s = {
768
+ function kt(e, t, n, r, i, a) {
769
+ if (Lt(n, r, "Force"), Lt(i, a, "Impulse"), n === 0 && r === 0 && i === 0 && a === 0) return;
770
+ let o = e.get(t) ?? It(), s = {
750
771
  ...o,
751
772
  forceX: o.forceX + n,
752
773
  forceY: o.forceY + r,
753
774
  impulseX: o.impulseX + i,
754
775
  impulseY: o.impulseY + a
755
776
  };
756
- Pt(s.forceX, s.forceY, "Accumulated force"), Pt(s.impulseX, s.impulseY, "Accumulated impulse"), e.set(t, s);
777
+ Lt(s.forceX, s.forceY, "Accumulated force"), Lt(s.impulseX, s.impulseY, "Accumulated impulse"), e.set(t, s);
757
778
  }
758
- function Dt(e, t, n) {
759
- Ft(n), !(n.velocityX === void 0 && n.velocityY === void 0) && e.set(t, {
760
- ...e.get(t) ?? Nt(),
779
+ function At(e, t, n) {
780
+ Rt(n), !(n.velocityX === void 0 && n.velocityY === void 0) && e.set(t, {
781
+ ...e.get(t) ?? It(),
761
782
  ...n
762
783
  });
763
784
  }
764
- function Ot(e, t) {
785
+ function jt(e, t) {
765
786
  if (e.size === 0) return t;
766
787
  let n = /* @__PURE__ */ new Map();
767
788
  for (let [t, r] of e) n.set(t, { ...r });
768
- return Mt(t, (e, t) => {
769
- let r = n.get(e) ?? Nt();
789
+ return Ft(t, (e, t) => {
790
+ let r = n.get(e) ?? It();
770
791
  n.set(e, {
771
792
  forceX: r.forceX + t.forceX,
772
793
  forceY: r.forceY + t.forceY,
@@ -780,13 +801,13 @@ function Ot(e, t) {
780
801
  ...t
781
802
  })).sort((e, t) => e.entityId - t.entityId);
782
803
  }
783
- function kt(e, t, n, r) {
784
- let i = e.dynamicsCommands, a = i instanceof Float64Array ? i : void 0, o = At(i && !(i instanceof Float64Array) ? i : void 0, t), s = a ? jt(a, t) : -1, c = n[2];
804
+ function Mt(e, t, n, r) {
805
+ let i = e.dynamicsCommands, a = i instanceof Float64Array ? i : void 0, o = Nt(i && !(i instanceof Float64Array) ? i : void 0, t), s = a ? Pt(a, t) : -1, c = n[2];
785
806
  if (!r && !o && s < 0 && c === 0) return;
786
807
  let l = e.elapsedTime / 1e3, u = r?.[2] ?? 1, d = s < 0 ? o?.forceX ?? 0 : a[s + 1], f = s < 0 ? o?.forceY ?? 0 : a[s + 2], p = s < 0 ? o?.impulseX ?? 0 : a[s + 3], m = s < 0 ? o?.impulseY ?? 0 : a[s + 4], h = s < 0 ? 0 : a[s + 5], g = s < 0 ? o?.velocityX : h & 1 ? a[s + 6] : void 0, _ = s < 0 ? o?.velocityY : h & 2 ? a[s + 7] : void 0, v = c > 0 ? 1 / (1 + c * l) : 1, y = (n[0] + (r?.[0] ?? 0) * l + d * u * l + p * u) * v, b = (n[1] + (r?.[1] ?? 0) * l + f * u * l + m * u) * v;
787
808
  n[0] = g ?? y, n[1] = _ ?? b;
788
809
  }
789
- function At(e, t) {
810
+ function Nt(e, t) {
790
811
  if (!e) return;
791
812
  let n = 0, r = e.length - 1;
792
813
  for (; n <= r;) {
@@ -795,7 +816,7 @@ function At(e, t) {
795
816
  a.entityId < t ? n = i + 1 : r = i - 1;
796
817
  }
797
818
  }
798
- function jt(e, t) {
819
+ function Pt(e, t) {
799
820
  let n = 0, r = e.length / 8 - 1;
800
821
  for (; n <= r;) {
801
822
  let i = n + r >>> 1, a = i * 8, o = e[a + 0];
@@ -804,7 +825,7 @@ function jt(e, t) {
804
825
  }
805
826
  return -1;
806
827
  }
807
- function Mt(e, t) {
828
+ function Ft(e, t) {
808
829
  if (e) {
809
830
  if (!(e instanceof Float64Array)) {
810
831
  for (let { entityId: n, ...r } of e) t(n, r);
@@ -823,7 +844,7 @@ function Mt(e, t) {
823
844
  }
824
845
  }
825
846
  }
826
- function Nt() {
847
+ function It() {
827
848
  return {
828
849
  forceX: 0,
829
850
  forceY: 0,
@@ -831,18 +852,18 @@ function Nt() {
831
852
  impulseY: 0
832
853
  };
833
854
  }
834
- function Pt(e, t, n) {
855
+ function Lt(e, t, n) {
835
856
  if (!Number.isFinite(e) || !Number.isFinite(t)) throw Error(`${n} must contain finite numbers`);
836
857
  }
837
- function Ft(e) {
858
+ function Rt(e) {
838
859
  if (e.velocityX !== void 0 && !Number.isFinite(e.velocityX) || e.velocityY !== void 0 && !Number.isFinite(e.velocityY)) throw Error("Velocity assignment must contain finite numbers");
839
860
  }
840
861
  //#endregion
841
862
  //#region src/systems/collision.ts
842
- var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
863
+ var zt = 1e-4, Bt = 24, Vt = "collidable", Q = [], Ht = 2 ** 26, Ut = {
843
864
  fraction: 1,
844
865
  blocking: Q
845
- }, Vt = class {
866
+ }, Wt = class {
846
867
  buckets = [];
847
868
  hasBounciness = !1;
848
869
  resolved = /* @__PURE__ */ new Set();
@@ -857,7 +878,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
857
878
  if (U(l, u, d)) continue;
858
879
  let f = o[4], p = W(l, u, d, f), m = G(l, u, d, f);
859
880
  e.bounciness && (this.hasBounciness = !0);
860
- let h = e.velocity, g = e.dynamics, _ = At(a, n.entityId), v = i ? jt(i, n.entityId) : -1, y = g?.[2] ?? 1, b = v < 0 ? _?.forceX ?? 0 : i[v + 1], x = v < 0 ? _?.forceY ?? 0 : i[v + 2], S = v < 0 ? _?.impulseX ?? 0 : i[v + 3], C = v < 0 ? _?.impulseY ?? 0 : i[v + 4], w = v < 0 ? 0 : i[v + 5], T = v < 0 ? _?.velocityX : w & 1 ? i[v + 6] : void 0, E = v < 0 ? _?.velocityY : w & 2 ? i[v + 7] : void 0, D = h?.[0] ?? 0, O = h?.[1] ?? 0, k = D + (g?.[0] ?? 0) * t + b * y * t + S * y, A = O + (g?.[1] ?? 0) * t + x * y * t + C * y, j = T ?? k, M = E ?? A, N = Math.max(Math.abs(D), Math.abs(j)) * t, ee = Math.max(Math.abs(O), Math.abs(M)) * t, P = o[0], F = o[1], I = r.get(c);
881
+ let h = e.velocity, g = e.dynamics, _ = Nt(a, n.entityId), v = i ? Pt(i, n.entityId) : -1, y = g?.[2] ?? 1, b = v < 0 ? _?.forceX ?? 0 : i[v + 1], x = v < 0 ? _?.forceY ?? 0 : i[v + 2], S = v < 0 ? _?.impulseX ?? 0 : i[v + 3], C = v < 0 ? _?.impulseY ?? 0 : i[v + 4], w = v < 0 ? 0 : i[v + 5], T = v < 0 ? _?.velocityX : w & 1 ? i[v + 6] : void 0, E = v < 0 ? _?.velocityY : w & 2 ? i[v + 7] : void 0, D = h?.[0] ?? 0, O = h?.[1] ?? 0, k = D + (g?.[0] ?? 0) * t + b * y * t + S * y, A = O + (g?.[1] ?? 0) * t + x * y * t + C * y, j = T ?? k, M = E ?? A, N = Math.max(Math.abs(D), Math.abs(j)) * t, ee = Math.max(Math.abs(O), Math.abs(M)) * t, P = o[0], F = o[1], I = r.get(c);
861
882
  I || (I = {
862
883
  entries: [],
863
884
  bounds: []
@@ -877,17 +898,17 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
877
898
  }
878
899
  }
879
900
  claimContact(e, t) {
880
- let n = e < t ? e * zt + t : t * zt + e;
901
+ let n = e < t ? e * Ht + t : t * Ht + e;
881
902
  return this.resolved.has(n) ? !1 : (this.resolved.add(n), !0);
882
903
  }
883
904
  forEachOverlapping(e, t, n = 0, r = 0) {
884
- let i = Wt(e);
905
+ let i = qt(e);
885
906
  if (!i) return;
886
907
  let { x: a, y: o, halfWidth: s, halfHeight: c } = i;
887
908
  if (i.ccd && (n !== 0 || r !== 0)) {
888
909
  let e = a - n, l = o - r, u = Math.min(e, a) - s, d = Math.min(l, o) - c, f = Math.max(e, a) + s, p = Math.max(l, o) + c;
889
910
  this.forEachCandidate(i, u, d, f, p, (a) => {
890
- Gt(i, e, l, n, r, a) && t(a);
911
+ Jt(i, e, l, n, r, a) && t(a);
891
912
  });
892
913
  return;
893
914
  }
@@ -896,7 +917,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
896
917
  });
897
918
  }
898
919
  contactPoint(e, t, n, r) {
899
- let i = e.components.transform, a = i[0], o = i[1], s = Math.sqrt(n * n + r * r), c = Wt(e);
920
+ let i = e.components.transform, a = i[0], o = i[1], s = Math.sqrt(n * n + r * r), c = qt(e);
900
921
  if (!c || s === 0) return {
901
922
  x: a,
902
923
  y: o
@@ -909,16 +930,16 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
909
930
  };
910
931
  }
911
932
  contactNormal(e, t, n, r, i) {
912
- let a = Wt(e);
933
+ let a = qt(e);
913
934
  if (!a) return !1;
914
935
  let o = n === 0 && r === 0 ? {
915
936
  x: a.x,
916
937
  y: a.y
917
938
  } : this.contactPoint(e, t, n, r);
918
- return Ht(a, o.x, o.y, t, i);
939
+ return Gt(a, o.x, o.y, t, i);
919
940
  }
920
941
  sweep(e, t, n) {
921
- let r = Math.sqrt(t * t + n * n), i = Wt(e);
942
+ let r = Math.sqrt(t * t + n * n), i = qt(e);
922
943
  if (!i || r === 0) return {
923
944
  fraction: 1,
924
945
  blocking: Q
@@ -931,7 +952,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
931
952
  } : this.refine(i, a, t, n, r);
932
953
  }
933
954
  resolveMove(e, t, n, r) {
934
- let i = Math.sqrt(t * t + n * n), a = Wt(e);
955
+ let i = Math.sqrt(t * t + n * n), a = qt(e);
935
956
  if (!a || i === 0) return {
936
957
  moveX: t,
937
958
  moveY: n,
@@ -962,7 +983,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
962
983
  moveY: n,
963
984
  blocking: Q
964
985
  };
965
- let i = e.length === 0 ? Bt : this.refine(a, e, t, 0, Math.abs(t)), o = r.length === 0 ? Bt : this.refine(a, r, 0, n, Math.abs(n)), s = t * i.fraction, c = n * o.fraction;
986
+ let i = e.length === 0 ? Ut : this.refine(a, e, t, 0, Math.abs(t)), o = r.length === 0 ? Ut : this.refine(a, r, 0, n, Math.abs(n)), s = t * i.fraction, c = n * o.fraction;
966
987
  if (s !== 0 && c !== 0) {
967
988
  let e = this.gatherCandidates(a, s, c);
968
989
  if (e.length > 0) {
@@ -977,7 +998,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
977
998
  return {
978
999
  moveX: s,
979
1000
  moveY: c,
980
- blocking: Ut(i.blocking, o.blocking)
1001
+ blocking: Kt(i.blocking, o.blocking)
981
1002
  };
982
1003
  }
983
1004
  let s = this.refine(a, o, t, n, i);
@@ -996,15 +1017,15 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
996
1017
  }), l;
997
1018
  }
998
1019
  refine(e, t, n, r, i) {
999
- let { x: a, y: o } = e, s = 0, c = 1, l = It / i;
1000
- for (let i = 0; i < Lt && c - s > l; i++) {
1020
+ let { x: a, y: o } = e, s = 0, c = 1, l = zt / i;
1021
+ for (let i = 0; i < Bt && c - s > l; i++) {
1001
1022
  let i = (s + c) / 2;
1002
1023
  this.blockedAt(e, t, n, r, i) ? c = i : s = i;
1003
1024
  }
1004
1025
  let u = [], d = a + n * c, f = o + r * c;
1005
1026
  for (let n of t) $(e, d, f, n) && u.push(n);
1006
1027
  return {
1007
- fraction: s * i > It ? s : 0,
1028
+ fraction: s * i > zt ? s : 0,
1008
1029
  blocking: u
1009
1030
  };
1010
1031
  }
@@ -1012,7 +1033,7 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
1012
1033
  if (e.sensor) return [];
1013
1034
  let { x: r, y: i, halfWidth: a, halfHeight: o } = e, s = r + t, c = i + n, l = [];
1014
1035
  return this.forEachCandidate(e, Math.min(r, s) - a, Math.min(i, c) - o, Math.max(r, s) + a, Math.max(i, c) + o, (a) => {
1015
- R(a.components.body) || $(e, r, i, a) || Gt(e, r, i, t, n, a) && l.push(a);
1036
+ R(a.components.body) || $(e, r, i, a) || Jt(e, r, i, t, n, a) && l.push(a);
1016
1037
  }), l;
1017
1038
  }
1018
1039
  sweepContinuous(e, t, n, r) {
@@ -1021,13 +1042,13 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
1021
1042
  fraction: 1,
1022
1043
  blocking: Q
1023
1044
  };
1024
- let a = 1, o = [], s = It / r;
1045
+ let a = 1, o = [], s = zt / r;
1025
1046
  for (let c of i) {
1026
1047
  let i = this.entryFraction(e, c, t, n, r);
1027
1048
  i < a - s ? (a = i, o = [c]) : i <= a + s && o.push(c);
1028
1049
  }
1029
1050
  return {
1030
- fraction: a * r > It ? a : 0,
1051
+ fraction: a * r > zt ? a : 0,
1031
1052
  blocking: o
1032
1053
  };
1033
1054
  }
@@ -1035,12 +1056,12 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
1035
1056
  let a;
1036
1057
  if (this.blockedAtOne(e, t, n, r, 1)) a = 1;
1037
1058
  else {
1038
- let o = t.components.transform, s = o[0] - e.x, c = o[1] - e.y, l = Kt((s * n + c * r) / (i * i));
1059
+ let o = t.components.transform, s = o[0] - e.x, c = o[1] - e.y, l = Yt((s * n + c * r) / (i * i));
1039
1060
  if (!this.blockedAtOne(e, t, n, r, l)) return l;
1040
1061
  a = l;
1041
1062
  }
1042
- let o = 0, s = It / i;
1043
- for (let i = 0; i < Lt && a - o > s; i++) {
1063
+ let o = 0, s = zt / i;
1064
+ for (let i = 0; i < Bt && a - o > s; i++) {
1044
1065
  let i = (o + a) / 2;
1045
1066
  this.blockedAtOne(e, t, n, r, i) ? a = i : o = i;
1046
1067
  }
@@ -1061,18 +1082,18 @@ var It = 1e-4, Lt = 24, Rt = "collidable", Q = [], zt = 2 ** 26, Bt = {
1061
1082
  }
1062
1083
  }
1063
1084
  };
1064
- function Ht(e, t, n, r, i) {
1085
+ function Gt(e, t, n, r, i) {
1065
1086
  let a = r.components.transform, o = L(r.components.body), s = a[0], c = a[1], l = a[2], u = a[3], d = a[4];
1066
- return e.shape === 4 || o === 4 ? ht(e.shape, e.polygon, t, n, e.width, e.height, e.angle, o, r.components.polygon, s, c, l, u, d, i) : Ke(e.shape, t, n, e.width, e.height, e.angle, o, s, c, l, u, d, i);
1087
+ return e.shape === 4 || o === 4 ? vt(e.shape, e.polygon, t, n, e.width, e.height, e.angle, o, r.components.polygon, s, c, l, u, d, i) : Ye(e.shape, t, n, e.width, e.height, e.angle, o, s, c, l, u, d, i);
1067
1088
  }
1068
- function Ut(e, t) {
1089
+ function Kt(e, t) {
1069
1090
  if (e.length === 0) return t;
1070
1091
  if (t.length === 0) return e;
1071
1092
  let n = [...e];
1072
1093
  for (let e of t) n.some((t) => t.entityId === e.entityId) || n.push(e);
1073
1094
  return n;
1074
1095
  }
1075
- function Wt(e) {
1096
+ function qt(e) {
1076
1097
  let t = e.components.body;
1077
1098
  if (!t) return;
1078
1099
  let n = t[2];
@@ -1097,28 +1118,28 @@ function Wt(e) {
1097
1118
  ccd: be(t)
1098
1119
  };
1099
1120
  }
1100
- function Gt(e, t, n, r, i, a) {
1121
+ function Jt(e, t, n, r, i, a) {
1101
1122
  let o = t + r, s = n + i, c = a.components.transform, l = L(a.components.body), u = c[0], d = c[1], f = c[2], p = c[3], m = c[4];
1102
1123
  if (e.shape === 1 || e.shape === 4) {
1103
1124
  let c = Math.cos(e.angle), h = Math.sin(e.angle), g = r * c + i * h, _ = -r * h + i * c;
1104
- return qt(1, void 0, (t + o) / 2, (n + s) / 2, e.width + Math.abs(g), e.height + Math.abs(_), e.angle, l, a.components.polygon, u, d, f, p, m);
1125
+ return Xt(1, void 0, (t + o) / 2, (n + s) / 2, e.width + Math.abs(g), e.height + Math.abs(_), e.angle, l, a.components.polygon, u, d, f, p, m);
1105
1126
  }
1106
1127
  let h = H(e.shape, e.width, e.height), g = Math.sqrt(r * r + i * i), _ = g > 0 ? Math.atan2(i, r) : e.angle;
1107
- return qt(3, void 0, (t + o) / 2, (n + s) / 2, g + h * 2, h * 2, _, l, a.components.polygon, u, d, f, p, m) ? !0 : qt(e.shape, e.polygon, o, s, e.width, e.height, e.angle, l, a.components.polygon, u, d, f, p, m);
1128
+ return Xt(3, void 0, (t + o) / 2, (n + s) / 2, g + h * 2, h * 2, _, l, a.components.polygon, u, d, f, p, m) ? !0 : Xt(e.shape, e.polygon, o, s, e.width, e.height, e.angle, l, a.components.polygon, u, d, f, p, m);
1108
1129
  }
1109
- function Kt(e) {
1130
+ function Yt(e) {
1110
1131
  return e < 0 ? 0 : e > 1 ? 1 : e;
1111
1132
  }
1112
1133
  function $(e, t, n, r) {
1113
1134
  let i = r.components.transform;
1114
- return qt(e.shape, e.polygon, t, n, e.width, e.height, e.angle, L(r.components.body), r.components.polygon, i[0], i[1], i[2], i[3], i[4]);
1135
+ return Xt(e.shape, e.polygon, t, n, e.width, e.height, e.angle, L(r.components.body), r.components.polygon, i[0], i[1], i[2], i[3], i[4]);
1115
1136
  }
1116
- function qt(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
1117
- return e !== 4 && s !== 4 ? Ge(e, n, r, i, a, o, s, l, u, d, f, p) : mt(e, t, n, r, i, a, o, s, c, l, u, d, f, p);
1137
+ function Xt(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
1138
+ return e !== 4 && s !== 4 ? Je(e, n, r, i, a, o, s, l, u, d, f, p) : _t(e, t, n, r, i, a, o, s, c, l, u, d, f, p);
1118
1139
  }
1119
1140
  //#endregion
1120
1141
  //#region src/systems/spatial-index.ts
1121
- var Jt = class {
1142
+ var Zt = class {
1122
1143
  entries = [];
1123
1144
  index;
1124
1145
  constructor(e) {
@@ -1158,14 +1179,14 @@ var Jt = class {
1158
1179
  let o = this.entries;
1159
1180
  return (i ? a.neighbors(e, t, n, r, (e) => i(o[e])) : a.neighbors(e, t, n, r)).map((e) => o[e]);
1160
1181
  }
1161
- }, Yt = {
1182
+ }, Qt = {
1162
1183
  x: 0,
1163
1184
  y: 0
1164
1185
  };
1165
- function Xt(e, t, n = !1) {
1166
- !$t(e, n) && !$t(t, n) || en(e, t) && tn(e, t, Yt) && (Qt(e, Yt.x, Yt.y, n), Qt(t, -Yt.x, -Yt.y, n));
1186
+ function $t(e, t, n = !1) {
1187
+ !nn(e, n) && !nn(t, n) || rn(e, t) && an(e, t, Qt) && (tn(e, Qt.x, Qt.y, n), tn(t, -Qt.x, -Qt.y, n));
1167
1188
  }
1168
- function Zt(e, t, n) {
1189
+ function en(e, t, n) {
1169
1190
  let r = e.components.bounciness, i = e.components.velocity;
1170
1191
  if (!r || !i) return;
1171
1192
  let a = i[0], o = i[1], s = a * t + o * n;
@@ -1173,9 +1194,9 @@ function Zt(e, t, n) {
1173
1194
  let c = (1 + r[0]) * s;
1174
1195
  i[0] = a - c * t, i[1] = o - c * n;
1175
1196
  }
1176
- function Qt(e, t, n, r) {
1197
+ function tn(e, t, n, r) {
1177
1198
  if (e.components.bounciness) {
1178
- Zt(e, t, n);
1199
+ en(e, t, n);
1179
1200
  return;
1180
1201
  }
1181
1202
  let i = e.components.velocity;
@@ -1183,60 +1204,60 @@ function Qt(e, t, n, r) {
1183
1204
  let a = i[0], o = i[1], s = a * t + o * n;
1184
1205
  s < 0 && (i[0] = a - s * t, i[1] = o - s * n);
1185
1206
  }
1186
- function $t(e, t) {
1207
+ function nn(e, t) {
1187
1208
  return e.components.velocity !== void 0 && (t || e.components.bounciness !== void 0);
1188
1209
  }
1189
- function en(e, t) {
1190
- return !rn(e.components.body) && !rn(t.components.body);
1210
+ function rn(e, t) {
1211
+ return !sn(e.components.body) && !sn(t.components.body);
1191
1212
  }
1192
- function tn(e, t, n) {
1193
- let r = e.components.transform, i = t.components.transform, a = nn(e.components.body), o = nn(t.components.body);
1194
- return a === 4 || o === 4 ? ht(a, e.components.polygon, r[0], r[1], r[2], r[3], r[4], o, t.components.polygon, i[0], i[1], i[2], i[3], i[4], n) : Ke(a, r[0], r[1], r[2], r[3], r[4], o, i[0], i[1], i[2], i[3], i[4], n);
1213
+ function an(e, t, n) {
1214
+ let r = e.components.transform, i = t.components.transform, a = on(e.components.body), o = on(t.components.body);
1215
+ return a === 4 || o === 4 ? vt(a, e.components.polygon, r[0], r[1], r[2], r[3], r[4], o, t.components.polygon, i[0], i[1], i[2], i[3], i[4], n) : Ye(a, r[0], r[1], r[2], r[3], r[4], o, i[0], i[1], i[2], i[3], i[4], n);
1195
1216
  }
1196
- function nn(e) {
1217
+ function on(e) {
1197
1218
  return e ? L(e) : 1;
1198
1219
  }
1199
- function rn(e) {
1220
+ function sn(e) {
1200
1221
  return e !== void 0 && R(e);
1201
1222
  }
1202
1223
  //#endregion
1203
1224
  //#region src/systems/physics-update.ts
1204
- function an(e, t, n) {
1225
+ function cn(e, t, n) {
1205
1226
  if (!e.spatialMap && (!e.heap || !e.spatialMapMemory)) return;
1206
- let r = ut(e), i = X(n);
1227
+ let r = pt(e), i = X(n);
1207
1228
  r.update(t, i.minX, i.minY, i.maxX - i.minX, i.maxY - i.minY);
1208
1229
  }
1209
- var on = "position-updated", sn = {
1230
+ var ln = "position-updated", un = {
1210
1231
  x: 0,
1211
1232
  y: 0
1212
1233
  };
1213
- function cn(e = {}) {
1234
+ function dn(e = {}) {
1214
1235
  let { onCollision: t, optional: r = [], group: i, stopVelocityOnContact: a = !1 } = e, o, s, c = /* @__PURE__ */ new Map(), l = Object.assign((e, r, c, l, u) => {
1215
1236
  if (c.entity?.[n] === 1) return;
1216
1237
  if (c.body !== void 0 && xe(c.body)) {
1217
1238
  u.entityDied(r);
1218
1239
  return;
1219
1240
  }
1220
- let d = i ? un(c, i) : 0;
1241
+ let d = i ? pn(c, i) : 0;
1221
1242
  if (i && e.skipGroup === d) return;
1222
1243
  let f = {
1223
1244
  entityId: r,
1224
1245
  components: c
1225
1246
  }, p = c.interpolation, m = e.elapsedTime / 1e3;
1226
- kt(e, r, c.velocity, c.dynamics);
1247
+ Mt(e, r, c.velocity, c.dynamics);
1227
1248
  let h = c.velocity[0] * m, g = c.velocity[1] * m;
1228
- hn(p, c.transform, e.elapsedTime);
1249
+ vn(p, c.transform, e.elapsedTime);
1229
1250
  let _ = i ? s?.get(d) : o;
1230
1251
  if (!_) {
1231
- _n(r, c.transform, h, g, u, e.reportMoves), an(e, r, c), gn(p, e.tick);
1252
+ bn(r, c.transform, h, g, u, e.reportMoves), cn(e, r, c), yn(p, e.tick);
1232
1253
  return;
1233
1254
  }
1234
1255
  let v = c.bounciness !== void 0, y = _.resolveMove(f, h, g, !v);
1235
- if (_n(r, c.transform, y.moveX, y.moveY, u, e.reportMoves), an(e, r, c), gn(p, e.tick), !(!_.hasBounciness && !a && !t)) {
1256
+ if (bn(r, c.transform, y.moveX, y.moveY, u, e.reportMoves), cn(e, r, c), yn(p, e.tick), !(!_.hasBounciness && !a && !t)) {
1236
1257
  _.forEachOverlapping(f, (n) => {
1237
- _.claimContact(r, n.entityId) && dn(e, _, f, n, l, u, y.moveX, y.moveY, a, t);
1258
+ _.claimContact(r, n.entityId) && mn(e, _, f, n, l, u, y.moveX, y.moveY, a, t);
1238
1259
  }, y.moveX, y.moveY);
1239
- for (let n of y.blocking) _.claimContact(r, n.entityId) && dn(e, _, f, n, l, u, y.moveX, y.moveY, a, t);
1260
+ for (let n of y.blocking) _.claimContact(r, n.entityId) && mn(e, _, f, n, l, u, y.moveX, y.moveY, a, t);
1240
1261
  }
1241
1262
  }, { physics: {
1242
1263
  collision: !0,
@@ -1245,57 +1266,57 @@ function cn(e = {}) {
1245
1266
  group: i
1246
1267
  } });
1247
1268
  return l.preRun = (e, t, n) => {
1248
- ln(e, c), e.dieAtImpact = (t, n) => {
1249
- pn(e, i ? s?.get(un(t.components, i)) : o, t, n);
1269
+ fn(e, c), e.dieAtImpact = (t, n) => {
1270
+ gn(e, i ? s?.get(pn(t.components, i)) : o, t, n);
1250
1271
  };
1251
1272
  let r = e.elapsedTime / 1e3, a = n.collidable ?? [];
1252
1273
  if (!i) {
1253
- o = new Vt(a, r, e.dynamicsCommands);
1274
+ o = new Wt(a, r, e.dynamicsCommands);
1254
1275
  return;
1255
1276
  }
1256
1277
  let l = /* @__PURE__ */ new Map();
1257
1278
  for (let t of a) {
1258
- let n = un(t.components, i);
1279
+ let n = pn(t.components, i);
1259
1280
  if (e.skipGroup === n) continue;
1260
1281
  let r = l.get(n);
1261
1282
  r || (r = [], l.set(n, r)), r.push(t);
1262
1283
  }
1263
1284
  s = /* @__PURE__ */ new Map();
1264
- for (let [t, n] of l) s.set(t, new Vt(n, r, e.dynamicsCommands));
1285
+ for (let [t, n] of l) s.set(t, new Wt(n, r, e.dynamicsCommands));
1265
1286
  }, l;
1266
1287
  }
1267
- function ln(e, t) {
1288
+ function fn(e, t) {
1268
1289
  let n = e, r = e.commandQueueId ?? 0, i = t.get(r);
1269
- i && (e.dynamicsCommands = Ot(i, e.dynamicsCommands), t.delete(r));
1290
+ i && (e.dynamicsCommands = jt(i, e.dynamicsCommands), t.delete(r));
1270
1291
  let a = () => {
1271
1292
  let e = t.get(r);
1272
1293
  return e || (e = /* @__PURE__ */ new Map(), t.set(r, e)), e;
1273
1294
  };
1274
1295
  n.queueForce = (e, t, n) => {
1275
- Et(a(), e, t, n, 0, 0);
1296
+ kt(a(), e, t, n, 0, 0);
1276
1297
  }, n.queueImpulse = (e, t, n) => {
1277
- Et(a(), e, 0, 0, t, n);
1298
+ kt(a(), e, 0, 0, t, n);
1278
1299
  }, n.queueVelocity = (e, t) => {
1279
- Dt(a(), e, t);
1300
+ At(a(), e, t);
1280
1301
  };
1281
1302
  }
1282
- function un(e, t) {
1303
+ function pn(e, t) {
1283
1304
  let n = e[t.component];
1284
1305
  return n ? n[t.index] : 0;
1285
1306
  }
1286
- function dn(e, t, n, r, i, a, o, s, c, l) {
1287
- if (Xt(n, r, c), !l) return;
1307
+ function mn(e, t, n, r, i, a, o, s, c, l) {
1308
+ if ($t(n, r, c), !l) return;
1288
1309
  let u = X(n.components), d = X(r.components);
1289
- sn.x = 0, sn.y = 0, t.contactNormal(n, r, o, s, sn), l(e, n, r, i, a, {
1290
- normalX: sn.x,
1291
- normalY: sn.y
1292
- }), fn(e, n.entityId, n.components, u), fn(e, r.entityId, r.components, d);
1310
+ un.x = 0, un.y = 0, t.contactNormal(n, r, o, s, un), l(e, n, r, i, a, {
1311
+ normalX: un.x,
1312
+ normalY: un.y
1313
+ }), hn(e, n.entityId, n.components, u), hn(e, r.entityId, r.components, d);
1293
1314
  }
1294
- function fn(e, t, n, r) {
1315
+ function hn(e, t, n, r) {
1295
1316
  let i = X(n);
1296
- (i.minX !== r.minX || i.minY !== r.minY || i.maxX !== r.maxX || i.maxY !== r.maxY) && an(e, t, n);
1317
+ (i.minX !== r.minX || i.minY !== r.minY || i.maxX !== r.maxX || i.maxY !== r.maxY) && cn(e, t, n);
1297
1318
  }
1298
- function pn(e, t, n, r) {
1319
+ function gn(e, t, n, r) {
1299
1320
  let i = n.components.body;
1300
1321
  if (!i || xe(i)) return;
1301
1322
  Se(i);
@@ -1315,34 +1336,34 @@ function pn(e, t, n, r) {
1315
1336
  } }, u, d);
1316
1337
  a[0] = f.x, a[1] = f.y;
1317
1338
  }
1318
- function mn(e, t, n, r, i) {
1339
+ function _n(e, t, n, r, i) {
1319
1340
  let a = e.elapsedTime / 1e3, o = n.interpolation;
1320
- kt(e, t, n.velocity, n.dynamics), hn(o, n.transform, e.elapsedTime), _n(t, n.transform, n.velocity[0] * a, n.velocity[1] * a, i, e.reportMoves), an(e, t, n), gn(o, e.tick);
1341
+ Mt(e, t, n.velocity, n.dynamics), vn(o, n.transform, e.elapsedTime), bn(t, n.transform, n.velocity[0] * a, n.velocity[1] * a, i, e.reportMoves), cn(e, t, n), yn(o, e.tick);
1321
1342
  }
1322
- function hn(e, t, n) {
1323
- e && (e[2] = t[0], e[3] = t[1], e[6] = n);
1343
+ function vn(e, t, n) {
1344
+ e && (a(e, 7, NaN), e[2] = t[0], e[3] = t[1], e[6] = n, e[8] += n);
1324
1345
  }
1325
- function gn(e, t) {
1346
+ function yn(e, t) {
1326
1347
  e && a(e, 7, t);
1327
1348
  }
1328
- function _n(e, t, n, r, i, a) {
1329
- n === 0 && r === 0 || (n !== 0 && c(t, 0, n, Infinity), r !== 0 && c(t, 1, r, Infinity), a !== !1 && i.emitSystemEvent(on, e));
1349
+ function bn(e, t, n, r, i, a) {
1350
+ n === 0 && r === 0 || (n !== 0 && c(t, 0, n, Infinity), r !== 0 && c(t, 1, r, Infinity), a !== !1 && i.emitSystemEvent(ln, e));
1330
1351
  }
1331
1352
  //#endregion
1332
1353
  //#region src/systems/physics-system.ts
1333
- var vn = 50, yn = 1, bn = class extends r {
1354
+ var xn = 50, Sn = 1, Cn = class extends r {
1334
1355
  spatialWorld;
1335
1356
  pendingDynamicsCommands = /* @__PURE__ */ new Map();
1336
- commandQueueId = yn++;
1357
+ commandQueueId = Sn++;
1337
1358
  tick = 0;
1338
1359
  reportMoves;
1339
1360
  skipGroup;
1340
1361
  constructor(e, t = {}) {
1341
- let n = t.updateFunction ?? mn, r = t.optional ?? n.physics?.optional ?? [], i = t.collision ?? n.physics?.collision ?? !1, a = n === mn || n.physics?.dynamics === !0, o = n.physics?.group, s = [];
1362
+ let n = t.updateFunction ?? _n, r = t.optional ?? n.physics?.optional ?? [], i = t.collision ?? n.physics?.collision ?? !1, a = n === _n || n.physics?.dynamics === !0, o = n.physics?.group, s = [];
1342
1363
  i && !r.includes("body") && s.push("body"), i && !r.includes("bounciness") && s.push("bounciness"), i && !r.includes("polygon") && s.push("polygon"), r.includes("interpolation") || s.push("interpolation"), a && !r.includes("dynamics") && s.push("dynamics"), i && s.push("entity"), o && !r.includes(o.component) && s.push(o.component);
1343
1364
  let c = s.length ? [...s, ...r] : r, l = r.includes("bounciness") ? [...r] : ["bounciness", ...r];
1344
1365
  l.includes("polygon") || l.push("polygon"), a && !l.includes("dynamics") && l.push("dynamics"), o && !l.includes(o.component) && l.push(o.component);
1345
- let u = i ? { [Rt]: {
1366
+ let u = i ? { [Vt]: {
1346
1367
  required: ["transform", "body"],
1347
1368
  optional: [
1348
1369
  "velocity",
@@ -1353,7 +1374,7 @@ var vn = 50, yn = 1, bn = class extends r {
1353
1374
  } } : void 0, d = u || t.queries ? {
1354
1375
  ...u,
1355
1376
  ...t.queries
1356
- } : void 0, f = xn(t.scope, t.filter);
1377
+ } : void 0, f = wn(t.scope, t.filter);
1357
1378
  super(e, {
1358
1379
  name: t.name ?? "PhysicsSystem",
1359
1380
  deltaBetweenRuns: t.deltaBetweenRuns ?? 50,
@@ -1371,7 +1392,7 @@ var vn = 50, yn = 1, bn = class extends r {
1371
1392
  }
1372
1393
  startInterpolation(e) {
1373
1394
  let t = this.deltaBetweenRuns;
1374
- t <= 0 || Ue(e, {
1395
+ t <= 0 || Ke(e, {
1375
1396
  stepMs: t,
1376
1397
  stepFraction: this.currentDelta / t,
1377
1398
  tick: this.tick
@@ -1385,14 +1406,14 @@ var vn = 50, yn = 1, bn = class extends r {
1385
1406
  }
1386
1407
  queueVelocity(e, t) {
1387
1408
  let n = typeof e == "number" ? e : e.eid;
1388
- Dt(this.pendingDynamicsCommands, n, t);
1409
+ At(this.pendingDynamicsCommands, n, t);
1389
1410
  }
1390
1411
  addDataToWorld(e) {
1391
- e.tick = ++this.tick, lt(this.spatialWorld, e), e.reportMoves = this.reportMoves ?? this.listenerCount("position-updated") > 0, e.skipGroup = this.skipGroup, e.commandQueueId = this.commandQueueId, e.dynamicsCommands = this.snapshotDynamicsCommands();
1412
+ e.tick = ++this.tick, ft(this.spatialWorld, e), e.reportMoves = this.reportMoves ?? this.listenerCount("position-updated") > 0, e.skipGroup = this.skipGroup, e.commandQueueId = this.commandQueueId, e.dynamicsCommands = this.snapshotDynamicsCommands();
1392
1413
  }
1393
1414
  queueDynamics(e, t, n, r, i) {
1394
1415
  let a = typeof e == "number" ? e : e.eid;
1395
- Et(this.pendingDynamicsCommands, a, t, n, r, i);
1416
+ kt(this.pendingDynamicsCommands, a, t, n, r, i);
1396
1417
  }
1397
1418
  snapshotDynamicsCommands() {
1398
1419
  if (this.pendingDynamicsCommands.size === 0) return;
@@ -1408,28 +1429,37 @@ var vn = 50, yn = 1, bn = class extends r {
1408
1429
  return n;
1409
1430
  }
1410
1431
  };
1411
- function xn(e, t) {
1432
+ function wn(e, t) {
1412
1433
  return e ? t ? (n) => e(n) && t(n) : e : t;
1413
1434
  }
1414
1435
  //#endregion
1415
1436
  //#region src/systems/interpolation-update.ts
1416
- var Sn = (e, t, n) => {
1417
- let r = n.interpolation, a = n.transform, o = i(r, 7), s = r[2], c = r[3], l = r[6], u = a[0], d = a[1], f = i(r, 7);
1418
- if (o !== f) return;
1419
- if (l <= 0) {
1420
- r[4] = 1, r[5] = f, r[0] = u, r[1] = d;
1437
+ var Tn = (e, t, n) => {
1438
+ let r = n.interpolation, a = n.transform, o = i(r, 7), s = r[6], c = r[8], l = a[0], u = a[1], d = i(r, 7);
1439
+ if (o !== d) return;
1440
+ if (s <= 0) {
1441
+ r[4] = 1, r[5] = d, r[9] = c, r[10] = 0, r[0] = l, r[1] = u;
1442
+ return;
1443
+ }
1444
+ let f = r[4], p = r[10];
1445
+ if (d !== r[5]) {
1446
+ let e = r[9], t = c >= e ? c - e : s;
1447
+ p += t, r[9] = c, f = 0, r[5] = d;
1448
+ }
1449
+ if (f += e.elapsedTime / s, f > 1 && (f = 1), r[4] = f, p <= 0) {
1450
+ r[10] = 0, r[0] = l, r[1] = u;
1421
1451
  return;
1422
1452
  }
1423
- let p = r[4];
1424
- f !== r[5] && (p = 0, r[5] = f), p += e.elapsedTime / l, p > 1 && (p = 1), r[4] = p, r[0] = s + (u - s) * p, r[1] = c + (d - c) * p;
1425
- }, Cn = class extends r {
1453
+ let m = Math.min(Math.max(e.elapsedTime, 0), p), h = m / p, g = r[0], _ = r[1];
1454
+ r[0] = g + (l - g) * h, r[1] = _ + (u - _) * h, r[10] = p - m;
1455
+ }, En = class extends r {
1426
1456
  constructor(e, t = {}) {
1427
1457
  super(e, {
1428
1458
  name: t.name ?? "InterpolationSystem",
1429
1459
  deltaBetweenRuns: 0,
1430
1460
  firstRun: t.firstRun,
1431
1461
  required: ["transform", "interpolation"],
1432
- updateFunction: Sn,
1462
+ updateFunction: Tn,
1433
1463
  forceMainThread: t.forceMainThread ?? !t.getWorker,
1434
1464
  getWorker: t.getWorker ?? (() => {
1435
1465
  throw Error("InterpolationSystem cannot start a worker: no getWorker was supplied");
@@ -1438,6 +1468,6 @@ var Sn = (e, t, n) => {
1438
1468
  }
1439
1469
  };
1440
1470
  //#endregion
1441
- export { pe as BODY_CATEGORY_INDEX, ve as BODY_CCD_FLAG, ye as BODY_DYING_FLAG, fe as BODY_FLAGS_INDEX, me as BODY_MASK_INDEX, _e as BODY_SENSOR_FLAG, ge as BODY_SHAPE_MASK, he as BODY_SIZE, De as BOUNCINESS_INDEX, Oe as BOUNCINESS_SIZE, Rt as COLLIDABLE_QUERY, Vt as CollisionBroadphase, le as DEFAULT_COLLIDE_CATEGORY, ue as DEFAULT_COLLIDE_MASK, vn as DEFAULT_PHYSICS_STEP_MS, N as DYNAMICS_ACCELERATION_X_INDEX, ee as DYNAMICS_ACCELERATION_Y_INDEX, P as DYNAMICS_INVERSE_MASS_INDEX, F as DYNAMICS_SIZE, Le as INTERPOLATION_DURATION_INDEX, Ne as INTERPOLATION_PREV_X_INDEX, Pe as INTERPOLATION_PREV_Y_INDEX, Fe as INTERPOLATION_PROGRESS_INDEX, ze as INTERPOLATION_SIZE, Ie as INTERPOLATION_SYNCED_TICK_INDEX, Re as INTERPOLATION_TICK_INDEX, je as INTERPOLATION_X_INDEX, Me as INTERPOLATION_Y_INDEX, Cn as InterpolationSystem, l as MAX_POLYGON_VERTICES, f as POLYGON_SIZE, u as POLYGON_VERTEX_COUNT_INDEX, d as POLYGON_VERTICES_INDEX, on as POSITION_UPDATED_EVENT, dt as PhysicalWorld, bn as PhysicsSystem, oe as SHAPE_CAPSULE, ae as SHAPE_CIRCLE, se as SHAPE_POLYGON, ie as SHAPE_RECTANGLE, Jt as SpatialIndex, S as TRANSFORM_ANGLE_INDEX, x as TRANSFORM_HEIGHT_INDEX, C as TRANSFORM_SIZE, b as TRANSFORM_WIDTH_INDEX, v as TRANSFORM_X_INDEX, y as TRANSFORM_Y_INDEX, O as VELOCITY_DAMPING_INDEX, k as VELOCITY_SIZE, E as VELOCITY_X_INDEX, D as VELOCITY_Y_INDEX, lt as addPhysicalWorldData, we as bodyDefinition, L as bodyShape, Ae as bouncinessDefinition, et as boundsHalfHeight, $e as boundsHalfWidth, de as canCollide, V as capsuleHalfLength, Ke as contactNormal, cn as createPhysicsUpdate, te as dynamicsDefinition, ut as getSpatialMap, kt as integrateDynamics, Ve as interpolationDefinition, Sn as interpolationUpdate, be as isContinuous, xe as isDying, R as isSensor, Se as markDying, tt as orientedBoxesOverlap, We as physicsRegistry, mn as physicsUpdate, J as pointSegmentDistanceSquared, ht as polygonContactNormal, m as polygonDefinition, mt as polygonShapesOverlap, h as preparePolygon, rt as segmentBoxDistanceSquared, nt as segmentSegmentDistanceSquared, G as shapeHalfHeight, W as shapeHalfWidth, U as shapeIsEmpty, H as shapeRadius, Ge as shapesOverlap, He as snapEntity, Ue as startSpawnInterpolation, T as transformDefinition, an as updateSpatialMap, j as velocityDefinition };
1471
+ export { pe as BODY_CATEGORY_INDEX, ve as BODY_CCD_FLAG, ye as BODY_DYING_FLAG, fe as BODY_FLAGS_INDEX, me as BODY_MASK_INDEX, _e as BODY_SENSOR_FLAG, ge as BODY_SHAPE_MASK, he as BODY_SIZE, De as BOUNCINESS_INDEX, Oe as BOUNCINESS_SIZE, Vt as COLLIDABLE_QUERY, Wt as CollisionBroadphase, le as DEFAULT_COLLIDE_CATEGORY, ue as DEFAULT_COLLIDE_MASK, xn as DEFAULT_PHYSICS_STEP_MS, N as DYNAMICS_ACCELERATION_X_INDEX, ee as DYNAMICS_ACCELERATION_Y_INDEX, P as DYNAMICS_INVERSE_MASS_INDEX, F as DYNAMICS_SIZE, Le as INTERPOLATION_DURATION_INDEX, Ne as INTERPOLATION_PREV_X_INDEX, Pe as INTERPOLATION_PREV_Y_INDEX, Fe as INTERPOLATION_PROGRESS_INDEX, Ve as INTERPOLATION_REMAINING_DURATION_INDEX, He as INTERPOLATION_SIZE, Be as INTERPOLATION_SYNCED_DURATION_INDEX, Ie as INTERPOLATION_SYNCED_TICK_INDEX, Re as INTERPOLATION_TICK_INDEX, ze as INTERPOLATION_TOTAL_DURATION_INDEX, je as INTERPOLATION_X_INDEX, Me as INTERPOLATION_Y_INDEX, En as InterpolationSystem, l as MAX_POLYGON_VERTICES, f as POLYGON_SIZE, u as POLYGON_VERTEX_COUNT_INDEX, d as POLYGON_VERTICES_INDEX, ln as POSITION_UPDATED_EVENT, mt as PhysicalWorld, Cn as PhysicsSystem, oe as SHAPE_CAPSULE, ae as SHAPE_CIRCLE, se as SHAPE_POLYGON, ie as SHAPE_RECTANGLE, Zt as SpatialIndex, S as TRANSFORM_ANGLE_INDEX, x as TRANSFORM_HEIGHT_INDEX, C as TRANSFORM_SIZE, b as TRANSFORM_WIDTH_INDEX, v as TRANSFORM_X_INDEX, y as TRANSFORM_Y_INDEX, O as VELOCITY_DAMPING_INDEX, k as VELOCITY_SIZE, E as VELOCITY_X_INDEX, D as VELOCITY_Y_INDEX, ft as addPhysicalWorldData, we as bodyDefinition, L as bodyShape, Ae as bouncinessDefinition, rt as boundsHalfHeight, nt as boundsHalfWidth, de as canCollide, V as capsuleHalfLength, Ye as contactNormal, dn as createPhysicsUpdate, te as dynamicsDefinition, pt as getSpatialMap, Mt as integrateDynamics, We as interpolationDefinition, Tn as interpolationUpdate, be as isContinuous, xe as isDying, R as isSensor, Se as markDying, it as orientedBoxesOverlap, qe as physicsRegistry, _n as physicsUpdate, J as pointSegmentDistanceSquared, vt as polygonContactNormal, m as polygonDefinition, _t as polygonShapesOverlap, h as preparePolygon, ot as segmentBoxDistanceSquared, at as segmentSegmentDistanceSquared, G as shapeHalfHeight, W as shapeHalfWidth, U as shapeIsEmpty, H as shapeRadius, Je as shapesOverlap, Ge as snapEntity, Ke as startSpawnInterpolation, T as transformDefinition, cn as updateSpatialMap, j as velocityDefinition };
1442
1472
 
1443
1473
  //# sourceMappingURL=index.js.map