@newkrok/nape-js 3.3.29 → 3.3.30
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 +79 -175
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +79 -175
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6878,8 +6878,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6878
6878
|
this.r1y = this.centroidy - this.b1.posy;
|
|
6879
6879
|
this.r2x = this.centroidx - this.b2.posx;
|
|
6880
6880
|
this.r2y = this.centroidy - this.b2.posy;
|
|
6881
|
-
let g1x
|
|
6882
|
-
let g1y
|
|
6881
|
+
let g1x;
|
|
6882
|
+
let g1y;
|
|
6883
6883
|
if (this.ws1.fluidEnabled && this.ws1.fluidProperties.wrap_gravity != null) {
|
|
6884
6884
|
g1x = this.ws1.fluidProperties.gravityx;
|
|
6885
6885
|
g1y = this.ws1.fluidProperties.gravityy;
|
|
@@ -6887,8 +6887,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6887
6887
|
g1x = s.gravityx;
|
|
6888
6888
|
g1y = s.gravityy;
|
|
6889
6889
|
}
|
|
6890
|
-
let g2x
|
|
6891
|
-
let g2y
|
|
6890
|
+
let g2x;
|
|
6891
|
+
let g2y;
|
|
6892
6892
|
if (this.ws2.fluidEnabled && this.ws2.fluidProperties.wrap_gravity != null) {
|
|
6893
6893
|
g2x = this.ws2.fluidProperties.gravityx;
|
|
6894
6894
|
g2y = this.ws2.fluidProperties.gravityy;
|
|
@@ -6910,10 +6910,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6910
6910
|
buoyx += g2x * t;
|
|
6911
6911
|
buoyy += g2y * t;
|
|
6912
6912
|
} else {
|
|
6913
|
-
let gx =
|
|
6914
|
-
let gy =
|
|
6915
|
-
gx = g1x + g2x;
|
|
6916
|
-
gy = g1y + g2y;
|
|
6913
|
+
let gx = g1x + g2x;
|
|
6914
|
+
let gy = g1y + g2y;
|
|
6917
6915
|
const t = 0.5;
|
|
6918
6916
|
gx *= t;
|
|
6919
6917
|
gy *= t;
|
|
@@ -7676,11 +7674,9 @@ var _ZPP_ColArbiter = class _ZPP_ColArbiter extends ZPP_Arbiter {
|
|
|
7676
7674
|
x = this.ny * ci.r1x - this.nx * ci.r1y;
|
|
7677
7675
|
nt += this.b1.sinertia * (x * x);
|
|
7678
7676
|
ci.nMass = nt < napeNs.Config.epsilon * napeNs.Config.epsilon ? 0 : 1 / nt;
|
|
7679
|
-
let vrx = 0;
|
|
7680
|
-
let vry = 0;
|
|
7681
7677
|
let ang = this.b2.angvel + this.b2.kinangvel;
|
|
7682
|
-
vrx = this.b2.velx + this.b2.kinvelx - ci.r2y * ang;
|
|
7683
|
-
vry = this.b2.vely + this.b2.kinvely + ci.r2x * ang;
|
|
7678
|
+
let vrx = this.b2.velx + this.b2.kinvelx - ci.r2y * ang;
|
|
7679
|
+
let vry = this.b2.vely + this.b2.kinvely + ci.r2x * ang;
|
|
7684
7680
|
ang = this.b1.angvel + this.b1.kinangvel;
|
|
7685
7681
|
vrx -= this.b1.velx + this.b1.kinvelx - ci.r1y * ang;
|
|
7686
7682
|
vry -= this.b1.vely + this.b1.kinvely + ci.r1x * ang;
|
|
@@ -7821,7 +7817,6 @@ var _ZPP_ColArbiter = class _ZPP_ColArbiter extends ZPP_Arbiter {
|
|
|
7821
7817
|
}
|
|
7822
7818
|
// ========== Velocity impulse solver ==========
|
|
7823
7819
|
applyImpulseVel() {
|
|
7824
|
-
const napeNs = ZPP_Arbiter._nape;
|
|
7825
7820
|
let v1x = this.k1x + this.b2.velx - this.c1.r2y * this.b2.angvel - (this.b1.velx - this.c1.r1y * this.b1.angvel);
|
|
7826
7821
|
let v1y = this.k1y + this.b2.vely + this.c1.r2x * this.b2.angvel - (this.b1.vely + this.c1.r1x * this.b1.angvel);
|
|
7827
7822
|
let j = (v1y * this.nx - v1x * this.ny + this.surfacex) * this.c1.tMass;
|
|
@@ -9221,36 +9216,20 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9221
9216
|
this.a1rely = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
9222
9217
|
this.a2relx = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9223
9218
|
this.a2rely = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9224
|
-
let nx =
|
|
9225
|
-
let ny =
|
|
9226
|
-
nx = this.b2.posx + this.a2relx - (this.b1.posx + this.a1relx);
|
|
9227
|
-
ny = this.b2.posy + this.a2rely - (this.b1.posy + this.a1rely);
|
|
9219
|
+
let nx = this.b2.posx + this.a2relx - (this.b1.posx + this.a1relx);
|
|
9220
|
+
let ny = this.b2.posy + this.a2rely - (this.b1.posy + this.a1rely);
|
|
9228
9221
|
let C = nx * nx + ny * ny;
|
|
9229
9222
|
if (C < ZPP_Constraint._nape.Config.epsilon) {
|
|
9230
|
-
nx = 0;
|
|
9231
|
-
ny = 0;
|
|
9232
|
-
C = 0;
|
|
9233
9223
|
slack = true;
|
|
9234
9224
|
} else {
|
|
9235
9225
|
C = Math.sqrt(C);
|
|
9236
|
-
const t = 1 / C;
|
|
9237
|
-
nx *= t;
|
|
9238
|
-
ny *= t;
|
|
9239
9226
|
if (this.equal) {
|
|
9240
|
-
C -= this.jointMax;
|
|
9241
9227
|
slack = false;
|
|
9242
9228
|
} else if (C < this.jointMin) {
|
|
9243
|
-
C = this.jointMin - C;
|
|
9244
|
-
nx = -nx;
|
|
9245
|
-
ny = -ny;
|
|
9246
9229
|
slack = false;
|
|
9247
9230
|
} else if (C > this.jointMax) {
|
|
9248
|
-
C -= this.jointMax;
|
|
9249
9231
|
slack = false;
|
|
9250
9232
|
} else {
|
|
9251
|
-
nx = 0;
|
|
9252
|
-
ny = 0;
|
|
9253
|
-
C = 0;
|
|
9254
9233
|
slack = true;
|
|
9255
9234
|
}
|
|
9256
9235
|
}
|
|
@@ -9524,19 +9503,13 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9524
9503
|
}
|
|
9525
9504
|
applyImpulsePos() {
|
|
9526
9505
|
let j;
|
|
9527
|
-
let r1x =
|
|
9528
|
-
let r1y =
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
let r2x = 0;
|
|
9532
|
-
let r2y = 0;
|
|
9533
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9534
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9506
|
+
let r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
9507
|
+
let r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
9508
|
+
let r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9509
|
+
let r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9535
9510
|
let slack;
|
|
9536
|
-
let nx =
|
|
9537
|
-
let ny =
|
|
9538
|
-
nx = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
9539
|
-
ny = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
9511
|
+
let nx = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
9512
|
+
let ny = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
9540
9513
|
let C = nx * nx + ny * ny;
|
|
9541
9514
|
if (C < ZPP_Constraint._nape.Config.epsilon) {
|
|
9542
9515
|
nx = 0;
|
|
@@ -9594,7 +9567,6 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9594
9567
|
nx = 0;
|
|
9595
9568
|
ny = 0;
|
|
9596
9569
|
C1 = 0;
|
|
9597
|
-
slack = true;
|
|
9598
9570
|
} else {
|
|
9599
9571
|
C1 = Math.sqrt(C1);
|
|
9600
9572
|
const t3 = 1 / C1;
|
|
@@ -9602,20 +9574,16 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9602
9574
|
ny *= t3;
|
|
9603
9575
|
if (this.equal) {
|
|
9604
9576
|
C1 -= this.jointMax;
|
|
9605
|
-
slack = false;
|
|
9606
9577
|
} else if (C1 < this.jointMin) {
|
|
9607
9578
|
C1 = this.jointMin - C1;
|
|
9608
9579
|
nx = -nx;
|
|
9609
9580
|
ny = -ny;
|
|
9610
|
-
slack = false;
|
|
9611
9581
|
} else if (C1 > this.jointMax) {
|
|
9612
9582
|
C1 -= this.jointMax;
|
|
9613
|
-
slack = false;
|
|
9614
9583
|
} else {
|
|
9615
9584
|
nx = 0;
|
|
9616
9585
|
ny = 0;
|
|
9617
9586
|
C1 = 0;
|
|
9618
|
-
slack = true;
|
|
9619
9587
|
}
|
|
9620
9588
|
}
|
|
9621
9589
|
E = C1;
|
|
@@ -10105,14 +10073,10 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10105
10073
|
this.nrely = this.nlocalx * this.b1.axisx + this.nlocaly * this.b1.axisy;
|
|
10106
10074
|
this.a2relx = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10107
10075
|
this.a2rely = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
let Cy =
|
|
10112
|
-
dx = this.b2.posx + this.a2relx - this.b1.posx - this.a1relx;
|
|
10113
|
-
dy = this.b2.posy + this.a2rely - this.b1.posy - this.a1rely;
|
|
10114
|
-
Cx = dy * this.nrelx - dx * this.nrely;
|
|
10115
|
-
Cy = this.nrelx * dx + this.nrely * dy;
|
|
10076
|
+
const dx = this.b2.posx + this.a2relx - this.b1.posx - this.a1relx;
|
|
10077
|
+
const dy = this.b2.posy + this.a2rely - this.b1.posy - this.a1rely;
|
|
10078
|
+
const Cx = dy * this.nrelx - dx * this.nrely;
|
|
10079
|
+
let Cy = this.nrelx * dx + this.nrely * dy;
|
|
10116
10080
|
if (this.equal) {
|
|
10117
10081
|
Cy -= this.jointMin;
|
|
10118
10082
|
this.scale = 1;
|
|
@@ -10219,20 +10183,14 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10219
10183
|
this.b2.angvel += (this.dot2 * this.jAccx - this.scale * this.cx2 * this.jAccy) * this.b2.iinertia;
|
|
10220
10184
|
}
|
|
10221
10185
|
applyImpulseVel() {
|
|
10222
|
-
let
|
|
10223
|
-
let
|
|
10224
|
-
let dvx = 0;
|
|
10225
|
-
let dvy = 0;
|
|
10226
|
-
dvx = this.b2.velx - this.b1.velx;
|
|
10227
|
-
dvy = this.b2.vely - this.b1.vely;
|
|
10186
|
+
let dvx = this.b2.velx - this.b1.velx;
|
|
10187
|
+
let dvy = this.b2.vely - this.b1.vely;
|
|
10228
10188
|
dvx += this.b2.kinvelx - this.b1.kinvelx;
|
|
10229
10189
|
dvy += this.b2.kinvely - this.b1.kinvely;
|
|
10230
|
-
Ex = dvy * this.nrelx - dvx * this.nrely + (this.b2.angvel + this.b2.kinangvel) * this.dot2 - (this.b1.angvel + this.b1.kinangvel) * this.dot1;
|
|
10231
|
-
Ey = this.scale * (this.nrelx * dvx + this.nrely * dvy - (this.b2.angvel + this.b2.kinangvel) * this.cx2 + (this.b1.angvel + this.b1.kinangvel) * this.cx1);
|
|
10232
|
-
let Jx =
|
|
10233
|
-
let Jy =
|
|
10234
|
-
Jx = this.biasx - Ex;
|
|
10235
|
-
Jy = this.biasy - Ey;
|
|
10190
|
+
const Ex = dvy * this.nrelx - dvx * this.nrely + (this.b2.angvel + this.b2.kinangvel) * this.dot2 - (this.b1.angvel + this.b1.kinangvel) * this.dot1;
|
|
10191
|
+
const Ey = this.scale * (this.nrelx * dvx + this.nrely * dvy - (this.b2.angvel + this.b2.kinangvel) * this.cx2 + (this.b1.angvel + this.b1.kinangvel) * this.cx1);
|
|
10192
|
+
let Jx = this.biasx - Ex;
|
|
10193
|
+
let Jy = this.biasy - Ey;
|
|
10236
10194
|
const t = this.kMassa * Jx + this.kMassb * Jy;
|
|
10237
10195
|
Jy = this.kMassb * Jx + this.kMassc * Jy;
|
|
10238
10196
|
Jx = t;
|
|
@@ -10275,27 +10233,17 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10275
10233
|
}
|
|
10276
10234
|
applyImpulsePos() {
|
|
10277
10235
|
const napeNs = ZPP_Constraint._nape;
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
let r2x = 0;
|
|
10287
|
-
let r2y = 0;
|
|
10288
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10289
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10290
|
-
let dx = 0;
|
|
10291
|
-
let dy = 0;
|
|
10236
|
+
const nx = this.b1.axisy * this.nlocalx - this.b1.axisx * this.nlocaly;
|
|
10237
|
+
const ny = this.nlocalx * this.b1.axisx + this.nlocaly * this.b1.axisy;
|
|
10238
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
10239
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
10240
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10241
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10242
|
+
let dx = this.b2.posx + r2x - this.b1.posx - r1x;
|
|
10243
|
+
let dy = this.b2.posy + r2y - this.b1.posy - r1y;
|
|
10292
10244
|
let scale;
|
|
10293
|
-
let Ex =
|
|
10294
|
-
let Ey =
|
|
10295
|
-
dx = this.b2.posx + r2x - this.b1.posx - r1x;
|
|
10296
|
-
dy = this.b2.posy + r2y - this.b1.posy - r1y;
|
|
10297
|
-
Ex = dy * nx - dx * ny;
|
|
10298
|
-
Ey = nx * dx + ny * dy;
|
|
10245
|
+
let Ex = dy * nx - dx * ny;
|
|
10246
|
+
let Ey = nx * dx + ny * dy;
|
|
10299
10247
|
if (this.equal) {
|
|
10300
10248
|
Ey -= this.jointMin;
|
|
10301
10249
|
scale = 1;
|
|
@@ -11167,14 +11115,10 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11167
11115
|
this.b2.angvel += (this.jAccy * this.a2relx - this.jAccx * this.a2rely) * this.b2.iinertia;
|
|
11168
11116
|
}
|
|
11169
11117
|
applyImpulseVel() {
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
let Jx = 0;
|
|
11175
|
-
let Jy = 0;
|
|
11176
|
-
Jx = this.biasx - Ex;
|
|
11177
|
-
Jy = this.biasy - Ey;
|
|
11118
|
+
const Ex = this.b2.velx + this.b2.kinvelx - this.a2rely * (this.b2.angvel + this.b2.kinangvel) - (this.b1.velx + this.b1.kinvelx - this.a1rely * (this.b1.angvel + this.b1.kinangvel));
|
|
11119
|
+
const Ey = this.b2.vely + this.b2.kinvely + this.a2relx * (this.b2.angvel + this.b2.kinangvel) - (this.b1.vely + this.b1.kinvely + this.a1relx * (this.b1.angvel + this.b1.kinangvel));
|
|
11120
|
+
let Jx = this.biasx - Ex;
|
|
11121
|
+
let Jy = this.biasy - Ey;
|
|
11178
11122
|
const t = this.kMassa * Jx + this.kMassb * Jy;
|
|
11179
11123
|
Jy = this.kMassb * Jx + this.kMassc * Jy;
|
|
11180
11124
|
Jx = t;
|
|
@@ -11213,18 +11157,12 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11213
11157
|
}
|
|
11214
11158
|
applyImpulsePos() {
|
|
11215
11159
|
const napeNs = ZPP_Constraint._nape;
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
let
|
|
11221
|
-
let
|
|
11222
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
11223
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
11224
|
-
let Ex = 0;
|
|
11225
|
-
let Ey = 0;
|
|
11226
|
-
Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
11227
|
-
Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
11160
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
11161
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
11162
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
11163
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
11164
|
+
let Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
11165
|
+
let Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
11228
11166
|
if (this.breakUnderError && Ex * Ex + Ey * Ey > this.maxError * this.maxError) {
|
|
11229
11167
|
return true;
|
|
11230
11168
|
}
|
|
@@ -11234,8 +11172,8 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11234
11172
|
const t = 0.5;
|
|
11235
11173
|
Ex *= t;
|
|
11236
11174
|
Ey *= t;
|
|
11237
|
-
let Jx
|
|
11238
|
-
let Jy
|
|
11175
|
+
let Jx;
|
|
11176
|
+
let Jy;
|
|
11239
11177
|
if (Ex * Ex + Ey * Ey > 6) {
|
|
11240
11178
|
const k = this.b1.smass + this.b2.smass;
|
|
11241
11179
|
if (k > napeNs.Config.epsilon) {
|
|
@@ -11262,13 +11200,10 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11262
11200
|
Ey *= t5;
|
|
11263
11201
|
}
|
|
11264
11202
|
}
|
|
11265
|
-
let Ka = 0;
|
|
11266
|
-
let Kb = 0;
|
|
11267
|
-
let Kc = 0;
|
|
11268
11203
|
const m = this.b1.smass + this.b2.smass;
|
|
11269
|
-
Ka = m;
|
|
11270
|
-
Kb = 0;
|
|
11271
|
-
Kc = m;
|
|
11204
|
+
let Ka = m;
|
|
11205
|
+
let Kb = 0;
|
|
11206
|
+
let Kc = m;
|
|
11272
11207
|
if (this.b1.sinertia != 0) {
|
|
11273
11208
|
const X = r1x * this.b1.sinertia;
|
|
11274
11209
|
const Y = r1y * this.b1.sinertia;
|
|
@@ -12190,22 +12125,14 @@ var _ZPP_PulleyJoint = class _ZPP_PulleyJoint extends ZPP_Constraint {
|
|
|
12190
12125
|
applyImpulsePos() {
|
|
12191
12126
|
const napeNs = ZPP_Constraint._nape;
|
|
12192
12127
|
let j;
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
let r3x = 0;
|
|
12202
|
-
let r3y = 0;
|
|
12203
|
-
r3x = this.b3.axisy * this.a3localx - this.b3.axisx * this.a3localy;
|
|
12204
|
-
r3y = this.a3localx * this.b3.axisx + this.a3localy * this.b3.axisy;
|
|
12205
|
-
let r4x = 0;
|
|
12206
|
-
let r4y = 0;
|
|
12207
|
-
r4x = this.b4.axisy * this.a4localx - this.b4.axisx * this.a4localy;
|
|
12208
|
-
r4y = this.a4localx * this.b4.axisx + this.a4localy * this.b4.axisy;
|
|
12128
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
12129
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
12130
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
12131
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
12132
|
+
const r3x = this.b3.axisy * this.a3localx - this.b3.axisx * this.a3localy;
|
|
12133
|
+
const r3y = this.a3localx * this.b3.axisx + this.a3localy * this.b3.axisy;
|
|
12134
|
+
const r4x = this.b4.axisy * this.a4localx - this.b4.axisx * this.a4localy;
|
|
12135
|
+
const r4y = this.a4localx * this.b4.axisx + this.a4localy * this.b4.axisy;
|
|
12209
12136
|
let slack;
|
|
12210
12137
|
let n12x = this.n12x;
|
|
12211
12138
|
let n12y = this.n12y;
|
|
@@ -12309,24 +12236,20 @@ var _ZPP_PulleyJoint = class _ZPP_PulleyJoint extends ZPP_Constraint {
|
|
|
12309
12236
|
let C1 = C121 + this.ratio * C341;
|
|
12310
12237
|
if (this.equal) {
|
|
12311
12238
|
C1 -= this.jointMax;
|
|
12312
|
-
slack = false;
|
|
12313
12239
|
} else if (C1 < this.jointMin) {
|
|
12314
12240
|
C1 = this.jointMin - C1;
|
|
12315
12241
|
n12x = -n12x;
|
|
12316
12242
|
n12y = -n12y;
|
|
12317
12243
|
n34x = -n34x;
|
|
12318
12244
|
n34y = -n34y;
|
|
12319
|
-
slack = false;
|
|
12320
12245
|
} else if (C1 > this.jointMax) {
|
|
12321
12246
|
C1 -= this.jointMax;
|
|
12322
|
-
slack = false;
|
|
12323
12247
|
} else {
|
|
12324
12248
|
n12x = 0;
|
|
12325
12249
|
n12y = 0;
|
|
12326
12250
|
n34x = 0;
|
|
12327
12251
|
n34y = 0;
|
|
12328
12252
|
C1 = 0;
|
|
12329
|
-
slack = true;
|
|
12330
12253
|
}
|
|
12331
12254
|
E = C1;
|
|
12332
12255
|
E *= 0.5;
|
|
@@ -13464,18 +13387,12 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13464
13387
|
this.b2.angvel += (this.jAccy * this.a2relx - this.jAccx * this.a2rely + this.jAccz) * this.b2.iinertia;
|
|
13465
13388
|
}
|
|
13466
13389
|
applyImpulseVel() {
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
let Jx = 0;
|
|
13474
|
-
let Jy = 0;
|
|
13475
|
-
let Jz = 0;
|
|
13476
|
-
Jx = this.biasx - Ex;
|
|
13477
|
-
Jy = this.biasy - Ey;
|
|
13478
|
-
Jz = this.biasz - Ez;
|
|
13390
|
+
const Ex = this.b2.velx + this.b2.kinvelx - this.a2rely * (this.b2.angvel + this.b2.kinangvel) - (this.b1.velx + this.b1.kinvelx - this.a1rely * (this.b1.angvel + this.b1.kinangvel));
|
|
13391
|
+
const Ey = this.b2.vely + this.b2.kinvely + this.a2relx * (this.b2.angvel + this.b2.kinangvel) - (this.b1.vely + this.b1.kinvely + this.a1relx * (this.b1.angvel + this.b1.kinangvel));
|
|
13392
|
+
const Ez = this.b2.angvel + this.b2.kinangvel - this.b1.angvel - this.b1.kinangvel;
|
|
13393
|
+
let Jx = this.biasx - Ex;
|
|
13394
|
+
let Jy = this.biasy - Ey;
|
|
13395
|
+
let Jz = this.biasz - Ez;
|
|
13479
13396
|
const X = this.kMassa * Jx + this.kMassb * Jy + this.kMassc * Jz;
|
|
13480
13397
|
const Y = this.kMassb * Jx + this.kMassd * Jy + this.kMasse * Jz;
|
|
13481
13398
|
Jz = this.kMassc * Jx + this.kMasse * Jy + this.kMassf * Jz;
|
|
@@ -13519,23 +13436,16 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13519
13436
|
}
|
|
13520
13437
|
applyImpulsePos() {
|
|
13521
13438
|
const napeNs = ZPP_Constraint._nape;
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
let
|
|
13527
|
-
let
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
let
|
|
13531
|
-
let
|
|
13532
|
-
let Ez = 0;
|
|
13533
|
-
Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
13534
|
-
Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
13535
|
-
Ez = this.b2.rot - this.b1.rot - this.phase;
|
|
13536
|
-
let Jx = 0;
|
|
13537
|
-
let Jy = 0;
|
|
13538
|
-
let Jz = 0;
|
|
13439
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
13440
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
13441
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
13442
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
13443
|
+
let Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
13444
|
+
let Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
13445
|
+
let Ez = this.b2.rot - this.b1.rot - this.phase;
|
|
13446
|
+
let Jx;
|
|
13447
|
+
let Jy;
|
|
13448
|
+
let Jz;
|
|
13539
13449
|
if (this.breakUnderError && Ex * Ex + Ey * Ey + Ez * Ez > this.maxError * this.maxError) {
|
|
13540
13450
|
return true;
|
|
13541
13451
|
}
|
|
@@ -13583,19 +13493,13 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13583
13493
|
Ez *= 0.5;
|
|
13584
13494
|
}
|
|
13585
13495
|
}
|
|
13586
|
-
|
|
13496
|
+
const m = this.b1.smass + this.b2.smass;
|
|
13497
|
+
let Ka = m;
|
|
13587
13498
|
let Kb = 0;
|
|
13588
|
-
let Kd =
|
|
13499
|
+
let Kd = m;
|
|
13589
13500
|
let Kc = 0;
|
|
13590
13501
|
let Ke = 0;
|
|
13591
13502
|
let Kf = 0;
|
|
13592
|
-
const m = this.b1.smass + this.b2.smass;
|
|
13593
|
-
Ka = m;
|
|
13594
|
-
Kb = 0;
|
|
13595
|
-
Kd = m;
|
|
13596
|
-
Kc = 0;
|
|
13597
|
-
Ke = 0;
|
|
13598
|
-
Kf = 0;
|
|
13599
13503
|
if (this.b1.sinertia != 0) {
|
|
13600
13504
|
const X = r1x * this.b1.sinertia;
|
|
13601
13505
|
const Y = r1y * this.b1.sinertia;
|
|
@@ -88677,7 +88581,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
|
|
|
88677
88581
|
};
|
|
88678
88582
|
|
|
88679
88583
|
// src/index.ts
|
|
88680
|
-
var VERSION = "3.3.
|
|
88584
|
+
var VERSION = "3.3.29";
|
|
88681
88585
|
// Annotate the CommonJS export names for ESM import in node:
|
|
88682
88586
|
0 && (module.exports = {
|
|
88683
88587
|
AABB,
|