@newkrok/nape-js 3.3.16 → 3.3.18
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.cjs
CHANGED
|
@@ -1825,10 +1825,8 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
set(options) {
|
|
1827
1827
|
if (options != this) {
|
|
1828
|
-
while (this.includes.head != null)
|
|
1829
|
-
|
|
1830
|
-
while (this.excludes.head != null)
|
|
1831
|
-
this.append_type(this.includes, this.excludes.head.elt);
|
|
1828
|
+
while (this.includes.head != null) this.append_type(this.excludes, this.includes.head.elt);
|
|
1829
|
+
while (this.excludes.head != null) this.append_type(this.includes, this.excludes.head.elt);
|
|
1832
1830
|
let cx_ite = options.excludes.head;
|
|
1833
1831
|
while (cx_ite != null) {
|
|
1834
1832
|
const i = cx_ite.elt;
|
|
@@ -1847,9 +1845,7 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1847
1845
|
append(list, val) {
|
|
1848
1846
|
const napeNs = _ZPP_OptionType._nape;
|
|
1849
1847
|
if (val == null) {
|
|
1850
|
-
throw new Error(
|
|
1851
|
-
"Error: Cannot append null, only CbType and CbType list values"
|
|
1852
|
-
);
|
|
1848
|
+
throw new Error("Error: Cannot append null, only CbType and CbType list values");
|
|
1853
1849
|
}
|
|
1854
1850
|
if (val instanceof napeNs.callbacks.CbType) {
|
|
1855
1851
|
const cb = val;
|
|
@@ -1889,17 +1885,13 @@ var _ZPP_OptionType = class _ZPP_OptionType {
|
|
|
1889
1885
|
const cb2 = cbs1[_g1];
|
|
1890
1886
|
++_g1;
|
|
1891
1887
|
if (!(cb2 instanceof napeNs.callbacks.CbType)) {
|
|
1892
|
-
throw new Error(
|
|
1893
|
-
"Error: Cannot append non-CbType or CbType list value"
|
|
1894
|
-
);
|
|
1888
|
+
throw new Error("Error: Cannot append non-CbType or CbType list value");
|
|
1895
1889
|
}
|
|
1896
1890
|
const cbx = cb2;
|
|
1897
1891
|
this.append_type(list, cbx.zpp_inner);
|
|
1898
1892
|
}
|
|
1899
1893
|
} else {
|
|
1900
|
-
throw new Error(
|
|
1901
|
-
"Error: Cannot append non-CbType or CbType list value"
|
|
1902
|
-
);
|
|
1894
|
+
throw new Error("Error: Cannot append non-CbType or CbType list value");
|
|
1903
1895
|
}
|
|
1904
1896
|
}
|
|
1905
1897
|
};
|
|
@@ -1979,10 +1971,7 @@ var _ZPP_Callback = class _ZPP_Callback {
|
|
|
1979
1971
|
this.outer_int.zpp_inner = this;
|
|
1980
1972
|
}
|
|
1981
1973
|
if (this.wrap_arbiters == null) {
|
|
1982
|
-
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(
|
|
1983
|
-
this.set.arbiters,
|
|
1984
|
-
true
|
|
1985
|
-
);
|
|
1974
|
+
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(this.set.arbiters, true);
|
|
1986
1975
|
} else {
|
|
1987
1976
|
this.wrap_arbiters.zpp_inner.inner = this.set.arbiters;
|
|
1988
1977
|
}
|
|
@@ -2105,10 +2094,7 @@ var _ZPP_Callback = class _ZPP_Callback {
|
|
|
2105
2094
|
genarbs() {
|
|
2106
2095
|
const zpp = _ZPP_Callback._zpp;
|
|
2107
2096
|
if (this.wrap_arbiters == null) {
|
|
2108
|
-
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(
|
|
2109
|
-
this.set.arbiters,
|
|
2110
|
-
true
|
|
2111
|
-
);
|
|
2097
|
+
this.wrap_arbiters = zpp.util.ZPP_ArbiterList.get(this.set.arbiters, true);
|
|
2112
2098
|
} else {
|
|
2113
2099
|
this.wrap_arbiters.zpp_inner.inner = this.set.arbiters;
|
|
2114
2100
|
}
|
|
@@ -2392,9 +2378,7 @@ var _ZPP_BodyListener = class _ZPP_BodyListener extends ZPP_Listener {
|
|
|
2392
2378
|
}
|
|
2393
2379
|
immutable_options() {
|
|
2394
2380
|
if (this.space != null && this.space.midstep) {
|
|
2395
|
-
throw new Error(
|
|
2396
|
-
"Error: Cannot change listener type options during space.step()"
|
|
2397
|
-
);
|
|
2381
|
+
throw new Error("Error: Cannot change listener type options during space.step()");
|
|
2398
2382
|
}
|
|
2399
2383
|
}
|
|
2400
2384
|
addedToSpace() {
|
|
@@ -2481,9 +2465,7 @@ var _ZPP_BodyListener = class _ZPP_BodyListener extends ZPP_Listener {
|
|
|
2481
2465
|
}
|
|
2482
2466
|
swapEvent(newev) {
|
|
2483
2467
|
if (newev != 2 && newev != 3) {
|
|
2484
|
-
throw new Error(
|
|
2485
|
-
"Error: BodyListener event must be either WAKE or SLEEP only"
|
|
2486
|
-
);
|
|
2468
|
+
throw new Error("Error: BodyListener event must be either WAKE or SLEEP only");
|
|
2487
2469
|
}
|
|
2488
2470
|
this.removedFromSpace();
|
|
2489
2471
|
this.event = newev;
|
|
@@ -2509,9 +2491,7 @@ var _ZPP_ConstraintListener = class _ZPP_ConstraintListener extends ZPP_Listener
|
|
|
2509
2491
|
}
|
|
2510
2492
|
immutable_options() {
|
|
2511
2493
|
if (this.space != null && this.space.midstep) {
|
|
2512
|
-
throw new Error(
|
|
2513
|
-
"Error: Cannot change listener type options during space.step()"
|
|
2514
|
-
);
|
|
2494
|
+
throw new Error("Error: Cannot change listener type options during space.step()");
|
|
2515
2495
|
}
|
|
2516
2496
|
}
|
|
2517
2497
|
addedToSpace() {
|
|
@@ -2598,9 +2578,7 @@ var _ZPP_ConstraintListener = class _ZPP_ConstraintListener extends ZPP_Listener
|
|
|
2598
2578
|
}
|
|
2599
2579
|
swapEvent(newev) {
|
|
2600
2580
|
if (newev != 2 && newev != 3 && newev != 4) {
|
|
2601
|
-
throw new Error(
|
|
2602
|
-
"Error: ConstraintListener event must be either WAKE or SLEEP only"
|
|
2603
|
-
);
|
|
2581
|
+
throw new Error("Error: ConstraintListener event must be either WAKE or SLEEP only");
|
|
2604
2582
|
}
|
|
2605
2583
|
this.removedFromSpace();
|
|
2606
2584
|
this.event = newev;
|
|
@@ -2860,35 +2838,31 @@ var _ZPP_InteractionListener = class _ZPP_InteractionListener extends ZPP_Listen
|
|
|
2860
2838
|
set.next = null;
|
|
2861
2839
|
}
|
|
2862
2840
|
set.lt = zpp.callbacks.ZPP_CbSetPair.setlt;
|
|
2863
|
-
this.CbTypeset(
|
|
2864
|
-
this.
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
pair.
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
} else {
|
|
2884
|
-
pair.a = b;
|
|
2885
|
-
pair.b = a;
|
|
2886
|
-
}
|
|
2887
|
-
set.try_insert(pair);
|
|
2841
|
+
this.CbTypeset(this.options1.includes, this.options2.includes, (x, y) => {
|
|
2842
|
+
this.CbSetset(x.cbsets, y.cbsets, (a, b) => {
|
|
2843
|
+
a.validate();
|
|
2844
|
+
b.validate();
|
|
2845
|
+
if (zpp.callbacks.ZPP_CbSet.single_intersection(a, b, this)) {
|
|
2846
|
+
let pair;
|
|
2847
|
+
if (zpp.callbacks.ZPP_CbSetPair.zpp_pool == null) {
|
|
2848
|
+
pair = new zpp.callbacks.ZPP_CbSetPair();
|
|
2849
|
+
} else {
|
|
2850
|
+
pair = zpp.callbacks.ZPP_CbSetPair.zpp_pool;
|
|
2851
|
+
zpp.callbacks.ZPP_CbSetPair.zpp_pool = pair.next;
|
|
2852
|
+
pair.next = null;
|
|
2853
|
+
}
|
|
2854
|
+
pair.zip_listeners = true;
|
|
2855
|
+
if (zpp.callbacks.ZPP_CbSet.setlt(a, b)) {
|
|
2856
|
+
pair.a = a;
|
|
2857
|
+
pair.b = b;
|
|
2858
|
+
} else {
|
|
2859
|
+
pair.a = b;
|
|
2860
|
+
pair.b = a;
|
|
2888
2861
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2862
|
+
set.try_insert(pair);
|
|
2863
|
+
}
|
|
2864
|
+
});
|
|
2865
|
+
});
|
|
2892
2866
|
if (set.parent != null) {
|
|
2893
2867
|
let cur = set.parent;
|
|
2894
2868
|
while (cur != null) {
|
|
@@ -3069,9 +3043,7 @@ var _ZPP_InteractionListener = class _ZPP_InteractionListener extends ZPP_Listen
|
|
|
3069
3043
|
if (this.type == 3) {
|
|
3070
3044
|
throw new Error("Error: PreListener event can only be PRE");
|
|
3071
3045
|
} else if (newev != 0 && newev != 1 && newev != 6) {
|
|
3072
|
-
throw new Error(
|
|
3073
|
-
"Error: InteractionListener event must be either BEGIN, END, ONGOING"
|
|
3074
|
-
);
|
|
3046
|
+
throw new Error("Error: InteractionListener event must be either BEGIN, END, ONGOING");
|
|
3075
3047
|
}
|
|
3076
3048
|
this.removedFromSpace();
|
|
3077
3049
|
this.event = newev;
|
|
@@ -3785,9 +3757,7 @@ var _ZPP_ConvexRayResult = class _ZPP_ConvexRayResult {
|
|
|
3785
3757
|
// ---------------------------------------------------------------------------
|
|
3786
3758
|
disposed() {
|
|
3787
3759
|
if (this.next != null) {
|
|
3788
|
-
throw new Error(
|
|
3789
|
-
"Error: This object has been disposed of and cannot be used"
|
|
3790
|
-
);
|
|
3760
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
3791
3761
|
}
|
|
3792
3762
|
}
|
|
3793
3763
|
// ---------------------------------------------------------------------------
|
|
@@ -4641,9 +4611,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4641
4611
|
pos_invalidate(pos) {
|
|
4642
4612
|
this.immutable_midstep("Body::position");
|
|
4643
4613
|
if (this.type === 1 && this.space != null) {
|
|
4644
|
-
throw new Error(
|
|
4645
|
-
"Error: Cannot move a static object once inside a Space"
|
|
4646
|
-
);
|
|
4614
|
+
throw new Error("Error: Cannot move a static object once inside a Space");
|
|
4647
4615
|
}
|
|
4648
4616
|
if (!(this.posx === pos.x && this.posy === pos.y)) {
|
|
4649
4617
|
this.posx = pos.x;
|
|
@@ -4658,9 +4626,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4658
4626
|
}
|
|
4659
4627
|
vel_invalidate(vel) {
|
|
4660
4628
|
if (this.type === 1) {
|
|
4661
|
-
throw new Error(
|
|
4662
|
-
"Error: Static body cannot have its velocity set."
|
|
4663
|
-
);
|
|
4629
|
+
throw new Error("Error: Static body cannot have its velocity set.");
|
|
4664
4630
|
}
|
|
4665
4631
|
this.velx = vel.x;
|
|
4666
4632
|
this.vely = vel.y;
|
|
@@ -4690,9 +4656,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4690
4656
|
}
|
|
4691
4657
|
force_invalidate(force) {
|
|
4692
4658
|
if (this.type !== 2) {
|
|
4693
|
-
throw new Error(
|
|
4694
|
-
"Error: Non-dynamic body cannot have force applied."
|
|
4695
|
-
);
|
|
4659
|
+
throw new Error("Error: Non-dynamic body cannot have force applied.");
|
|
4696
4660
|
}
|
|
4697
4661
|
this.forcex = force.x;
|
|
4698
4662
|
this.forcey = force.y;
|
|
@@ -4703,7 +4667,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4703
4667
|
this.wrap_force.zpp_inner.y = this.forcey;
|
|
4704
4668
|
}
|
|
4705
4669
|
// ---- Vec2 wrapper setup methods ----
|
|
4706
|
-
_setupVec2Wrapper(x, y,
|
|
4670
|
+
_setupVec2Wrapper(x, y, _invalidateFn, _validateFn) {
|
|
4707
4671
|
const nape46 = _ZPP_Body._nape;
|
|
4708
4672
|
if (x != x || y != y) {
|
|
4709
4673
|
throw new Error("Error: Vec2 components cannot be NaN");
|
|
@@ -4737,9 +4701,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4737
4701
|
ret.zpp_inner.outer = ret;
|
|
4738
4702
|
} else {
|
|
4739
4703
|
if (ret.zpp_disp) {
|
|
4740
|
-
throw new Error(
|
|
4741
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
4742
|
-
);
|
|
4704
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
4743
4705
|
}
|
|
4744
4706
|
const _this = ret.zpp_inner;
|
|
4745
4707
|
if (_this._immutable) {
|
|
@@ -4775,12 +4737,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4775
4737
|
return ret;
|
|
4776
4738
|
}
|
|
4777
4739
|
setupPosition() {
|
|
4778
|
-
this.wrap_pos = this._setupVec2Wrapper(
|
|
4779
|
-
this.posx,
|
|
4780
|
-
this.posy,
|
|
4781
|
-
null,
|
|
4782
|
-
null
|
|
4783
|
-
);
|
|
4740
|
+
this.wrap_pos = this._setupVec2Wrapper(this.posx, this.posy, null, null);
|
|
4784
4741
|
this.wrap_pos.zpp_inner._inuse = true;
|
|
4785
4742
|
if (this.world) {
|
|
4786
4743
|
this.wrap_pos.zpp_inner._immutable = true;
|
|
@@ -4790,12 +4747,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4790
4747
|
}
|
|
4791
4748
|
}
|
|
4792
4749
|
setupVelocity() {
|
|
4793
|
-
this.wrap_vel = this._setupVec2Wrapper(
|
|
4794
|
-
this.velx,
|
|
4795
|
-
this.vely,
|
|
4796
|
-
null,
|
|
4797
|
-
null
|
|
4798
|
-
);
|
|
4750
|
+
this.wrap_vel = this._setupVec2Wrapper(this.velx, this.vely, null, null);
|
|
4799
4751
|
this.wrap_vel.zpp_inner._inuse = true;
|
|
4800
4752
|
if (this.world) {
|
|
4801
4753
|
this.wrap_vel.zpp_inner._immutable = true;
|
|
@@ -4805,12 +4757,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4805
4757
|
}
|
|
4806
4758
|
}
|
|
4807
4759
|
setupkinvel() {
|
|
4808
|
-
this.wrap_kinvel = this._setupVec2Wrapper(
|
|
4809
|
-
this.kinvelx,
|
|
4810
|
-
this.kinvely,
|
|
4811
|
-
null,
|
|
4812
|
-
null
|
|
4813
|
-
);
|
|
4760
|
+
this.wrap_kinvel = this._setupVec2Wrapper(this.kinvelx, this.kinvely, null, null);
|
|
4814
4761
|
this.wrap_kinvel.zpp_inner._inuse = true;
|
|
4815
4762
|
if (this.world) {
|
|
4816
4763
|
this.wrap_kinvel.zpp_inner._immutable = true;
|
|
@@ -4820,12 +4767,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4820
4767
|
}
|
|
4821
4768
|
}
|
|
4822
4769
|
setupsvel() {
|
|
4823
|
-
this.wrap_svel = this._setupVec2Wrapper(
|
|
4824
|
-
this.svelx,
|
|
4825
|
-
this.svely,
|
|
4826
|
-
null,
|
|
4827
|
-
null
|
|
4828
|
-
);
|
|
4770
|
+
this.wrap_svel = this._setupVec2Wrapper(this.svelx, this.svely, null, null);
|
|
4829
4771
|
this.wrap_svel.zpp_inner._inuse = true;
|
|
4830
4772
|
if (this.world) {
|
|
4831
4773
|
this.wrap_svel.zpp_inner._immutable = true;
|
|
@@ -4835,12 +4777,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
4835
4777
|
}
|
|
4836
4778
|
}
|
|
4837
4779
|
setupForce() {
|
|
4838
|
-
this.wrap_force = this._setupVec2Wrapper(
|
|
4839
|
-
this.forcex,
|
|
4840
|
-
this.forcey,
|
|
4841
|
-
null,
|
|
4842
|
-
null
|
|
4843
|
-
);
|
|
4780
|
+
this.wrap_force = this._setupVec2Wrapper(this.forcex, this.forcey, null, null);
|
|
4844
4781
|
this.wrap_force.zpp_inner._inuse = true;
|
|
4845
4782
|
if (this.world) {
|
|
4846
4783
|
this.wrap_force.zpp_inner._immutable = true;
|
|
@@ -5021,9 +4958,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5021
4958
|
}
|
|
5022
4959
|
validate_aabb() {
|
|
5023
4960
|
if (this.shapes.head == null) {
|
|
5024
|
-
throw new Error(
|
|
5025
|
-
"Error: Body bounds only makes sense if it contains shapes"
|
|
5026
|
-
);
|
|
4961
|
+
throw new Error("Error: Body bounds only makes sense if it contains shapes");
|
|
5027
4962
|
}
|
|
5028
4963
|
if (this.zip_aabb) {
|
|
5029
4964
|
this.zip_aabb = false;
|
|
@@ -5096,9 +5031,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5096
5031
|
}
|
|
5097
5032
|
}
|
|
5098
5033
|
if (poly.lverts.next == null) {
|
|
5099
|
-
throw new Error(
|
|
5100
|
-
"Error: An empty polygon has no meaningful bounds"
|
|
5101
|
-
);
|
|
5034
|
+
throw new Error("Error: An empty polygon has no meaningful bounds");
|
|
5102
5035
|
}
|
|
5103
5036
|
const p0 = poly.gverts.next;
|
|
5104
5037
|
poly.aabb.minx = p0.x;
|
|
@@ -5117,9 +5050,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5117
5050
|
}
|
|
5118
5051
|
aabb_validate() {
|
|
5119
5052
|
if (this.shapes.head == null) {
|
|
5120
|
-
throw new Error(
|
|
5121
|
-
"Error: bounds only makes sense when Body has shapes"
|
|
5122
|
-
);
|
|
5053
|
+
throw new Error("Error: bounds only makes sense when Body has shapes");
|
|
5123
5054
|
}
|
|
5124
5055
|
this.validate_aabb();
|
|
5125
5056
|
}
|
|
@@ -5133,9 +5064,7 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5133
5064
|
}
|
|
5134
5065
|
_computePolygonLocalCOM(poly) {
|
|
5135
5066
|
if (poly.lverts.next == null) {
|
|
5136
|
-
throw new Error(
|
|
5137
|
-
"Error: An empty polygon has no meaningful localCOM"
|
|
5138
|
-
);
|
|
5067
|
+
throw new Error("Error: An empty polygon has no meaningful localCOM");
|
|
5139
5068
|
}
|
|
5140
5069
|
if (poly.lverts.next.next == null) {
|
|
5141
5070
|
poly.localCOMx = poly.lverts.next.x;
|
|
@@ -5248,17 +5177,13 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5248
5177
|
}
|
|
5249
5178
|
getlocalCOM() {
|
|
5250
5179
|
if (this.shapes.head == null) {
|
|
5251
|
-
throw new Error(
|
|
5252
|
-
"Error: Body has no shapes so cannot compute its localCOM"
|
|
5253
|
-
);
|
|
5180
|
+
throw new Error("Error: Body has no shapes so cannot compute its localCOM");
|
|
5254
5181
|
}
|
|
5255
5182
|
this.validate_localCOM();
|
|
5256
5183
|
}
|
|
5257
5184
|
getworldCOM() {
|
|
5258
5185
|
if (this.shapes.head == null) {
|
|
5259
|
-
throw new Error(
|
|
5260
|
-
"Error: Body has no shapes so cannot compute its worldCOM"
|
|
5261
|
-
);
|
|
5186
|
+
throw new Error("Error: Body has no shapes so cannot compute its worldCOM");
|
|
5262
5187
|
}
|
|
5263
5188
|
this.validate_worldCOM();
|
|
5264
5189
|
}
|
|
@@ -5271,14 +5196,10 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5271
5196
|
// ---- Clear ----
|
|
5272
5197
|
clear() {
|
|
5273
5198
|
if (this.space != null) {
|
|
5274
|
-
throw new Error(
|
|
5275
|
-
"Error: Cannot clear a Body if it is currently being used by a Space!"
|
|
5276
|
-
);
|
|
5199
|
+
throw new Error("Error: Cannot clear a Body if it is currently being used by a Space!");
|
|
5277
5200
|
}
|
|
5278
5201
|
if (this.constraints.head != null) {
|
|
5279
|
-
throw new Error(
|
|
5280
|
-
"Error: Cannot clear a Body if it is currently being used by a constraint!"
|
|
5281
|
-
);
|
|
5202
|
+
throw new Error("Error: Cannot clear a Body if it is currently being used by a constraint!");
|
|
5282
5203
|
}
|
|
5283
5204
|
while (this.shapes.head != null) {
|
|
5284
5205
|
const s = this.shapes.pop_unsafe();
|
|
@@ -5372,15 +5293,13 @@ var _ZPP_Body = class _ZPP_Body {
|
|
|
5372
5293
|
s.zpp_inner.body = null;
|
|
5373
5294
|
s.zpp_inner.removedFromBody();
|
|
5374
5295
|
}
|
|
5375
|
-
shapes_invalidate(
|
|
5296
|
+
shapes_invalidate(_param) {
|
|
5376
5297
|
this.invalidate_shapes();
|
|
5377
5298
|
}
|
|
5378
5299
|
shapes_modifiable() {
|
|
5379
5300
|
this.immutable_midstep("Body::shapes");
|
|
5380
5301
|
if (this.type === 1 && this.space != null) {
|
|
5381
|
-
throw new Error(
|
|
5382
|
-
"Error: Cannot modifiy shapes of static object once added to Space"
|
|
5383
|
-
);
|
|
5302
|
+
throw new Error("Error: Cannot modifiy shapes of static object once added to Space");
|
|
5384
5303
|
}
|
|
5385
5304
|
}
|
|
5386
5305
|
// ---- Space integration ----
|
|
@@ -82795,13 +82714,7 @@ var nape_compiled_default = _nape;
|
|
|
82795
82714
|
|
|
82796
82715
|
// src/util/NapeListFactory.ts
|
|
82797
82716
|
function createListClasses(spec) {
|
|
82798
|
-
const {
|
|
82799
|
-
typeName,
|
|
82800
|
-
namespaceParts,
|
|
82801
|
-
zppListClass,
|
|
82802
|
-
wrapElement,
|
|
82803
|
-
unwrapElement
|
|
82804
|
-
} = spec;
|
|
82717
|
+
const { typeName, namespaceParts, zppListClass, wrapElement, unwrapElement } = spec;
|
|
82805
82718
|
const nape46 = getNape();
|
|
82806
82719
|
const zpp = nape46.__zpp;
|
|
82807
82720
|
const getZPPListClass = () => zpp.util[zppListClass];
|
|
@@ -82818,9 +82731,7 @@ function createListClasses(spec) {
|
|
|
82818
82731
|
this.zpp_i = 0;
|
|
82819
82732
|
this.zpp_inner = null;
|
|
82820
82733
|
if (!getZPPListClass().internal) {
|
|
82821
|
-
throw new Error(
|
|
82822
|
-
"Error: Cannot instantiate " + typeName + "Iterator derp!"
|
|
82823
|
-
);
|
|
82734
|
+
throw new Error("Error: Cannot instantiate " + typeName + "Iterator derp!");
|
|
82824
82735
|
}
|
|
82825
82736
|
}
|
|
82826
82737
|
TypedIterator.__name__ = [...namespaceParts, typeName + "Iterator"];
|
|
@@ -83114,9 +83025,7 @@ function createListClasses(spec) {
|
|
|
83114
83025
|
while (it.hasNext()) {
|
|
83115
83026
|
const i = it.next();
|
|
83116
83027
|
if (deep) {
|
|
83117
|
-
throw new Error(
|
|
83118
|
-
"Error: " + typeName + " is not a copyable type"
|
|
83119
|
-
);
|
|
83028
|
+
throw new Error("Error: " + typeName + " is not a copyable type");
|
|
83120
83029
|
}
|
|
83121
83030
|
ret.push(i);
|
|
83122
83031
|
}
|
|
@@ -84340,9 +84249,7 @@ var _Mat23 = class _Mat23 {
|
|
|
84340
84249
|
throw new Error("Error: Cannot transform null Vec2");
|
|
84341
84250
|
}
|
|
84342
84251
|
if (this.singular()) {
|
|
84343
|
-
throw new Error(
|
|
84344
|
-
"Error: Matrix is singular and inverse transformation cannot be performed"
|
|
84345
|
-
);
|
|
84252
|
+
throw new Error("Error: Matrix is singular and inverse transformation cannot be performed");
|
|
84346
84253
|
}
|
|
84347
84254
|
const { a, b, c, d, tx: mtx, ty: mty } = this.zpp_inner;
|
|
84348
84255
|
const idet = 1 / (a * d - b * c);
|
|
@@ -85609,16 +85516,16 @@ var _GeomPoly = class _GeomPoly {
|
|
|
85609
85516
|
this._forEachVert((p) => {
|
|
85610
85517
|
const prev = p.prev;
|
|
85611
85518
|
const next = p.next;
|
|
85612
|
-
|
|
85613
|
-
|
|
85614
|
-
|
|
85615
|
-
|
|
85616
|
-
|
|
85617
|
-
|
|
85618
|
-
|
|
85619
|
-
|
|
85620
|
-
|
|
85621
|
-
|
|
85519
|
+
const ax = p.x - prev.x;
|
|
85520
|
+
const ay = p.y - prev.y;
|
|
85521
|
+
const bx = next.x - p.x;
|
|
85522
|
+
const by = next.y - p.y;
|
|
85523
|
+
const alen = Math.sqrt(ax * ax + ay * ay);
|
|
85524
|
+
const apx = -ay / alen * inflation;
|
|
85525
|
+
const apy = ax / alen * inflation;
|
|
85526
|
+
const blen = Math.sqrt(bx * bx + by * by);
|
|
85527
|
+
const bpx = -by / blen * inflation;
|
|
85528
|
+
const bpy = bx / blen * inflation;
|
|
85622
85529
|
const bapx = bpx - apx;
|
|
85623
85530
|
const bapy = bpy - apy;
|
|
85624
85531
|
const num = by * bapx - bx * bapy;
|
|
@@ -85854,9 +85761,7 @@ var MarchingSquares = class {
|
|
|
85854
85761
|
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
85855
85762
|
}
|
|
85856
85763
|
if (iso == null) {
|
|
85857
|
-
throw new Error(
|
|
85858
|
-
"Error: MarchingSquares requires an iso function to operate"
|
|
85859
|
-
);
|
|
85764
|
+
throw new Error("Error: MarchingSquares requires an iso function to operate");
|
|
85860
85765
|
}
|
|
85861
85766
|
if (bounds == null) {
|
|
85862
85767
|
throw new Error(
|
|
@@ -85873,9 +85778,7 @@ var MarchingSquares = class {
|
|
|
85873
85778
|
cellZpp._validate();
|
|
85874
85779
|
}
|
|
85875
85780
|
if (cellZpp.x <= 0 || cellZpp.y <= 0) {
|
|
85876
|
-
throw new Error(
|
|
85877
|
-
"Error: MarchingSquares cannot operate with non-positive cell dimensions"
|
|
85878
|
-
);
|
|
85781
|
+
throw new Error("Error: MarchingSquares cannot operate with non-positive cell dimensions");
|
|
85879
85782
|
}
|
|
85880
85783
|
if (quality < 0) {
|
|
85881
85784
|
throw new Error(
|
|
@@ -85888,9 +85791,7 @@ var MarchingSquares = class {
|
|
|
85888
85791
|
subZpp._validate();
|
|
85889
85792
|
}
|
|
85890
85793
|
if (subZpp.x <= 0 || subZpp.y <= 0) {
|
|
85891
|
-
throw new Error(
|
|
85892
|
-
"Error: MarchingSquares cannot with non-positive sub-grid dimensions"
|
|
85893
|
-
);
|
|
85794
|
+
throw new Error("Error: MarchingSquares cannot with non-positive sub-grid dimensions");
|
|
85894
85795
|
}
|
|
85895
85796
|
}
|
|
85896
85797
|
const nape46 = getNape();
|
|
@@ -85960,9 +85861,7 @@ var Ray = class _Ray {
|
|
|
85960
85861
|
// Static factories
|
|
85961
85862
|
// ---------------------------------------------------------------------------
|
|
85962
85863
|
static fromSegment(start, end) {
|
|
85963
|
-
return _Ray._wrap(
|
|
85964
|
-
getNape().geom.Ray.fromSegment(start._inner, end._inner)
|
|
85965
|
-
);
|
|
85864
|
+
return _Ray._wrap(getNape().geom.Ray.fromSegment(start._inner, end._inner));
|
|
85966
85865
|
}
|
|
85967
85866
|
// ---------------------------------------------------------------------------
|
|
85968
85867
|
// Properties
|
|
@@ -86061,9 +85960,7 @@ var _ConvexResult = class _ConvexResult {
|
|
|
86061
85960
|
/** @internal */
|
|
86062
85961
|
_disposed() {
|
|
86063
85962
|
if (this.zpp_inner.next != null) {
|
|
86064
|
-
throw new Error(
|
|
86065
|
-
"Error: This object has been disposed of and cannot be used"
|
|
86066
|
-
);
|
|
85963
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
86067
85964
|
}
|
|
86068
85965
|
}
|
|
86069
85966
|
};
|
|
@@ -86133,9 +86030,7 @@ var _RayResult = class _RayResult {
|
|
|
86133
86030
|
/** @internal */
|
|
86134
86031
|
_disposed() {
|
|
86135
86032
|
if (this.zpp_inner.next != null) {
|
|
86136
|
-
throw new Error(
|
|
86137
|
-
"Error: This object has been disposed of and cannot be used"
|
|
86138
|
-
);
|
|
86033
|
+
throw new Error("Error: This object has been disposed of and cannot be used");
|
|
86139
86034
|
}
|
|
86140
86035
|
}
|
|
86141
86036
|
};
|
|
@@ -86320,9 +86215,7 @@ var _Material = class _Material {
|
|
|
86320
86215
|
throw new Error("Error: Material::dynamicFriction cannot be negative");
|
|
86321
86216
|
}
|
|
86322
86217
|
zpp.dynamicFriction = dynamicFriction;
|
|
86323
|
-
zpp.invalidate(
|
|
86324
|
-
ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS
|
|
86325
|
-
);
|
|
86218
|
+
zpp.invalidate(ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS);
|
|
86326
86219
|
}
|
|
86327
86220
|
if (staticFriction !== zpp.staticFriction) {
|
|
86328
86221
|
if (staticFriction !== staticFriction) {
|
|
@@ -86399,9 +86292,7 @@ var _Material = class _Material {
|
|
|
86399
86292
|
throw new Error("Error: Material::dynamicFriction cannot be negative");
|
|
86400
86293
|
}
|
|
86401
86294
|
this.zpp_inner.dynamicFriction = value;
|
|
86402
|
-
this.zpp_inner.invalidate(
|
|
86403
|
-
ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS
|
|
86404
|
-
);
|
|
86295
|
+
this.zpp_inner.invalidate(ZPP_Material.WAKE | ZPP_Material.ANGDRAG | ZPP_Material.ARBITERS);
|
|
86405
86296
|
}
|
|
86406
86297
|
}
|
|
86407
86298
|
get staticFriction() {
|
|
@@ -86544,9 +86435,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86544
86435
|
throw new Error("Error: FluidProperties::viscosity cannot be NaN");
|
|
86545
86436
|
}
|
|
86546
86437
|
if (viscosity < 0) {
|
|
86547
|
-
throw new Error(
|
|
86548
|
-
"Error: FluidProperties::viscosity (" + viscosity + ") must be >= 0"
|
|
86549
|
-
);
|
|
86438
|
+
throw new Error("Error: FluidProperties::viscosity (" + viscosity + ") must be >= 0");
|
|
86550
86439
|
}
|
|
86551
86440
|
zpp.viscosity = viscosity / 1;
|
|
86552
86441
|
zpp.invalidate();
|
|
@@ -86593,9 +86482,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86593
86482
|
throw new Error("Error: FluidProperties::viscosity cannot be NaN");
|
|
86594
86483
|
}
|
|
86595
86484
|
if (value < 0) {
|
|
86596
|
-
throw new Error(
|
|
86597
|
-
"Error: FluidProperties::viscosity (" + value + ") must be >= 0"
|
|
86598
|
-
);
|
|
86485
|
+
throw new Error("Error: FluidProperties::viscosity (" + value + ") must be >= 0");
|
|
86599
86486
|
}
|
|
86600
86487
|
this.zpp_inner.viscosity = value / 1;
|
|
86601
86488
|
this.zpp_inner.invalidate();
|
|
@@ -86790,10 +86677,7 @@ var _FluidProperties = class _FluidProperties {
|
|
|
86790
86677
|
copy() {
|
|
86791
86678
|
const napeNs = getNape();
|
|
86792
86679
|
const zpp_nape = napeNs.zpp_nape;
|
|
86793
|
-
const ret = new _FluidProperties(
|
|
86794
|
-
this.zpp_inner.density * 1e3,
|
|
86795
|
-
this.zpp_inner.viscosity
|
|
86796
|
-
);
|
|
86680
|
+
const ret = new _FluidProperties(this.zpp_inner.density * 1e3, this.zpp_inner.viscosity);
|
|
86797
86681
|
if (this.zpp_inner.userData != null) {
|
|
86798
86682
|
ret.zpp_inner.userData = { ...this.zpp_inner.userData };
|
|
86799
86683
|
}
|
|
@@ -87305,10 +87189,8 @@ var Interactor = class _Interactor {
|
|
|
87305
87189
|
if (!inner) return null;
|
|
87306
87190
|
if (inner instanceof _Interactor) return inner;
|
|
87307
87191
|
if (inner.isBody && inner.isBody() && _bodyWrap) return _bodyWrap(inner);
|
|
87308
|
-
if (inner.isShape && inner.isShape() && _shapeWrap)
|
|
87309
|
-
|
|
87310
|
-
if (inner.isCompound && inner.isCompound() && _compoundWrap)
|
|
87311
|
-
return _compoundWrap(inner);
|
|
87192
|
+
if (inner.isShape && inner.isShape() && _shapeWrap) return _shapeWrap(inner);
|
|
87193
|
+
if (inner.isCompound && inner.isCompound() && _compoundWrap) return _compoundWrap(inner);
|
|
87312
87194
|
return getOrCreate(inner, (raw) => {
|
|
87313
87195
|
const i = Object.create(_Interactor.prototype);
|
|
87314
87196
|
i._inner = raw;
|
|
@@ -87849,15 +87731,7 @@ var _Listener = class _Listener {
|
|
|
87849
87731
|
}
|
|
87850
87732
|
}
|
|
87851
87733
|
toString() {
|
|
87852
|
-
const eventNames = [
|
|
87853
|
-
"BEGIN",
|
|
87854
|
-
"END",
|
|
87855
|
-
"WAKE",
|
|
87856
|
-
"SLEEP",
|
|
87857
|
-
"BREAK",
|
|
87858
|
-
"PRE",
|
|
87859
|
-
"ONGOING"
|
|
87860
|
-
];
|
|
87734
|
+
const eventNames = ["BEGIN", "END", "WAKE", "SLEEP", "BREAK", "PRE", "ONGOING"];
|
|
87861
87735
|
const event = eventNames[this.zpp_inner.event];
|
|
87862
87736
|
if (this.zpp_inner.type == 0) {
|
|
87863
87737
|
const body = this.zpp_inner.body;
|
|
@@ -88475,10 +88349,7 @@ var _Body = class _Body extends Interactor {
|
|
|
88475
88349
|
get_arbiters() {
|
|
88476
88350
|
const zppNs = getNape().__zpp;
|
|
88477
88351
|
if (this.zpp_inner.wrap_arbiters == null) {
|
|
88478
|
-
this.zpp_inner.wrap_arbiters = zppNs.util.ZPP_ArbiterList.get(
|
|
88479
|
-
this.zpp_inner.arbiters,
|
|
88480
|
-
true
|
|
88481
|
-
);
|
|
88352
|
+
this.zpp_inner.wrap_arbiters = zppNs.util.ZPP_ArbiterList.get(this.zpp_inner.arbiters, true);
|
|
88482
88353
|
}
|
|
88483
88354
|
return this.zpp_inner.wrap_arbiters;
|
|
88484
88355
|
}
|
|
@@ -88694,9 +88565,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88694
88565
|
/** Recursively visit all bodies in this compound and its sub-compounds. */
|
|
88695
88566
|
visitBodies(lambda) {
|
|
88696
88567
|
if (lambda == null) {
|
|
88697
|
-
throw new Error(
|
|
88698
|
-
"Error: lambda cannot be null for Compound::visitBodies"
|
|
88699
|
-
);
|
|
88568
|
+
throw new Error("Error: lambda cannot be null for Compound::visitBodies");
|
|
88700
88569
|
}
|
|
88701
88570
|
const bodies = this.zpp_inner.wrap_bodies;
|
|
88702
88571
|
const bLen = bodies.get_length();
|
|
@@ -88712,9 +88581,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88712
88581
|
/** Recursively visit all constraints in this compound and its sub-compounds. */
|
|
88713
88582
|
visitConstraints(lambda) {
|
|
88714
88583
|
if (lambda == null) {
|
|
88715
|
-
throw new Error(
|
|
88716
|
-
"Error: lambda cannot be null for Compound::visitConstraints"
|
|
88717
|
-
);
|
|
88584
|
+
throw new Error("Error: lambda cannot be null for Compound::visitConstraints");
|
|
88718
88585
|
}
|
|
88719
88586
|
const constraints = this.zpp_inner.wrap_constraints;
|
|
88720
88587
|
const cLen = constraints.get_length();
|
|
@@ -88730,9 +88597,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88730
88597
|
/** Recursively visit all sub-compounds in this compound. */
|
|
88731
88598
|
visitCompounds(lambda) {
|
|
88732
88599
|
if (lambda == null) {
|
|
88733
|
-
throw new Error(
|
|
88734
|
-
"Error: lambda cannot be null for Compound::visitConstraints"
|
|
88735
|
-
);
|
|
88600
|
+
throw new Error("Error: lambda cannot be null for Compound::visitConstraints");
|
|
88736
88601
|
}
|
|
88737
88602
|
const compounds = this.zpp_inner.wrap_compounds;
|
|
88738
88603
|
const compLen = compounds.get_length();
|
|
@@ -88782,9 +88647,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88782
88647
|
/** Translate all bodies in this compound by the given vector. */
|
|
88783
88648
|
translate(translation) {
|
|
88784
88649
|
if (translation != null && translation.zpp_disp) {
|
|
88785
|
-
throw new Error(
|
|
88786
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
88787
|
-
);
|
|
88650
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
88788
88651
|
}
|
|
88789
88652
|
if (translation == null) {
|
|
88790
88653
|
throw new Error("Error: Cannot translate by null Vec2");
|
|
@@ -88806,9 +88669,7 @@ var _Compound = class _Compound extends Interactor {
|
|
|
88806
88669
|
/** Rotate all bodies in this compound around the given centre point. */
|
|
88807
88670
|
rotate(centre, angle) {
|
|
88808
88671
|
if (centre != null && centre.zpp_disp) {
|
|
88809
|
-
throw new Error(
|
|
88810
|
-
"Error: Vec2 has been disposed and cannot be used!"
|
|
88811
|
-
);
|
|
88672
|
+
throw new Error("Error: Vec2 has been disposed and cannot be used!");
|
|
88812
88673
|
}
|
|
88813
88674
|
if (centre == null) {
|
|
88814
88675
|
throw new Error("Error: Cannot rotate about a null Vec2");
|
|
@@ -89432,7 +89293,7 @@ var Arbiter = class {
|
|
|
89432
89293
|
* Total impulse of this arbiter. Base implementation returns Vec3(0,0,0).
|
|
89433
89294
|
* Overridden by CollisionArbiter and FluidArbiter.
|
|
89434
89295
|
*/
|
|
89435
|
-
totalImpulse(body = null,
|
|
89296
|
+
totalImpulse(body = null, _freshOnly = false) {
|
|
89436
89297
|
this._activeCheck();
|
|
89437
89298
|
if (body != null) {
|
|
89438
89299
|
this._checkBody(body);
|
|
@@ -89556,9 +89417,7 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89556
89417
|
throw new Error("Error: CollisionArbiter::elasticity cannot be NaN");
|
|
89557
89418
|
}
|
|
89558
89419
|
if (value < 0) {
|
|
89559
|
-
throw new Error(
|
|
89560
|
-
"Error: CollisionArbiter::elasticity cannot be negative"
|
|
89561
|
-
);
|
|
89420
|
+
throw new Error("Error: CollisionArbiter::elasticity cannot be negative");
|
|
89562
89421
|
}
|
|
89563
89422
|
this.zpp_inner.colarb.restitution = value;
|
|
89564
89423
|
this.zpp_inner.colarb.userdef_restitution = true;
|
|
@@ -89574,14 +89433,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89574
89433
|
set dynamicFriction(value) {
|
|
89575
89434
|
this._mutableCheck("dynamicFriction");
|
|
89576
89435
|
if (value !== value) {
|
|
89577
|
-
throw new Error(
|
|
89578
|
-
"Error: CollisionArbiter::dynamicFriction cannot be NaN"
|
|
89579
|
-
);
|
|
89436
|
+
throw new Error("Error: CollisionArbiter::dynamicFriction cannot be NaN");
|
|
89580
89437
|
}
|
|
89581
89438
|
if (value < 0) {
|
|
89582
|
-
throw new Error(
|
|
89583
|
-
"Error: CollisionArbiter::dynamicFriction cannot be negative"
|
|
89584
|
-
);
|
|
89439
|
+
throw new Error("Error: CollisionArbiter::dynamicFriction cannot be negative");
|
|
89585
89440
|
}
|
|
89586
89441
|
this.zpp_inner.colarb.dyn_fric = value;
|
|
89587
89442
|
this.zpp_inner.colarb.userdef_dyn_fric = true;
|
|
@@ -89597,14 +89452,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89597
89452
|
set staticFriction(value) {
|
|
89598
89453
|
this._mutableCheck("staticFriction");
|
|
89599
89454
|
if (value !== value) {
|
|
89600
|
-
throw new Error(
|
|
89601
|
-
"Error: CollisionArbiter::staticFriction cannot be NaN"
|
|
89602
|
-
);
|
|
89455
|
+
throw new Error("Error: CollisionArbiter::staticFriction cannot be NaN");
|
|
89603
89456
|
}
|
|
89604
89457
|
if (value < 0) {
|
|
89605
|
-
throw new Error(
|
|
89606
|
-
"Error: CollisionArbiter::staticFriction cannot be negative"
|
|
89607
|
-
);
|
|
89458
|
+
throw new Error("Error: CollisionArbiter::staticFriction cannot be negative");
|
|
89608
89459
|
}
|
|
89609
89460
|
this.zpp_inner.colarb.stat_fric = value;
|
|
89610
89461
|
this.zpp_inner.colarb.userdef_stat_fric = true;
|
|
@@ -89620,14 +89471,10 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89620
89471
|
set rollingFriction(value) {
|
|
89621
89472
|
this._mutableCheck("rollingFriction");
|
|
89622
89473
|
if (value !== value) {
|
|
89623
|
-
throw new Error(
|
|
89624
|
-
"Error: CollisionArbiter::rollingFriction cannot be NaN"
|
|
89625
|
-
);
|
|
89474
|
+
throw new Error("Error: CollisionArbiter::rollingFriction cannot be NaN");
|
|
89626
89475
|
}
|
|
89627
89476
|
if (value < 0) {
|
|
89628
|
-
throw new Error(
|
|
89629
|
-
"Error: CollisionArbiter::rollingFriction cannot be negative"
|
|
89630
|
-
);
|
|
89477
|
+
throw new Error("Error: CollisionArbiter::rollingFriction cannot be negative");
|
|
89631
89478
|
}
|
|
89632
89479
|
this.zpp_inner.colarb.rfric = value;
|
|
89633
89480
|
this.zpp_inner.colarb.userdef_rfric = true;
|
|
@@ -89718,9 +89565,7 @@ var CollisionArbiter = class extends Arbiter {
|
|
|
89718
89565
|
/** @internal Throw if not in pre-handler mutable window. */
|
|
89719
89566
|
_mutableCheck(prop) {
|
|
89720
89567
|
if (!this.zpp_inner.colarb.mutable) {
|
|
89721
|
-
throw new Error(
|
|
89722
|
-
"Error: CollisionArbiter::" + prop + " is only mutable during a pre-handler"
|
|
89723
|
-
);
|
|
89568
|
+
throw new Error("Error: CollisionArbiter::" + prop + " is only mutable during a pre-handler");
|
|
89724
89569
|
}
|
|
89725
89570
|
}
|
|
89726
89571
|
/** @internal Accumulate impulse from contacts. */
|
|
@@ -89780,9 +89625,7 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89780
89625
|
}
|
|
89781
89626
|
set position(value) {
|
|
89782
89627
|
if (!this.zpp_inner.fluidarb.mutable) {
|
|
89783
|
-
throw new Error(
|
|
89784
|
-
"Error: Arbiter is mutable only within a pre-handler"
|
|
89785
|
-
);
|
|
89628
|
+
throw new Error("Error: Arbiter is mutable only within a pre-handler");
|
|
89786
89629
|
}
|
|
89787
89630
|
if (value == null) {
|
|
89788
89631
|
throw new Error("Error: FluidArbiter::position cannot be null");
|
|
@@ -89801,17 +89644,13 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89801
89644
|
}
|
|
89802
89645
|
set overlap(value) {
|
|
89803
89646
|
if (!this.zpp_inner.fluidarb.mutable) {
|
|
89804
|
-
throw new Error(
|
|
89805
|
-
"Error: Arbiter is mutable only within a pre-handler"
|
|
89806
|
-
);
|
|
89647
|
+
throw new Error("Error: Arbiter is mutable only within a pre-handler");
|
|
89807
89648
|
}
|
|
89808
89649
|
if (value !== value) {
|
|
89809
89650
|
throw new Error("Error: FluidArbiter::overlap cannot be NaN");
|
|
89810
89651
|
}
|
|
89811
89652
|
if (value <= 0 || value == Infinity) {
|
|
89812
|
-
throw new Error(
|
|
89813
|
-
"Error: FluidArbiter::overlap must be strictly positive and non infinite"
|
|
89814
|
-
);
|
|
89653
|
+
throw new Error("Error: FluidArbiter::overlap must be strictly positive and non infinite");
|
|
89815
89654
|
}
|
|
89816
89655
|
this.zpp_inner.fluidarb.overlap = value;
|
|
89817
89656
|
}
|
|
@@ -89826,17 +89665,9 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89826
89665
|
if (body == null) {
|
|
89827
89666
|
return Vec3.get(farb.buoyx, farb.buoyy, 0);
|
|
89828
89667
|
} else if (body.zpp_inner == this.zpp_inner.b2) {
|
|
89829
|
-
return Vec3.get(
|
|
89830
|
-
farb.buoyx,
|
|
89831
|
-
farb.buoyy,
|
|
89832
|
-
farb.buoyy * farb.r2x - farb.buoyx * farb.r2y
|
|
89833
|
-
);
|
|
89668
|
+
return Vec3.get(farb.buoyx, farb.buoyy, farb.buoyy * farb.r2x - farb.buoyx * farb.r2y);
|
|
89834
89669
|
} else {
|
|
89835
|
-
return Vec3.get(
|
|
89836
|
-
-farb.buoyx,
|
|
89837
|
-
-farb.buoyy,
|
|
89838
|
-
-(farb.buoyy * farb.r1x - farb.buoyx * farb.r1y)
|
|
89839
|
-
);
|
|
89670
|
+
return Vec3.get(-farb.buoyx, -farb.buoyy, -(farb.buoyy * farb.r1x - farb.buoyx * farb.r1y));
|
|
89840
89671
|
}
|
|
89841
89672
|
}
|
|
89842
89673
|
/** Drag impulse applied by this fluid arbiter. */
|
|
@@ -89845,14 +89676,10 @@ var FluidArbiter = class extends Arbiter {
|
|
|
89845
89676
|
if (body != null) this._checkBody(body);
|
|
89846
89677
|
const farb = this.zpp_inner.fluidarb;
|
|
89847
89678
|
const scale = body == null || body.zpp_inner == this.zpp_inner.b2 ? 1 : -1;
|
|
89848
|
-
return Vec3.get(
|
|
89849
|
-
farb.dampx * scale,
|
|
89850
|
-
farb.dampy * scale,
|
|
89851
|
-
farb.adamp * scale
|
|
89852
|
-
);
|
|
89679
|
+
return Vec3.get(farb.dampx * scale, farb.dampy * scale, farb.adamp * scale);
|
|
89853
89680
|
}
|
|
89854
89681
|
/** Total impulse (buoyancy + drag). */
|
|
89855
|
-
totalImpulse(body = null,
|
|
89682
|
+
totalImpulse(body = null, _freshOnly = false) {
|
|
89856
89683
|
this._activeCheck();
|
|
89857
89684
|
if (body != null) this._checkBody(body);
|
|
89858
89685
|
const buoy = this.buoyancyImpulse(body);
|
|
@@ -90024,11 +89851,7 @@ var Contact = class {
|
|
|
90024
89851
|
const jx = colarb.nx * jnAcc - colarb.ny * jtAcc;
|
|
90025
89852
|
const jy = colarb.ny * jnAcc + colarb.nx * jtAcc;
|
|
90026
89853
|
if (body == colarb.b1.outer) {
|
|
90027
|
-
return Vec3.get(
|
|
90028
|
-
-jx,
|
|
90029
|
-
-jy,
|
|
90030
|
-
-(jy * cin.r1x - jx * cin.r1y) - jrAcc
|
|
90031
|
-
);
|
|
89854
|
+
return Vec3.get(-jx, -jy, -(jy * cin.r1x - jx * cin.r1y) - jrAcc);
|
|
90032
89855
|
}
|
|
90033
89856
|
return Vec3.get(jx, jy, jy * cin.r2x - jx * cin.r2y + jrAcc);
|
|
90034
89857
|
}
|
|
@@ -90416,7 +90239,7 @@ var BodyListener = class extends Listener {
|
|
|
90416
90239
|
if (handler == null) {
|
|
90417
90240
|
throw new Error("Error: BodyListener::handler cannot be null");
|
|
90418
90241
|
}
|
|
90419
|
-
let xevent
|
|
90242
|
+
let xevent;
|
|
90420
90243
|
if (event === CbEvent.WAKE) {
|
|
90421
90244
|
xevent = 2;
|
|
90422
90245
|
} else if (event === CbEvent.SLEEP) {
|
|
@@ -90426,11 +90249,7 @@ var BodyListener = class extends Listener {
|
|
|
90426
90249
|
"Error: cbEvent '" + event.toString() + "' is not a valid event type for a BodyListener"
|
|
90427
90250
|
);
|
|
90428
90251
|
}
|
|
90429
|
-
this.zpp_inner_zn = new ZPP_BodyListener(
|
|
90430
|
-
ZPP_OptionType.argument(options),
|
|
90431
|
-
xevent,
|
|
90432
|
-
handler
|
|
90433
|
-
);
|
|
90252
|
+
this.zpp_inner_zn = new ZPP_BodyListener(ZPP_OptionType.argument(options), xevent, handler);
|
|
90434
90253
|
this.zpp_inner = this.zpp_inner_zn;
|
|
90435
90254
|
this.zpp_inner.outer = this;
|
|
90436
90255
|
this.zpp_inner_zn.outer_zn = this;
|
|
@@ -90480,11 +90299,9 @@ var InteractionListener = class extends Listener {
|
|
|
90480
90299
|
throw new Error("Error: InteractionListener::handler cannot be null");
|
|
90481
90300
|
}
|
|
90482
90301
|
if (event == null) {
|
|
90483
|
-
throw new Error(
|
|
90484
|
-
"Error: CbEvent cannot be null for InteractionListener"
|
|
90485
|
-
);
|
|
90302
|
+
throw new Error("Error: CbEvent cannot be null for InteractionListener");
|
|
90486
90303
|
}
|
|
90487
|
-
let xevent
|
|
90304
|
+
let xevent;
|
|
90488
90305
|
if (event === CbEvent.BEGIN) {
|
|
90489
90306
|
xevent = 0;
|
|
90490
90307
|
} else if (event === CbEvent.END) {
|
|
@@ -90509,9 +90326,7 @@ var InteractionListener = class extends Listener {
|
|
|
90509
90326
|
this.zpp_inner.precedence = precedence;
|
|
90510
90327
|
this.zpp_inner_zn.handleri = handler;
|
|
90511
90328
|
if (interactionType == null) {
|
|
90512
|
-
throw new Error(
|
|
90513
|
-
"Error: Cannot set listener interaction type to null"
|
|
90514
|
-
);
|
|
90329
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90515
90330
|
}
|
|
90516
90331
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90517
90332
|
if (currentType != interactionType) {
|
|
@@ -90544,9 +90359,7 @@ var InteractionListener = class extends Listener {
|
|
|
90544
90359
|
}
|
|
90545
90360
|
set interactionType(interactionType) {
|
|
90546
90361
|
if (interactionType == null) {
|
|
90547
|
-
throw new Error(
|
|
90548
|
-
"Error: Cannot set listener interaction type to null"
|
|
90549
|
-
);
|
|
90362
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90550
90363
|
}
|
|
90551
90364
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90552
90365
|
if (currentType != interactionType) {
|
|
@@ -90574,7 +90387,7 @@ var ConstraintListener = class extends Listener {
|
|
|
90574
90387
|
if (handler == null) {
|
|
90575
90388
|
throw new Error("Error: ConstraintListener::handler cannot be null");
|
|
90576
90389
|
}
|
|
90577
|
-
let xevent
|
|
90390
|
+
let xevent;
|
|
90578
90391
|
if (event === CbEvent.WAKE) {
|
|
90579
90392
|
xevent = 2;
|
|
90580
90393
|
} else if (event === CbEvent.SLEEP) {
|
|
@@ -90641,9 +90454,7 @@ var PreListener = class extends Listener {
|
|
|
90641
90454
|
this.zpp_inner_zn.pure = pure;
|
|
90642
90455
|
this.zpp_inner_zn.handlerp = handler;
|
|
90643
90456
|
if (interactionType == null) {
|
|
90644
|
-
throw new Error(
|
|
90645
|
-
"Error: Cannot set listener interaction type to null"
|
|
90646
|
-
);
|
|
90457
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90647
90458
|
}
|
|
90648
90459
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90649
90460
|
if (currentType != interactionType) {
|
|
@@ -90686,9 +90497,7 @@ var PreListener = class extends Listener {
|
|
|
90686
90497
|
}
|
|
90687
90498
|
set interactionType(interactionType) {
|
|
90688
90499
|
if (interactionType == null) {
|
|
90689
|
-
throw new Error(
|
|
90690
|
-
"Error: Cannot set listener interaction type to null"
|
|
90691
|
-
);
|
|
90500
|
+
throw new Error("Error: Cannot set listener interaction type to null");
|
|
90692
90501
|
}
|
|
90693
90502
|
const currentType = numberToInteractionType(this.zpp_inner_zn.itype);
|
|
90694
90503
|
if (currentType != interactionType) {
|
|
@@ -91287,7 +91096,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
|
|
|
91287
91096
|
};
|
|
91288
91097
|
|
|
91289
91098
|
// src/index.ts
|
|
91290
|
-
var VERSION = "3.3.
|
|
91099
|
+
var VERSION = "3.3.17";
|
|
91291
91100
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91292
91101
|
0 && (module.exports = {
|
|
91293
91102
|
AABB,
|