@newkrok/nape-js 3.3.16 → 3.3.17
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.cjs +118 -309
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +118 -309
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1738,10 +1738,8 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1738
1738
|
}
|
|
1739
1739
|
set(options) {
|
|
1740
1740
|
if (options != this) {
|
|
1741
|
-
while (this.includes.head != null)
|
|
1742
|
-
|
|
1743
|
-
while (this.excludes.head != null)
|
|
1744
|
-
this.append_type(this.includes, this.excludes.head.elt);
|
|
1741
|
+
while (this.includes.head != null) this.append_type(this.excludes, this.includes.head.elt);
|
|
1742
|
+
while (this.excludes.head != null) this.append_type(this.includes, this.excludes.head.elt);
|
|
1745
1743
|
let cx_ite = options.excludes.head;
|
|
1746
1744
|
while (cx_ite != null) {
|
|
1747
1745
|
const i = cx_ite.elt;
|
|
@@ -1760,9 +1758,7 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1760
1758
|
append(list, val) {
|
|
1761
1759
|
const napeNs = _ZPP_OptionType._nape;
|
|
1762
1760
|
if (val == null) {
|
|
1763
|
-
throw new Error(
|
|
1764
|
-
"Error: Cannot append null, only CbType and CbType list values"
|
|
1765
|
-
);
|
|
1761
|
+
throw new Error("Error: Cannot append null, only CbType and CbType list values");
|
|
1766
1762
|
}
|
|
1767
1763
|
if (val instanceof napeNs.callbacks.CbType) {
|
|
1768
1764
|
const cb = val;
|
|
@@ -1802,17 +1798,13 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1802
1798
|
const cb2 = cbs1[_g1];
|
|
1803
1799
|
++_g1;
|
|
1804
1800
|
if (!(cb2 instanceof napeNs.callbacks.CbType)) {
|
|
1805
|
-
throw new Error(
|
|
1806
|
-
"Error: Cannot append non-CbType or CbType list value"
|
|
1807
|
-
);
|
|
1801
|
+
throw new Error("Error: Cannot append non-CbType or CbType list value");
|
|
1808
1802
|
}
|
|
1809
1803
|
const cbx = cb2;
|
|
1810
1804
|
this.append_type(list, cbx.zpp_inner);
|
|
1811
1805
|
}
|
|
1812
1806
|
} else {
|
|
1813
|
-
throw new Error(
|
|
1814
|
-
"Error: Cannot append non-CbType or CbType list value"
|
|
1815
|
-
);
|
|
1807
|
+
throw new Error("Error: Cannot append non-CbType or CbType list value");
|
|
1816
1808
|
}
|
|
1817
1809
|
}
|
|
1818
1810
|
};
|
|
@@ -1892,10 +1884,7 @@ var _ZPP_Callback = class _ZPP_Callback {
|
|
|
1892
1884
|
this.outer_int.zpp_inner = this;
|
|
1893
1885
|
}
|
|
1894
1886
|
if (this.wrap_arbiters == null) {
|
|
1895
|
-
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(
|
|
1896
|
-
this.set.arbiters,
|
|
1897
|
-
true
|
|
1898
|
-
);
|
|
1887
|
+
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(this.set.arbiters, true);
|
|
1899
1888
|
} else {
|
|
1900
1889
|
this.wrap_arbiters.zpp_inner.inner = this.set.arbiters;
|
|
1901
1890
|
}
|
|
@@ -2018,10 +2007,7 @@ var _ZPP_Callback = class _ZPP_Callback {
|
|
|
2018
2007
|
genarbs() {
|
|
2019
2008
|
const zpp = _ZPP_Callback._zpp;
|
|
2020
2009
|
if (this.wrap_arbiters == null) {
|
|
2021
|
-
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(
|
|
2022
|
-
this.set.arbiters,
|
|
2023
|
-
true
|
|
2024
|
-
);
|
|
2010
|
+
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(this.set.arbiters, true);
|
|
2025
2011
|
} else {
|
|
2026
2012
|
this.wrap_arbiters.zpp_inner.inner = this.set.arbiters;
|
|
2027
2013
|
}
|
|
@@ -2305,9 +2291,7 @@ var _ZPP_BodyListener = class _ZPP_BodyListener extends ZPP_Listener {
|
|
|
2305
2291
|
}
|
|
2306
2292
|
immutable_options() {
|
|
2307
2293
|
if (this.space != null && this.space.midstep) {
|
|
2308
|
-
throw new Error(
|
|
2309
|
-
"Error: Cannot change listener type options during space.step()"
|
|
2310
|
-
);
|
|
2294
|
+
throw new Error("Error: Cannot change listener type options during space.step()");
|
|
2311
2295
|
}
|
|
2312
2296
|
}
|
|
2313
2297
|
addedToSpace() {
|
|
@@ -2394,9 +2378,7 @@ var _ZPP_BodyListener = class _ZPP_BodyListener extends ZPP_Listener {
|
|
|
2394
2378
|
}
|
|
2395
2379
|
swapEvent(newev) {
|
|
2396
2380
|
if (newev != 2 && newev != 3) {
|
|
2397
|
-
throw new Error(
|
|
2398
|
-
"Error: BodyListener event must be either WAKE or SLEEP only"
|
|
2399
|
-
);
|
|
2381
|
+
throw new Error("Error: BodyListener event must be either WAKE or SLEEP only");
|
|
2400
2382
|
}
|
|
2401
2383
|
this.removedFromSpace();
|
|
2402
2384
|
this.event = newev;
|
|
@@ -2422,9 +2404,7 @@ var _ZPP_ConstraintListener = class _ZPP_ConstraintListener extends ZPP_Listener
|
|
|
2422
2404
|
}
|
|
2423
2405
|
immutable_options() {
|
|
2424
2406
|
if (this.space != null && this.space.midstep) {
|
|
2425
|
-
throw new Error(
|
|
2426
|
-
"Error: Cannot change listener type options during space.step()"
|
|
2427
|
-
);
|
|
2407
|
+
throw new Error("Error: Cannot change listener type options during space.step()");
|
|
2428
2408
|
}
|
|
2429
2409
|
}
|
|
2430
2410
|
addedToSpace() {
|
|
@@ -2511,9 +2491,7 @@ var _ZPP_ConstraintListener = class _ZPP_ConstraintListener extends ZPP_Listener
|
|
|
2511
2491
|
}
|
|
2512
2492
|
swapEvent(newev) {
|
|
2513
2493
|
if (newev != 2 && newev != 3 && newev != 4) {
|
|
2514
|
-
throw new Error(
|
|
2515
|
-
"Error: ConstraintListener event must be either WAKE or SLEEP only"
|
|
2516
|
-
);
|
|
2494
|
+
throw new Error("Error: ConstraintListener event must be either WAKE or SLEEP only");
|
|
2517
2495
|
}
|
|
2518
2496
|
this.removedFromSpace();
|
|
2519
2497
|
this.event = newev;
|
|
@@ -2773,35 +2751,31 @@ var _ZPP_InteractionListener = class _ZPP_InteractionListener extends ZPP_Listen
|
|
|
2773
2751
|
set.next = null;
|
|
2774
2752
|
}
|
|
2775
2753
|
set.lt = zpp.callbacks.ZPP_CbSetPair.setlt;
|
|
2776
|
-
this.CbTypeset(
|
|
2777
|
-
this.
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
pair.
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
} else {
|
|
2797
|
-
pair.a = b;
|
|
2798
|
-
pair.b = a;
|
|
2799
|
-
}
|
|
2800
|
-
set.try_insert(pair);
|
|
2754
|
+
this.CbTypeset(this.options1.includes, this.options2.includes, (x, y) => {
|
|
2755
|
+
this.CbSetset(x.cbsets, y.cbsets, (a, b) => {
|
|
2756
|
+
a.validate();
|
|
2757
|
+
b.validate();
|
|
2758
|
+
if (zpp.callbacks.ZPP_CbSet.single_intersection(a, b, this)) {
|
|
2759
|
+
let pair;
|
|
2760
|
+
if (zpp.callbacks.ZPP_CbSetPair.zpp_pool == null) {
|
|
2761
|
+
pair = new zpp.callbacks.ZPP_CbSetPair();
|
|
2762
|
+
} else {
|
|
2763
|
+
pair = zpp.callbacks.ZPP_CbSetPair.zpp_pool;
|
|
2764
|
+
zpp.callbacks.ZPP_CbSetPair.zpp_pool = pair.next;
|
|
2765
|
+
pair.next = null;
|
|
2766
|
+
}
|
|
2767
|
+
pair.zip_listeners = true;
|
|
2768
|
+
if (zpp.callbacks.ZPP_CbSet.setlt(a, b)) {
|
|
2769
|
+
pair.a = a;
|
|
2770
|
+
pair.b = b;
|
|
2771
|
+
} else {
|
|
2772
|
+
pair.a = b;
|
|
2773
|
+
pair.b = a;
|
|
2801
2774
|
}
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2775
|
+
set.try_insert(pair);
|
|
2776
|
+
}
|
|
2777
|
+
});
|
|
2778
|
+
});
|
|
2805
2779
|
if (set.parent != null) {
|
|
2806
2780
|
let cur = set.parent;
|
|
2807
2781
|
while (cur != null) {
|
|
@@ -2982,9 +2956,7 @@ var _ZPP_InteractionListener = class _ZPP_InteractionListener extends ZPP_Listen
|
|
|
2982
2956
|
if (this.type == 3) {
|
|
2983
2957
|
throw new Error("Error: PreListener event can only be PRE");
|
|
2984
2958
|
} else if (newev != 0 && newev != 1 && newev != 6) {
|
|
2985
|
-
throw new Error(
|
|
2986
|
-
"Error: InteractionListener event must be either BEGIN, END, ONGOING"
|
|
2987
|
-
);
|
|
2959
|
+
throw new Error("Error: InteractionListener event must be either BEGIN, END, ONGOING");
|
|
2988
2960
|
}
|
|
2989
2961
|
this.removedFromSpace();
|
|
2990
2962
|
this.event = newev;
|
|
@@ -3698,9 +3670,7 @@ var _ZPP_ConvexRayResult = class _ZPP_ConvexRayResult {
|
|
|
3698
3670
|
// ---------------------------------------------------------------------------
|
|
3699
3671
|
disposed() {
|
|
3700
3672
|
if (this.next != null) {
|
|
3701
|
-
throw new Error(
|
|
3702
|
-
"Error: This object has been disposed of and cannot be used"
|
|
3703
|
-
);
|
|
3673
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
3704
3674
|
}
|
|
3705
3675
|
}
|
|
3706
3676
|
// ---------------------------------------------------------------------------
|
|
@@ -4554,9 +4524,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4554
4524
|
pos_invalidate(pos) {
|
|
4555
4525
|
this.immutable_midstep("Body::position");
|
|
4556
4526
|
if (this.type === 1 && this.space != null) {
|
|
4557
|
-
throw new Error(
|
|
4558
|
-
"Error: Cannot move a static object once inside a Space"
|
|
4559
|
-
);
|
|
4527
|
+
throw new Error("Error: Cannot move a static object once inside a Space");
|
|
4560
4528
|
}
|
|
4561
4529
|
if (!(this.posx === pos.x && this.posy === pos.y)) {
|
|
4562
4530
|
this.posx = pos.x;
|
|
@@ -4571,9 +4539,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4571
4539
|
}
|
|
4572
4540
|
vel_invalidate(vel) {
|
|
4573
4541
|
if (this.type === 1) {
|
|
4574
|
-
throw new Error(
|
|
4575
|
-
"Error: Static body cannot have its velocity set."
|
|
4576
|
-
);
|
|
4542
|
+
throw new Error("Error: Static body cannot have its velocity set.");
|
|
4577
4543
|
}
|
|
4578
4544
|
this.velx = vel.x;
|
|
4579
4545
|
this.vely = vel.y;
|
|
@@ -4603,9 +4569,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4603
4569
|
}
|
|
4604
4570
|
force_invalidate(force) {
|
|
4605
4571
|
if (this.type !== 2) {
|
|
4606
|
-
throw new Error(
|
|
4607
|
-
"Error: Non-dynamic body cannot have force applied."
|
|
4608
|
-
);
|
|
4572
|
+
throw new Error("Error: Non-dynamic body cannot have force applied.");
|
|
4609
4573
|
}
|
|
4610
4574
|
this.forcex = force.x;
|
|
4611
4575
|
this.forcey = force.y;
|
|
@@ -4616,7 +4580,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4616
4580
|
this.wrap_force.zpp_inner.y = this.forcey;
|
|
4617
4581
|
}
|
|
4618
4582
|
// ---- Vec2 wrapper setup methods ----
|
|
4619
|
-
_setupVec2Wrapper(x, y,
|
|
4583
|
+
_setupVec2Wrapper(x, y, _invalidateFn, _validateFn) {
|
|
4620
4584
|
const nape46 = _ZPP_Body._nape;
|
|
4621
4585
|
if (x != x || y != y) {
|
|
4622
4586
|
throw new Error("Error: Vec2 components cannot be NaN");
|
|
@@ -4650,9 +4614,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4650
4614
|
ret.zpp_inner.outer = ret;
|
|
4651
4615
|
} else {
|
|
4652
4616
|
if (ret.zpp_disp) {
|
|
4653
|
-
throw new Error(
|
|
4654
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
4655
|
-
);
|
|
4617
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
4656
4618
|
}
|
|
4657
4619
|
const _this = ret.zpp_inner;
|
|
4658
4620
|
if (_this._immutable) {
|
|
@@ -4688,12 +4650,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4688
4650
|
return ret;
|
|
4689
4651
|
}
|
|
4690
4652
|
setupPosition() {
|
|
4691
|
-
this.wrap_pos = this._setupVec2Wrapper(
|
|
4692
|
-
this.posx,
|
|
4693
|
-
this.posy,
|
|
4694
|
-
null,
|
|
4695
|
-
null
|
|
4696
|
-
);
|
|
4653
|
+
this.wrap_pos = this._setupVec2Wrapper(this.posx, this.posy, null, null);
|
|
4697
4654
|
this.wrap_pos.zpp_inner._inuse = true;
|
|
4698
4655
|
if (this.world) {
|
|
4699
4656
|
this.wrap_pos.zpp_inner._immutable = true;
|
|
@@ -4703,12 +4660,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4703
4660
|
}
|
|
4704
4661
|
}
|
|
4705
4662
|
setupVelocity() {
|
|
4706
|
-
this.wrap_vel = this._setupVec2Wrapper(
|
|
4707
|
-
this.velx,
|
|
4708
|
-
this.vely,
|
|
4709
|
-
null,
|
|
4710
|
-
null
|
|
4711
|
-
);
|
|
4663
|
+
this.wrap_vel = this._setupVec2Wrapper(this.velx, this.vely, null, null);
|
|
4712
4664
|
this.wrap_vel.zpp_inner._inuse = true;
|
|
4713
4665
|
if (this.world) {
|
|
4714
4666
|
this.wrap_vel.zpp_inner._immutable = true;
|
|
@@ -4718,12 +4670,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4718
4670
|
}
|
|
4719
4671
|
}
|
|
4720
4672
|
setupkinvel() {
|
|
4721
|
-
this.wrap_kinvel = this._setupVec2Wrapper(
|
|
4722
|
-
this.kinvelx,
|
|
4723
|
-
this.kinvely,
|
|
4724
|
-
null,
|
|
4725
|
-
null
|
|
4726
|
-
);
|
|
4673
|
+
this.wrap_kinvel = this._setupVec2Wrapper(this.kinvelx, this.kinvely, null, null);
|
|
4727
4674
|
this.wrap_kinvel.zpp_inner._inuse = true;
|
|
4728
4675
|
if (this.world) {
|
|
4729
4676
|
this.wrap_kinvel.zpp_inner._immutable = true;
|
|
@@ -4733,12 +4680,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4733
4680
|
}
|
|
4734
4681
|
}
|
|
4735
4682
|
setupsvel() {
|
|
4736
|
-
this.wrap_svel = this._setupVec2Wrapper(
|
|
4737
|
-
this.svelx,
|
|
4738
|
-
this.svely,
|
|
4739
|
-
null,
|
|
4740
|
-
null
|
|
4741
|
-
);
|
|
4683
|
+
this.wrap_svel = this._setupVec2Wrapper(this.svelx, this.svely, null, null);
|
|
4742
4684
|
this.wrap_svel.zpp_inner._inuse = true;
|
|
4743
4685
|
if (this.world) {
|
|
4744
4686
|
this.wrap_svel.zpp_inner._immutable = true;
|
|
@@ -4748,12 +4690,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4748
4690
|
}
|
|
4749
4691
|
}
|
|
4750
4692
|
setupForce() {
|
|
4751
|
-
this.wrap_force = this._setupVec2Wrapper(
|
|
4752
|
-
this.forcex,
|
|
4753
|
-
this.forcey,
|
|
4754
|
-
null,
|
|
4755
|
-
null
|
|
4756
|
-
);
|
|
4693
|
+
this.wrap_force = this._setupVec2Wrapper(this.forcex, this.forcey, null, null);
|
|
4757
4694
|
this.wrap_force.zpp_inner._inuse = true;
|
|
4758
4695
|
if (this.world) {
|
|
4759
4696
|
this.wrap_force.zpp_inner._immutable = true;
|
|
@@ -4934,9 +4871,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4934
4871
|
}
|
|
4935
4872
|
validate_aabb() {
|
|
4936
4873
|
if (this.shapes.head == null) {
|
|
4937
|
-
throw new Error(
|
|
4938
|
-
"Error: Body bounds only makes sense if it contains shapes"
|
|
4939
|
-
);
|
|
4874
|
+
throw new Error("Error: Body bounds only makes sense if it contains shapes");
|
|
4940
4875
|
}
|
|
4941
4876
|
if (this.zip_aabb) {
|
|
4942
4877
|
this.zip_aabb = false;
|
|
@@ -5009,9 +4944,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5009
4944
|
}
|
|
5010
4945
|
}
|
|
5011
4946
|
if (poly.lverts.next == null) {
|
|
5012
|
-
throw new Error(
|
|
5013
|
-
"Error: An empty polygon has no meaningful bounds"
|
|
5014
|
-
);
|
|
4947
|
+
throw new Error("Error: An empty polygon has no meaningful bounds");
|
|
5015
4948
|
}
|
|
5016
4949
|
const p0 = poly.gverts.next;
|
|
5017
4950
|
poly.aabb.minx = p0.x;
|
|
@@ -5030,9 +4963,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5030
4963
|
}
|
|
5031
4964
|
aabb_validate() {
|
|
5032
4965
|
if (this.shapes.head == null) {
|
|
5033
|
-
throw new Error(
|
|
5034
|
-
"Error: bounds only makes sense when Body has shapes"
|
|
5035
|
-
);
|
|
4966
|
+
throw new Error("Error: bounds only makes sense when Body has shapes");
|
|
5036
4967
|
}
|
|
5037
4968
|
this.validate_aabb();
|
|
5038
4969
|
}
|
|
@@ -5046,9 +4977,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5046
4977
|
}
|
|
5047
4978
|
_computePolygonLocalCOM(poly) {
|
|
5048
4979
|
if (poly.lverts.next == null) {
|
|
5049
|
-
throw new Error(
|
|
5050
|
-
"Error: An empty polygon has no meaningful localCOM"
|
|
5051
|
-
);
|
|
4980
|
+
throw new Error("Error: An empty polygon has no meaningful localCOM");
|
|
5052
4981
|
}
|
|
5053
4982
|
if (poly.lverts.next.next == null) {
|
|
5054
4983
|
poly.localCOMx = poly.lverts.next.x;
|
|
@@ -5161,17 +5090,13 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5161
5090
|
}
|
|
5162
5091
|
getlocalCOM() {
|
|
5163
5092
|
if (this.shapes.head == null) {
|
|
5164
|
-
throw new Error(
|
|
5165
|
-
"Error: Body has no shapes so cannot compute its localCOM"
|
|
5166
|
-
);
|
|
5093
|
+
throw new Error("Error: Body has no shapes so cannot compute its localCOM");
|
|
5167
5094
|
}
|
|
5168
5095
|
this.validate_localCOM();
|
|
5169
5096
|
}
|
|
5170
5097
|
getworldCOM() {
|
|
5171
5098
|
if (this.shapes.head == null) {
|
|
5172
|
-
throw new Error(
|
|
5173
|
-
"Error: Body has no shapes so cannot compute its worldCOM"
|
|
5174
|
-
);
|
|
5099
|
+
throw new Error("Error: Body has no shapes so cannot compute its worldCOM");
|
|
5175
5100
|
}
|
|
5176
5101
|
this.validate_worldCOM();
|
|
5177
5102
|
}
|
|
@@ -5184,14 +5109,10 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5184
5109
|
// ---- Clear ----
|
|
5185
5110
|
clear() {
|
|
5186
5111
|
if (this.space != null) {
|
|
5187
|
-
throw new Error(
|
|
5188
|
-
"Error: Cannot clear a Body if it is currently being used by a Space!"
|
|
5189
|
-
);
|
|
5112
|
+
throw new Error("Error: Cannot clear a Body if it is currently being used by a Space!");
|
|
5190
5113
|
}
|
|
5191
5114
|
if (this.constraints.head != null) {
|
|
5192
|
-
throw new Error(
|
|
5193
|
-
"Error: Cannot clear a Body if it is currently being used by a constraint!"
|
|
5194
|
-
);
|
|
5115
|
+
throw new Error("Error: Cannot clear a Body if it is currently being used by a constraint!");
|
|
5195
5116
|
}
|
|
5196
5117
|
while (this.shapes.head != null) {
|
|
5197
5118
|
const s = this.shapes.pop_unsafe();
|
|
@@ -5285,15 +5206,13 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5285
5206
|
s.zpp_inner.body = null;
|
|
5286
5207
|
s.zpp_inner.removedFromBody();
|
|
5287
5208
|
}
|
|
5288
|
-
shapes_invalidate(
|
|
5209
|
+
shapes_invalidate(_param) {
|
|
5289
5210
|
this.invalidate_shapes();
|
|
5290
5211
|
}
|
|
5291
5212
|
shapes_modifiable() {
|
|
5292
5213
|
this.immutable_midstep("Body::shapes");
|
|
5293
5214
|
if (this.type === 1 && this.space != null) {
|
|
5294
|
-
throw new Error(
|
|
5295
|
-
"Error: Cannot modifiy shapes of static object once added to Space"
|
|
5296
|
-
);
|
|
5215
|
+
throw new Error("Error: Cannot modifiy shapes of static object once added to Space");
|
|
5297
5216
|
}
|
|
5298
5217
|
}
|
|
5299
5218
|
// ---- Space integration ----
|
|
@@ -82708,13 +82627,7 @@ var nape_compiled_default = _nape;
|
|
|
82708
82627
|
|
|
82709
82628
|
// src/util/NapeListFactory.ts
|
|
82710
82629
|
function createListClasses(spec) {
|
|
82711
|
-
const {
|
|
82712
|
-
typeName,
|
|
82713
|
-
namespaceParts,
|
|
82714
|
-
zppListClass,
|
|
82715
|
-
wrapElement,
|
|
82716
|
-
unwrapElement
|
|
82717
|
-
} = spec;
|
|
82630
|
+
const { typeName, namespaceParts, zppListClass, wrapElement, unwrapElement } = spec;
|
|
82718
82631
|
const nape46 = getNape();
|
|
82719
82632
|
const zpp = nape46.__zpp;
|
|
82720
82633
|
const getZPPListClass = () => zpp.util[zppListClass];
|
|
@@ -82731,9 +82644,7 @@ function createListClasses(spec) {
|
|
|
82731
82644
|
this.zpp_i = 0;
|
|
82732
82645
|
this.zpp_inner = null;
|
|
82733
82646
|
if (!getZPPListClass().internal) {
|
|
82734
|
-
throw new Error(
|
|
82735
|
-
"Error: Cannot instantiate " + typeName + "Iterator derp!"
|
|
82736
|
-
);
|
|
82647
|
+
throw new Error("Error: Cannot instantiate " + typeName + "Iterator derp!");
|
|
82737
82648
|
}
|
|
82738
82649
|
}
|
|
82739
82650
|
TypedIterator.__name__ = [...namespaceParts, typeName + "Iterator"];
|
|
@@ -83027,9 +82938,7 @@ function createListClasses(spec) {
|
|
|
83027
82938
|
while (it.hasNext()) {
|
|
83028
82939
|
const i = it.next();
|
|
83029
82940
|
if (deep) {
|
|
83030
|
-
throw new Error(
|
|
83031
|
-
"Error: " + typeName + " is not a copyable type"
|
|
83032
|
-
);
|
|
82941
|
+
throw new Error("Error: " + typeName + " is not a copyable type");
|
|
83033
82942
|
}
|
|
83034
82943
|
ret.push(i);
|
|
83035
82944
|
}
|
|
@@ -84253,9 +84162,7 @@ var _Mat23 = class _Mat23 {
|
|
|
84253
84162
|
throw new Error("Error: Cannot transform null Vec2");
|
|
84254
84163
|
}
|
|
84255
84164
|
if (this.singular()) {
|
|
84256
|
-
throw new Error(
|
|
84257
|
-
"Error: Matrix is singular and inverse transformation cannot be performed"
|
|
84258
|
-
);
|
|
84165
|
+
throw new Error("Error: Matrix is singular and inverse transformation cannot be performed");
|
|
84259
84166
|
}
|
|
84260
84167
|
const { a, b, c, d, tx: mtx, ty: mty } = this.zpp_inner;
|
|
84261
84168
|
const idet = 1 / (a * d - b * c);
|
|
@@ -85522,16 +85429,16 @@ var _GeomPoly = class _GeomPoly {
|
|
|
85522
85429
|
this._forEachVert((p) => {
|
|
85523
85430
|
const prev = p.prev;
|
|
85524
85431
|
const next = p.next;
|
|
85525
|
-
|
|
85526
|
-
|
|
85527
|
-
|
|
85528
|
-
|
|
85529
|
-
|
|
85530
|
-
|
|
85531
|
-
|
|
85532
|
-
|
|
85533
|
-
|
|
85534
|
-
|
|
85432
|
+
const ax = p.x - prev.x;
|
|
85433
|
+
const ay = p.y - prev.y;
|
|
85434
|
+
const bx = next.x - p.x;
|
|
85435
|
+
const by = next.y - p.y;
|
|
85436
|
+
const alen = Math.sqrt(ax * ax + ay * ay);
|
|
85437
|
+
const apx = -ay / alen * inflation;
|
|
85438
|
+
const apy = ax / alen * inflation;
|
|
85439
|
+
const blen = Math.sqrt(bx * bx + by * by);
|
|
85440
|
+
const bpx = -by / blen * inflation;
|
|
85441
|
+
const bpy = bx / blen * inflation;
|
|
85535
85442
|
const bapx = bpx - apx;
|
|
85536
85443
|
const bapy = bpy - apy;
|
|
85537
85444
|
const num = by * bapx - bx * bapy;
|
|
@@ -85767,9 +85674,7 @@ var MarchingSquares = class {
|
|
|
85767
85674
|
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
85768
85675
|
}
|
|
85769
85676
|
if (iso == null) {
|
|
85770
|
-
throw new Error(
|
|
85771
|
-
"Error: MarchingSquares requires an iso function to operate"
|
|
85772
|
-
);
|
|
85677
|
+
throw new Error("Error: MarchingSquares requires an iso function to operate");
|
|
85773
85678
|
}
|
|
85774
85679
|
if (bounds == null) {
|
|
85775
85680
|
throw new Error(
|
|
@@ -85786,9 +85691,7 @@ var MarchingSquares = class {
|
|
|
85786
85691
|
cellZpp._validate();
|
|
85787
85692
|
}
|
|
85788
85693
|
if (cellZpp.x <= 0 || cellZpp.y <= 0) {
|
|
85789
|
-
throw new Error(
|
|
85790
|
-
"Error: MarchingSquares cannot operate with non-positive cell dimensions"
|
|
85791
|
-
);
|
|
85694
|
+
throw new Error("Error: MarchingSquares cannot operate with non-positive cell dimensions");
|
|
85792
85695
|
}
|
|
85793
85696
|
if (quality < 0) {
|
|
85794
85697
|
throw new Error(
|
|
@@ -85801,9 +85704,7 @@ var MarchingSquares = class {
|
|
|
85801
85704
|
subZpp._validate();
|
|
85802
85705
|
}
|
|
85803
85706
|
if (subZpp.x <= 0 || subZpp.y <= 0) {
|
|
85804
|
-
throw new Error(
|
|
85805
|
-
"Error: MarchingSquares cannot with non-positive sub-grid dimensions"
|
|
85806
|
-
);
|
|
85707
|
+
throw new Error("Error: MarchingSquares cannot with non-positive sub-grid dimensions");
|
|
85807
85708
|
}
|
|
85808
85709
|
}
|
|
85809
85710
|
const nape46 = getNape();
|
|
@@ -85873,9 +85774,7 @@ var Ray = class _Ray {
|
|
|
85873
85774
|
// Static factories
|
|
85874
85775
|
// ---------------------------------------------------------------------------
|
|
85875
85776
|
static fromSegment(start, end) {
|
|
85876
|
-
return _Ray._wrap(
|
|
85877
|
-
getNape().geom.Ray.fromSegment(start._inner, end._inner)
|
|
85878
|
-
);
|
|
85777
|
+
return _Ray._wrap(getNape().geom.Ray.fromSegment(start._inner, end._inner));
|
|
85879
85778
|
}
|
|
85880
85779
|
// ---------------------------------------------------------------------------
|
|
85881
85780
|
// Properties
|
|
@@ -85974,9 +85873,7 @@ var _ConvexResult = class _ConvexResult {
|
|
|
85974
85873
|
/** @internal */
|
|
85975
85874
|
_disposed() {
|
|
85976
85875
|
if (this.zpp_inner.next != null) {
|
|
85977
|
-
throw new Error(
|
|
85978
|
-
"Error: This object has been disposed of and cannot be used"
|
|
85979
|
-
);
|
|
85876
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
85980
85877
|
}
|
|
85981
85878
|
}
|
|
85982
85879
|
};
|
|
@@ -86046,9 +85943,7 @@ var _RayResult = class _RayResult {
|
|
|
86046
85943
|
/** @internal */
|
|
86047
85944
|
_disposed() {
|
|
86048
85945
|
if (this.zpp_inner.next != null) {
|
|
86049
|
-
throw new Error(
|
|
86050
|
-
"Error: This object has been disposed of and cannot be used"
|
|
86051
|
-
);
|
|
85946
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
86052
85947
|
}
|
|
86053
85948
|
}
|
|
86054
85949
|
};
|
|
@@ -86233,9 +86128,7 @@ var _Material = class _Material {
|
|
|
86233
86128
|
throw new Error("Error: Material::dynamicFriction cannot be negative");
|
|
86234
86129
|
}
|
|
86235
86130
|
zpp.dynamicFriction = dynamicFriction;
|
|
86236
|
-
zpp.invalidate(
|
|
86237
|
-
ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS
|
|
86238
|
-
);
|
|
86131
|
+
zpp.invalidate(ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS);
|
|
86239
86132
|
}
|
|
86240
86133
|
if (staticFriction !== zpp.staticFriction) {
|
|
86241
86134
|
if (staticFriction !== staticFriction) {
|
|
@@ -86312,9 +86205,7 @@ var _Material = class _Material {
|
|
|
86312
86205
|
throw new Error("Error: Material::dynamicFriction cannot be negative");
|
|
86313
86206
|
}
|
|
86314
86207
|
this.zpp_inner.dynamicFriction = value;
|
|
86315
|
-
this.zpp_inner.invalidate(
|
|
86316
|
-
ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS
|
|
86317
|
-
);
|
|
86208
|
+
this.zpp_inner.invalidate(ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS);
|
|
86318
86209
|
}
|
|
86319
86210
|
}
|
|
86320
86211
|
get staticFriction() {
|
|
@@ -86457,9 +86348,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86457
86348
|
throw new Error("Error: FluidProperties::viscosity cannot be NaN");
|
|
86458
86349
|
}
|
|
86459
86350
|
if (viscosity < 0) {
|
|
86460
|
-
throw new Error(
|
|
86461
|
-
"Error: FluidProperties::viscosity (" + viscosity + ") must be >= 0"
|
|
86462
|
-
);
|
|
86351
|
+
throw new Error("Error: FluidProperties::viscosity (" + viscosity + ") must be >= 0");
|
|
86463
86352
|
}
|
|
86464
86353
|
zpp.viscosity = viscosity / 1;
|
|
86465
86354
|
zpp.invalidate();
|
|
@@ -86506,9 +86395,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86506
86395
|
throw new Error("Error: FluidProperties::viscosity cannot be NaN");
|
|
86507
86396
|
}
|
|
86508
86397
|
if (value < 0) {
|
|
86509
|
-
throw new Error(
|
|
86510
|
-
"Error: FluidProperties::viscosity (" + value + ") must be >= 0"
|
|
86511
|
-
);
|
|
86398
|
+
throw new Error("Error: FluidProperties::viscosity (" + value + ") must be >= 0");
|
|
86512
86399
|
}
|
|
86513
86400
|
this.zpp_inner.viscosity = value / 1;
|
|
86514
86401
|
this.zpp_inner.invalidate();
|
|
@@ -86703,10 +86590,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86703
86590
|
copy() {
|
|
86704
86591
|
const napeNs = getNape();
|
|
86705
86592
|
const zpp_nape = napeNs.zpp_nape;
|
|
86706
|
-
const ret = new _FluidProperties(
|
|
86707
|
-
this.zpp_inner.density * 1e3,
|
|
86708
|
-
this.zpp_inner.viscosity
|
|
86709
|
-
);
|
|
86593
|
+
const ret = new _FluidProperties(this.zpp_inner.density * 1e3, this.zpp_inner.viscosity);
|
|
86710
86594
|
if (this.zpp_inner.userData != null) {
|
|
86711
86595
|
ret.zpp_inner.userData = { ...this.zpp_inner.userData };
|
|
86712
86596
|
}
|
|
@@ -87218,10 +87102,8 @@ var Interactor = class _Interactor {
|
|
|
87218
87102
|
if (!inner) return null;
|
|
87219
87103
|
if (inner instanceof _Interactor) return inner;
|
|
87220
87104
|
if (inner.isBody && inner.isBody() && _bodyWrap) return _bodyWrap(inner);
|
|
87221
|
-
if (inner.isShape && inner.isShape() && _shapeWrap)
|
|
87222
|
-
|
|
87223
|
-
if (inner.isCompound && inner.isCompound() && _compoundWrap)
|
|
87224
|
-
return _compoundWrap(inner);
|
|
87105
|
+
if (inner.isShape && inner.isShape() && _shapeWrap) return _shapeWrap(inner);
|
|
87106
|
+
if (inner.isCompound && inner.isCompound() && _compoundWrap) return _compoundWrap(inner);
|
|
87225
87107
|
return getOrCreate(inner, (raw) => {
|
|
87226
87108
|
const i = Object.create(_Interactor.prototype);
|
|
87227
87109
|
i._inner = raw;
|
|
@@ -87762,15 +87644,7 @@ var _Listener = class _Listener {
|
|
|
87762
87644
|
}
|
|
87763
87645
|
}
|
|
87764
87646
|
toString() {
|
|
87765
|
-
const eventNames = [
|
|
87766
|
-
"BEGIN",
|
|
87767
|
-
"END",
|
|
87768
|
-
"WAKE",
|
|
87769
|
-
"SLEEP",
|
|
87770
|
-
"BREAK",
|
|
87771
|
-
"PRE",
|
|
87772
|
-
"ONGOING"
|
|
87773
|
-
];
|
|
87647
|
+
const eventNames = ["BEGIN", "END", "WAKE", "SLEEP", "BREAK", "PRE", "ONGOING"];
|
|
87774
87648
|
const event = eventNames[this.zpp_inner.event];
|
|
87775
87649
|
if (this.zpp_inner.type == 0) {
|
|
87776
87650
|
const body = this.zpp_inner.body;
|
|
@@ -88388,10 +88262,7 @@ var _Body = class _Body extends Interactor {
|
|
|
88388
88262
|
get_arbiters() {
|
|
88389
88263
|
const zppNs = getNape().__zpp;
|
|
88390
88264
|
if (this.zpp_inner.wrap_arbiters == null) {
|
|
88391
|
-
this.zpp_inner.wrap_arbiters = zppNs.util.ZPP_ArbiterList.get(
|
|
88392
|
-
this.zpp_inner.arbiters,
|
|
88393
|
-
true
|
|
88394
|
-
);
|
|
88265
|
+
this.zpp_inner.wrap_arbiters = zppNs.util.ZPP_ArbiterList.get(this.zpp_inner.arbiters, true);
|
|
88395
88266
|
}
|
|
88396
88267
|
return this.zpp_inner.wrap_arbiters;
|
|
88397
88268
|
}
|
|
@@ -88607,9 +88478,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88607
88478
|
/** Recursively visit all bodies in this compound and its sub-compounds. */
|
|
88608
88479
|
visitBodies(lambda) {
|
|
88609
88480
|
if (lambda == null) {
|
|
88610
|
-
throw new Error(
|
|
88611
|
-
"Error: lambda cannot be null for Compound::visitBodies"
|
|
88612
|
-
);
|
|
88481
|
+
throw new Error("Error: lambda cannot be null for Compound::visitBodies");
|
|
88613
88482
|
}
|
|
88614
88483
|
const bodies = this.zpp_inner.wrap_bodies;
|
|
88615
88484
|
const bLen = bodies.get_length();
|
|
@@ -88625,9 +88494,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88625
88494
|
/** Recursively visit all constraints in this compound and its sub-compounds. */
|
|
88626
88495
|
visitConstraints(lambda) {
|
|
88627
88496
|
if (lambda == null) {
|
|
88628
|
-
throw new Error(
|
|
88629
|
-
"Error: lambda cannot be null for Compound::visitConstraints"
|
|
88630
|
-
);
|
|
88497
|
+
throw new Error("Error: lambda cannot be null for Compound::visitConstraints");
|
|
88631
88498
|
}
|
|
88632
88499
|
const constraints = this.zpp_inner.wrap_constraints;
|
|
88633
88500
|
const cLen = constraints.get_length();
|
|
@@ -88643,9 +88510,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88643
88510
|
/** Recursively visit all sub-compounds in this compound. */
|
|
88644
88511
|
visitCompounds(lambda) {
|
|
88645
88512
|
if (lambda == null) {
|
|
88646
|
-
throw new Error(
|
|
88647
|
-
"Error: lambda cannot be null for Compound::visitConstraints"
|
|
88648
|
-
);
|
|
88513
|
+
throw new Error("Error: lambda cannot be null for Compound::visitConstraints");
|
|
88649
88514
|
}
|
|
88650
88515
|
const compounds = this.zpp_inner.wrap_compounds;
|
|
88651
88516
|
const compLen = compounds.get_length();
|
|
@@ -88695,9 +88560,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88695
88560
|
/** Translate all bodies in this compound by the given vector. */
|
|
88696
88561
|
translate(translation) {
|
|
88697
88562
|
if (translation != null && translation.zpp_disp) {
|
|
88698
|
-
throw new Error(
|
|
88699
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
88700
|
-
);
|
|
88563
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
88701
88564
|
}
|
|
88702
88565
|
if (translation == null) {
|
|
88703
88566
|
throw new Error("Error: Cannot translate by null Vec2");
|
|
@@ -88719,9 +88582,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88719
88582
|
/** Rotate all bodies in this compound around the given centre point. */
|
|
88720
88583
|
rotate(centre, angle) {
|
|
88721
88584
|
if (centre != null && centre.zpp_disp) {
|
|
88722
|
-
throw new Error(
|
|
88723
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
88724
|
-
);
|
|
88585
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
88725
88586
|
}
|
|
88726
88587
|
if (centre == null) {
|
|
88727
88588
|
throw new Error("Error: Cannot rotate about a null Vec2");
|
|
@@ -89345,7 +89206,7 @@ var Arbiter = class {
|
|
|
89345
89206
|
* Total impulse of this arbiter. Base implementation returns Vec3(0,0,0).
|
|
89346
89207
|
* Overridden by CollisionArbiter and FluidArbiter.
|
|
89347
89208
|
*/
|
|
89348
|
-
totalImpulse(body = null,
|
|
89209
|
+
totalImpulse(body = null, _freshOnly = false) {
|
|
89349
89210
|
this._activeCheck();
|
|
89350
89211
|
if (body != null) {
|
|
89351
89212
|
this._checkBody(body);
|
|
@@ -89469,9 +89330,7 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89469
89330
|
throw new Error("Error: CollisionArbiter::elasticity cannot be NaN");
|
|
89470
89331
|
}
|
|
89471
89332
|
if (value < 0) {
|
|
89472
|
-
throw new Error(
|
|
89473
|
-
"Error: CollisionArbiter::elasticity cannot be negative"
|
|
89474
|
-
);
|
|
89333
|
+
throw new Error("Error: CollisionArbiter::elasticity cannot be negative");
|
|
89475
89334
|
}
|
|
89476
89335
|
this.zpp_inner.colarb.restitution = value;
|
|
89477
89336
|
this.zpp_inner.colarb.userdef_restitution = true;
|
|
@@ -89487,14 +89346,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89487
89346
|
set dynamicFriction(value) {
|
|
89488
89347
|
this._mutableCheck("dynamicFriction");
|
|
89489
89348
|
if (value !== value) {
|
|
89490
|
-
throw new Error(
|
|
89491
|
-
"Error: CollisionArbiter::dynamicFriction cannot be NaN"
|
|
89492
|
-
);
|
|
89349
|
+
throw new Error("Error: CollisionArbiter::dynamicFriction cannot be NaN");
|
|
89493
89350
|
}
|
|
89494
89351
|
if (value < 0) {
|
|
89495
|
-
throw new Error(
|
|
89496
|
-
"Error: CollisionArbiter::dynamicFriction cannot be negative"
|
|
89497
|
-
);
|
|
89352
|
+
throw new Error("Error: CollisionArbiter::dynamicFriction cannot be negative");
|
|
89498
89353
|
}
|
|
89499
89354
|
this.zpp_inner.colarb.dyn_fric = value;
|
|
89500
89355
|
this.zpp_inner.colarb.userdef_dyn_fric = true;
|
|
@@ -89510,14 +89365,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89510
89365
|
set staticFriction(value) {
|
|
89511
89366
|
this._mutableCheck("staticFriction");
|
|
89512
89367
|
if (value !== value) {
|
|
89513
|
-
throw new Error(
|
|
89514
|
-
"Error: CollisionArbiter::staticFriction cannot be NaN"
|
|
89515
|
-
);
|
|
89368
|
+
throw new Error("Error: CollisionArbiter::staticFriction cannot be NaN");
|
|
89516
89369
|
}
|
|
89517
89370
|
if (value < 0) {
|
|
89518
|
-
throw new Error(
|
|
89519
|
-
"Error: CollisionArbiter::staticFriction cannot be negative"
|
|
89520
|
-
);
|
|
89371
|
+
throw new Error("Error: CollisionArbiter::staticFriction cannot be negative");
|
|
89521
89372
|
}
|
|
89522
89373
|
this.zpp_inner.colarb.stat_fric = value;
|
|
89523
89374
|
this.zpp_inner.colarb.userdef_stat_fric = true;
|
|
@@ -89533,14 +89384,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89533
89384
|
set rollingFriction(value) {
|
|
89534
89385
|
this._mutableCheck("rollingFriction");
|
|
89535
89386
|
if (value !== value) {
|
|
89536
|
-
throw new Error(
|
|
89537
|
-
"Error: CollisionArbiter::rollingFriction cannot be NaN"
|
|
89538
|
-
);
|
|
89387
|
+
throw new Error("Error: CollisionArbiter::rollingFriction cannot be NaN");
|
|
89539
89388
|
}
|
|
89540
89389
|
if (value < 0) {
|
|
89541
|
-
throw new Error(
|
|
89542
|
-
"Error: CollisionArbiter::rollingFriction cannot be negative"
|
|
89543
|
-
);
|
|
89390
|
+
throw new Error("Error: CollisionArbiter::rollingFriction cannot be negative");
|
|
89544
89391
|
}
|
|
89545
89392
|
this.zpp_inner.colarb.rfric = value;
|
|
89546
89393
|
this.zpp_inner.colarb.userdef_rfric = true;
|
|
@@ -89631,9 +89478,7 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89631
89478
|
/** @internal Throw if not in pre-handler mutable window. */
|
|
89632
89479
|
_mutableCheck(prop) {
|
|
89633
89480
|
if (!this.zpp_inner.colarb.mutable) {
|
|
89634
|
-
throw new Error(
|
|
89635
|
-
"Error: CollisionArbiter::" + prop + " is only mutable during a pre-handler"
|
|
89636
|
-
);
|
|
89481
|
+
throw new Error("Error: CollisionArbiter::" + prop + " is only mutable during a pre-handler");
|
|
89637
89482
|
}
|
|
89638
89483
|
}
|
|
89639
89484
|
/** @internal Accumulate impulse from contacts. */
|
|
@@ -89693,9 +89538,7 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89693
89538
|
}
|
|
89694
89539
|
set position(value) {
|
|
89695
89540
|
if (!this.zpp_inner.fluidarb.mutable) {
|
|
89696
|
-
throw new Error(
|
|
89697
|
-
"Error: Arbiter is mutable only within a pre-handler"
|
|
89698
|
-
);
|
|
89541
|
+
throw new Error("Error: Arbiter is mutable only within a pre-handler");
|
|
89699
89542
|
}
|
|
89700
89543
|
if (value == null) {
|
|
89701
89544
|
throw new Error("Error: FluidArbiter::position cannot be null");
|
|
@@ -89714,17 +89557,13 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89714
89557
|
}
|
|
89715
89558
|
set overlap(value) {
|
|
89716
89559
|
if (!this.zpp_inner.fluidarb.mutable) {
|
|
89717
|
-
throw new Error(
|
|
89718
|
-
"Error: Arbiter is mutable only within a pre-handler"
|
|
89719
|
-
);
|
|
89560
|
+
throw new Error("Error: Arbiter is mutable only within a pre-handler");
|
|
89720
89561
|
}
|
|
89721
89562
|
if (value !== value) {
|
|
89722
89563
|
throw new Error("Error: FluidArbiter::overlap cannot be NaN");
|
|
89723
89564
|
}
|
|
89724
89565
|
if (value <= 0 || value == Infinity) {
|
|
89725
|
-
throw new Error(
|
|
89726
|
-
"Error: FluidArbiter::overlap must be strictly positive and non infinite"
|
|
89727
|
-
);
|
|
89566
|
+
throw new Error("Error: FluidArbiter::overlap must be strictly positive and non infinite");
|
|
89728
89567
|
}
|
|
89729
89568
|
this.zpp_inner.fluidarb.overlap = value;
|
|
89730
89569
|
}
|
|
@@ -89739,17 +89578,9 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89739
89578
|
if (body == null) {
|
|
89740
89579
|
return Vec3.get(farb.buoyx, farb.buoyy, 0);
|
|
89741
89580
|
} else if (body.zpp_inner == this.zpp_inner.b2) {
|
|
89742
|
-
return Vec3.get(
|
|
89743
|
-
farb.buoyx,
|
|
89744
|
-
farb.buoyy,
|
|
89745
|
-
farb.buoyy * farb.r2x - farb.buoyx * farb.r2y
|
|
89746
|
-
);
|
|
89581
|
+
return Vec3.get(farb.buoyx, farb.buoyy, farb.buoyy * farb.r2x - farb.buoyx * farb.r2y);
|
|
89747
89582
|
} else {
|
|
89748
|
-
return Vec3.get(
|
|
89749
|
-
-farb.buoyx,
|
|
89750
|
-
-farb.buoyy,
|
|
89751
|
-
-(farb.buoyy * farb.r1x - farb.buoyx * farb.r1y)
|
|
89752
|
-
);
|
|
89583
|
+
return Vec3.get(-farb.buoyx, -farb.buoyy, -(farb.buoyy * farb.r1x - farb.buoyx * farb.r1y));
|
|
89753
89584
|
}
|
|
89754
89585
|
}
|
|
89755
89586
|
/** Drag impulse applied by this fluid arbiter. */
|
|
@@ -89758,14 +89589,10 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89758
89589
|
if (body != null) this._checkBody(body);
|
|
89759
89590
|
const farb = this.zpp_inner.fluidarb;
|
|
89760
89591
|
const scale = body == null || body.zpp_inner == this.zpp_inner.b2 ? 1 : -1;
|
|
89761
|
-
return Vec3.get(
|
|
89762
|
-
farb.dampx * scale,
|
|
89763
|
-
farb.dampy * scale,
|
|
89764
|
-
farb.adamp * scale
|
|
89765
|
-
);
|
|
89592
|
+
return Vec3.get(farb.dampx * scale, farb.dampy * scale, farb.adamp * scale);
|
|
89766
89593
|
}
|
|
89767
89594
|
/** Total impulse (buoyancy + drag). */
|
|
89768
|
-
totalImpulse(body = null,
|
|
89595
|
+
totalImpulse(body = null, _freshOnly = false) {
|
|
89769
89596
|
this._activeCheck();
|
|
89770
89597
|
if (body != null) this._checkBody(body);
|
|
89771
89598
|
const buoy = this.buoyancyImpulse(body);
|
|
@@ -89937,11 +89764,7 @@ var Contact = class {
|
|
|
89937
89764
|
const jx = colarb.nx * jnAcc - colarb.ny * jtAcc;
|
|
89938
89765
|
const jy = colarb.ny * jnAcc + colarb.nx * jtAcc;
|
|
89939
89766
|
if (body == colarb.b1.outer) {
|
|
89940
|
-
return Vec3.get(
|
|
89941
|
-
-jx,
|
|
89942
|
-
-jy,
|
|
89943
|
-
-(jy * cin.r1x - jx * cin.r1y) - jrAcc
|
|
89944
|
-
);
|
|
89767
|
+
return Vec3.get(-jx, -jy, -(jy * cin.r1x - jx * cin.r1y) - jrAcc);
|
|
89945
89768
|
}
|
|
89946
89769
|
return Vec3.get(jx, jy, jy * cin.r2x - jx * cin.r2y + jrAcc);
|
|
89947
89770
|
}
|
|
@@ -90329,7 +90152,7 @@ var BodyListener = class extends Listener {
|
|
|
90329
90152
|
if (handler == null) {
|
|
90330
90153
|
throw new Error("Error: BodyListener::handler cannot be null");
|
|
90331
90154
|
}
|
|
90332
|
-
let xevent
|
|
90155
|
+
let xevent;
|
|
90333
90156
|
if (event === CbEvent.WAKE) {
|
|
90334
90157
|
xevent = 2;
|
|
90335
90158
|
} else if (event === CbEvent.SLEEP) {
|
|
@@ -90339,11 +90162,7 @@ var BodyListener = class extends Listener {
|
|
|
90339
90162
|
"Error: cbEvent '" + event.toString() + "' is not a valid event type for a BodyListener"
|
|
90340
90163
|
);
|
|
90341
90164
|
}
|
|
90342
|
-
this.zpp_inner_zn = new ZPP_BodyListener(
|
|
90343
|
-
ZPP_OptionType.argument(options),
|
|
90344
|
-
xevent,
|
|
90345
|
-
handler
|
|
90346
|
-
);
|
|
90165
|
+
this.zpp_inner_zn = new ZPP_BodyListener(ZPP_OptionType.argument(options), xevent, handler);
|
|
90347
90166
|
this.zpp_inner = this.zpp_inner_zn;
|
|
90348
90167
|
this.zpp_inner.outer = this;
|
|
90349
90168
|
this.zpp_inner_zn.outer_zn = this;
|
|
@@ -90393,11 +90212,9 @@ var InteractionListener = class extends Listener {
|
|
|
90393
90212
|
throw new Error("Error: InteractionListener::handler cannot be null");
|
|
90394
90213
|
}
|
|
90395
90214
|
if (event == null) {
|
|
90396
|
-
throw new Error(
|
|
90397
|
-
"Error: CbEvent cannot be null for InteractionListener"
|
|
90398
|
-
);
|
|
90215
|
+
throw new Error("Error: CbEvent cannot be null for InteractionListener");
|
|
90399
90216
|
}
|
|
90400
|
-
let xevent
|
|
90217
|
+
let xevent;
|
|
90401
90218
|
if (event === CbEvent.BEGIN) {
|
|
90402
90219
|
xevent = 0;
|
|
90403
90220
|
} else if (event === CbEvent.END) {
|
|
@@ -90422,9 +90239,7 @@ var InteractionListener = class extends Listener {
|
|
|
90422
90239
|
this.zpp_inner.precedence = precedence;
|
|
90423
90240
|
this.zpp_inner_zn.handleri = handler;
|
|
90424
90241
|
if (interactionType == null) {
|
|
90425
|
-
throw new Error(
|
|
90426
|
-
"Error: Cannot set listener interaction type to null"
|
|
90427
|
-
);
|
|
90242
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90428
90243
|
}
|
|
90429
90244
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90430
90245
|
if (currentType != interactionType) {
|
|
@@ -90457,9 +90272,7 @@ var InteractionListener = class extends Listener {
|
|
|
90457
90272
|
}
|
|
90458
90273
|
set interactionType(interactionType) {
|
|
90459
90274
|
if (interactionType == null) {
|
|
90460
|
-
throw new Error(
|
|
90461
|
-
"Error: Cannot set listener interaction type to null"
|
|
90462
|
-
);
|
|
90275
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90463
90276
|
}
|
|
90464
90277
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90465
90278
|
if (currentType != interactionType) {
|
|
@@ -90487,7 +90300,7 @@ var ConstraintListener = class extends Listener {
|
|
|
90487
90300
|
if (handler == null) {
|
|
90488
90301
|
throw new Error("Error: ConstraintListener::handler cannot be null");
|
|
90489
90302
|
}
|
|
90490
|
-
let xevent
|
|
90303
|
+
let xevent;
|
|
90491
90304
|
if (event === CbEvent.WAKE) {
|
|
90492
90305
|
xevent = 2;
|
|
90493
90306
|
} else if (event === CbEvent.SLEEP) {
|
|
@@ -90554,9 +90367,7 @@ var PreListener = class extends Listener {
|
|
|
90554
90367
|
this.zpp_inner_zn.pure = pure;
|
|
90555
90368
|
this.zpp_inner_zn.handlerp = handler;
|
|
90556
90369
|
if (interactionType == null) {
|
|
90557
|
-
throw new Error(
|
|
90558
|
-
"Error: Cannot set listener interaction type to null"
|
|
90559
|
-
);
|
|
90370
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90560
90371
|
}
|
|
90561
90372
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90562
90373
|
if (currentType != interactionType) {
|
|
@@ -90599,9 +90410,7 @@ var PreListener = class extends Listener {
|
|
|
90599
90410
|
}
|
|
90600
90411
|
set interactionType(interactionType) {
|
|
90601
90412
|
if (interactionType == null) {
|
|
90602
|
-
throw new Error(
|
|
90603
|
-
"Error: Cannot set listener interaction type to null"
|
|
90604
|
-
);
|
|
90413
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90605
90414
|
}
|
|
90606
90415
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90607
90416
|
if (currentType != interactionType) {
|
|
@@ -91200,7 +91009,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
|
|
|
91200
91009
|
};
|
|
91201
91010
|
|
|
91202
91011
|
// src/index.ts
|
|
91203
|
-
var VERSION = "3.3.
|
|
91012
|
+
var VERSION = "3.3.16";
|
|
91204
91013
|
export {
|
|
91205
91014
|
AABB,
|
|
91206
91015
|
AngleJoint,
|