@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.js
CHANGED
|
@@ -6791,8 +6791,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6791
6791
|
this.r1y = this.centroidy - this.b1.posy;
|
|
6792
6792
|
this.r2x = this.centroidx - this.b2.posx;
|
|
6793
6793
|
this.r2y = this.centroidy - this.b2.posy;
|
|
6794
|
-
let g1x
|
|
6795
|
-
let g1y
|
|
6794
|
+
let g1x;
|
|
6795
|
+
let g1y;
|
|
6796
6796
|
if (this.ws1.fluidEnabled && this.ws1.fluidProperties.wrap_gravity != null) {
|
|
6797
6797
|
g1x = this.ws1.fluidProperties.gravityx;
|
|
6798
6798
|
g1y = this.ws1.fluidProperties.gravityy;
|
|
@@ -6800,8 +6800,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6800
6800
|
g1x = s.gravityx;
|
|
6801
6801
|
g1y = s.gravityy;
|
|
6802
6802
|
}
|
|
6803
|
-
let g2x
|
|
6804
|
-
let g2y
|
|
6803
|
+
let g2x;
|
|
6804
|
+
let g2y;
|
|
6805
6805
|
if (this.ws2.fluidEnabled && this.ws2.fluidProperties.wrap_gravity != null) {
|
|
6806
6806
|
g2x = this.ws2.fluidProperties.gravityx;
|
|
6807
6807
|
g2y = this.ws2.fluidProperties.gravityy;
|
|
@@ -6823,10 +6823,8 @@ var _ZPP_FluidArbiter = class _ZPP_FluidArbiter extends ZPP_Arbiter {
|
|
|
6823
6823
|
buoyx += g2x * t;
|
|
6824
6824
|
buoyy += g2y * t;
|
|
6825
6825
|
} else {
|
|
6826
|
-
let gx =
|
|
6827
|
-
let gy =
|
|
6828
|
-
gx = g1x + g2x;
|
|
6829
|
-
gy = g1y + g2y;
|
|
6826
|
+
let gx = g1x + g2x;
|
|
6827
|
+
let gy = g1y + g2y;
|
|
6830
6828
|
const t = 0.5;
|
|
6831
6829
|
gx *= t;
|
|
6832
6830
|
gy *= t;
|
|
@@ -7589,11 +7587,9 @@ var _ZPP_ColArbiter = class _ZPP_ColArbiter extends ZPP_Arbiter {
|
|
|
7589
7587
|
x = this.ny * ci.r1x - this.nx * ci.r1y;
|
|
7590
7588
|
nt += this.b1.sinertia * (x * x);
|
|
7591
7589
|
ci.nMass = nt < napeNs.Config.epsilon * napeNs.Config.epsilon ? 0 : 1 / nt;
|
|
7592
|
-
let vrx = 0;
|
|
7593
|
-
let vry = 0;
|
|
7594
7590
|
let ang = this.b2.angvel + this.b2.kinangvel;
|
|
7595
|
-
vrx = this.b2.velx + this.b2.kinvelx - ci.r2y * ang;
|
|
7596
|
-
vry = this.b2.vely + this.b2.kinvely + ci.r2x * ang;
|
|
7591
|
+
let vrx = this.b2.velx + this.b2.kinvelx - ci.r2y * ang;
|
|
7592
|
+
let vry = this.b2.vely + this.b2.kinvely + ci.r2x * ang;
|
|
7597
7593
|
ang = this.b1.angvel + this.b1.kinangvel;
|
|
7598
7594
|
vrx -= this.b1.velx + this.b1.kinvelx - ci.r1y * ang;
|
|
7599
7595
|
vry -= this.b1.vely + this.b1.kinvely + ci.r1x * ang;
|
|
@@ -7734,7 +7730,6 @@ var _ZPP_ColArbiter = class _ZPP_ColArbiter extends ZPP_Arbiter {
|
|
|
7734
7730
|
}
|
|
7735
7731
|
// ========== Velocity impulse solver ==========
|
|
7736
7732
|
applyImpulseVel() {
|
|
7737
|
-
const napeNs = ZPP_Arbiter._nape;
|
|
7738
7733
|
let v1x = this.k1x + this.b2.velx - this.c1.r2y * this.b2.angvel - (this.b1.velx - this.c1.r1y * this.b1.angvel);
|
|
7739
7734
|
let v1y = this.k1y + this.b2.vely + this.c1.r2x * this.b2.angvel - (this.b1.vely + this.c1.r1x * this.b1.angvel);
|
|
7740
7735
|
let j = (v1y * this.nx - v1x * this.ny + this.surfacex) * this.c1.tMass;
|
|
@@ -9134,36 +9129,20 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9134
9129
|
this.a1rely = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
9135
9130
|
this.a2relx = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9136
9131
|
this.a2rely = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9137
|
-
let nx =
|
|
9138
|
-
let ny =
|
|
9139
|
-
nx = this.b2.posx + this.a2relx - (this.b1.posx + this.a1relx);
|
|
9140
|
-
ny = this.b2.posy + this.a2rely - (this.b1.posy + this.a1rely);
|
|
9132
|
+
let nx = this.b2.posx + this.a2relx - (this.b1.posx + this.a1relx);
|
|
9133
|
+
let ny = this.b2.posy + this.a2rely - (this.b1.posy + this.a1rely);
|
|
9141
9134
|
let C = nx * nx + ny * ny;
|
|
9142
9135
|
if (C < ZPP_Constraint._nape.Config.epsilon) {
|
|
9143
|
-
nx = 0;
|
|
9144
|
-
ny = 0;
|
|
9145
|
-
C = 0;
|
|
9146
9136
|
slack = true;
|
|
9147
9137
|
} else {
|
|
9148
9138
|
C = Math.sqrt(C);
|
|
9149
|
-
const t = 1 / C;
|
|
9150
|
-
nx *= t;
|
|
9151
|
-
ny *= t;
|
|
9152
9139
|
if (this.equal) {
|
|
9153
|
-
C -= this.jointMax;
|
|
9154
9140
|
slack = false;
|
|
9155
9141
|
} else if (C < this.jointMin) {
|
|
9156
|
-
C = this.jointMin - C;
|
|
9157
|
-
nx = -nx;
|
|
9158
|
-
ny = -ny;
|
|
9159
9142
|
slack = false;
|
|
9160
9143
|
} else if (C > this.jointMax) {
|
|
9161
|
-
C -= this.jointMax;
|
|
9162
9144
|
slack = false;
|
|
9163
9145
|
} else {
|
|
9164
|
-
nx = 0;
|
|
9165
|
-
ny = 0;
|
|
9166
|
-
C = 0;
|
|
9167
9146
|
slack = true;
|
|
9168
9147
|
}
|
|
9169
9148
|
}
|
|
@@ -9437,19 +9416,13 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9437
9416
|
}
|
|
9438
9417
|
applyImpulsePos() {
|
|
9439
9418
|
let j;
|
|
9440
|
-
let r1x =
|
|
9441
|
-
let r1y =
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
let r2x = 0;
|
|
9445
|
-
let r2y = 0;
|
|
9446
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9447
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9419
|
+
let r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
9420
|
+
let r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
9421
|
+
let r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
9422
|
+
let r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
9448
9423
|
let slack;
|
|
9449
|
-
let nx =
|
|
9450
|
-
let ny =
|
|
9451
|
-
nx = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
9452
|
-
ny = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
9424
|
+
let nx = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
9425
|
+
let ny = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
9453
9426
|
let C = nx * nx + ny * ny;
|
|
9454
9427
|
if (C < ZPP_Constraint._nape.Config.epsilon) {
|
|
9455
9428
|
nx = 0;
|
|
@@ -9507,7 +9480,6 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9507
9480
|
nx = 0;
|
|
9508
9481
|
ny = 0;
|
|
9509
9482
|
C1 = 0;
|
|
9510
|
-
slack = true;
|
|
9511
9483
|
} else {
|
|
9512
9484
|
C1 = Math.sqrt(C1);
|
|
9513
9485
|
const t3 = 1 / C1;
|
|
@@ -9515,20 +9487,16 @@ var _ZPP_DistanceJoint = class _ZPP_DistanceJoint extends ZPP_Constraint {
|
|
|
9515
9487
|
ny *= t3;
|
|
9516
9488
|
if (this.equal) {
|
|
9517
9489
|
C1 -= this.jointMax;
|
|
9518
|
-
slack = false;
|
|
9519
9490
|
} else if (C1 < this.jointMin) {
|
|
9520
9491
|
C1 = this.jointMin - C1;
|
|
9521
9492
|
nx = -nx;
|
|
9522
9493
|
ny = -ny;
|
|
9523
|
-
slack = false;
|
|
9524
9494
|
} else if (C1 > this.jointMax) {
|
|
9525
9495
|
C1 -= this.jointMax;
|
|
9526
|
-
slack = false;
|
|
9527
9496
|
} else {
|
|
9528
9497
|
nx = 0;
|
|
9529
9498
|
ny = 0;
|
|
9530
9499
|
C1 = 0;
|
|
9531
|
-
slack = true;
|
|
9532
9500
|
}
|
|
9533
9501
|
}
|
|
9534
9502
|
E = C1;
|
|
@@ -10018,14 +9986,10 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10018
9986
|
this.nrely = this.nlocalx * this.b1.axisx + this.nlocaly * this.b1.axisy;
|
|
10019
9987
|
this.a2relx = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10020
9988
|
this.a2rely = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
let Cy =
|
|
10025
|
-
dx = this.b2.posx + this.a2relx - this.b1.posx - this.a1relx;
|
|
10026
|
-
dy = this.b2.posy + this.a2rely - this.b1.posy - this.a1rely;
|
|
10027
|
-
Cx = dy * this.nrelx - dx * this.nrely;
|
|
10028
|
-
Cy = this.nrelx * dx + this.nrely * dy;
|
|
9989
|
+
const dx = this.b2.posx + this.a2relx - this.b1.posx - this.a1relx;
|
|
9990
|
+
const dy = this.b2.posy + this.a2rely - this.b1.posy - this.a1rely;
|
|
9991
|
+
const Cx = dy * this.nrelx - dx * this.nrely;
|
|
9992
|
+
let Cy = this.nrelx * dx + this.nrely * dy;
|
|
10029
9993
|
if (this.equal) {
|
|
10030
9994
|
Cy -= this.jointMin;
|
|
10031
9995
|
this.scale = 1;
|
|
@@ -10132,20 +10096,14 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10132
10096
|
this.b2.angvel += (this.dot2 * this.jAccx - this.scale * this.cx2 * this.jAccy) * this.b2.iinertia;
|
|
10133
10097
|
}
|
|
10134
10098
|
applyImpulseVel() {
|
|
10135
|
-
let
|
|
10136
|
-
let
|
|
10137
|
-
let dvx = 0;
|
|
10138
|
-
let dvy = 0;
|
|
10139
|
-
dvx = this.b2.velx - this.b1.velx;
|
|
10140
|
-
dvy = this.b2.vely - this.b1.vely;
|
|
10099
|
+
let dvx = this.b2.velx - this.b1.velx;
|
|
10100
|
+
let dvy = this.b2.vely - this.b1.vely;
|
|
10141
10101
|
dvx += this.b2.kinvelx - this.b1.kinvelx;
|
|
10142
10102
|
dvy += this.b2.kinvely - this.b1.kinvely;
|
|
10143
|
-
Ex = dvy * this.nrelx - dvx * this.nrely + (this.b2.angvel + this.b2.kinangvel) * this.dot2 - (this.b1.angvel + this.b1.kinangvel) * this.dot1;
|
|
10144
|
-
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);
|
|
10145
|
-
let Jx =
|
|
10146
|
-
let Jy =
|
|
10147
|
-
Jx = this.biasx - Ex;
|
|
10148
|
-
Jy = this.biasy - Ey;
|
|
10103
|
+
const Ex = dvy * this.nrelx - dvx * this.nrely + (this.b2.angvel + this.b2.kinangvel) * this.dot2 - (this.b1.angvel + this.b1.kinangvel) * this.dot1;
|
|
10104
|
+
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);
|
|
10105
|
+
let Jx = this.biasx - Ex;
|
|
10106
|
+
let Jy = this.biasy - Ey;
|
|
10149
10107
|
const t = this.kMassa * Jx + this.kMassb * Jy;
|
|
10150
10108
|
Jy = this.kMassb * Jx + this.kMassc * Jy;
|
|
10151
10109
|
Jx = t;
|
|
@@ -10188,27 +10146,17 @@ var _ZPP_LineJoint = class _ZPP_LineJoint extends ZPP_Constraint {
|
|
|
10188
10146
|
}
|
|
10189
10147
|
applyImpulsePos() {
|
|
10190
10148
|
const napeNs = ZPP_Constraint._nape;
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
let r2x = 0;
|
|
10200
|
-
let r2y = 0;
|
|
10201
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10202
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10203
|
-
let dx = 0;
|
|
10204
|
-
let dy = 0;
|
|
10149
|
+
const nx = this.b1.axisy * this.nlocalx - this.b1.axisx * this.nlocaly;
|
|
10150
|
+
const ny = this.nlocalx * this.b1.axisx + this.nlocaly * this.b1.axisy;
|
|
10151
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
10152
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
10153
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
10154
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
10155
|
+
let dx = this.b2.posx + r2x - this.b1.posx - r1x;
|
|
10156
|
+
let dy = this.b2.posy + r2y - this.b1.posy - r1y;
|
|
10205
10157
|
let scale;
|
|
10206
|
-
let Ex =
|
|
10207
|
-
let Ey =
|
|
10208
|
-
dx = this.b2.posx + r2x - this.b1.posx - r1x;
|
|
10209
|
-
dy = this.b2.posy + r2y - this.b1.posy - r1y;
|
|
10210
|
-
Ex = dy * nx - dx * ny;
|
|
10211
|
-
Ey = nx * dx + ny * dy;
|
|
10158
|
+
let Ex = dy * nx - dx * ny;
|
|
10159
|
+
let Ey = nx * dx + ny * dy;
|
|
10212
10160
|
if (this.equal) {
|
|
10213
10161
|
Ey -= this.jointMin;
|
|
10214
10162
|
scale = 1;
|
|
@@ -11080,14 +11028,10 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11080
11028
|
this.b2.angvel += (this.jAccy * this.a2relx - this.jAccx * this.a2rely) * this.b2.iinertia;
|
|
11081
11029
|
}
|
|
11082
11030
|
applyImpulseVel() {
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
let Jx = 0;
|
|
11088
|
-
let Jy = 0;
|
|
11089
|
-
Jx = this.biasx - Ex;
|
|
11090
|
-
Jy = this.biasy - Ey;
|
|
11031
|
+
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));
|
|
11032
|
+
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));
|
|
11033
|
+
let Jx = this.biasx - Ex;
|
|
11034
|
+
let Jy = this.biasy - Ey;
|
|
11091
11035
|
const t = this.kMassa * Jx + this.kMassb * Jy;
|
|
11092
11036
|
Jy = this.kMassb * Jx + this.kMassc * Jy;
|
|
11093
11037
|
Jx = t;
|
|
@@ -11126,18 +11070,12 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11126
11070
|
}
|
|
11127
11071
|
applyImpulsePos() {
|
|
11128
11072
|
const napeNs = ZPP_Constraint._nape;
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
let
|
|
11134
|
-
let
|
|
11135
|
-
r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
11136
|
-
r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
11137
|
-
let Ex = 0;
|
|
11138
|
-
let Ey = 0;
|
|
11139
|
-
Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
11140
|
-
Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
11073
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
11074
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
11075
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
11076
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
11077
|
+
let Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
11078
|
+
let Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
11141
11079
|
if (this.breakUnderError && Ex * Ex + Ey * Ey > this.maxError * this.maxError) {
|
|
11142
11080
|
return true;
|
|
11143
11081
|
}
|
|
@@ -11147,8 +11085,8 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11147
11085
|
const t = 0.5;
|
|
11148
11086
|
Ex *= t;
|
|
11149
11087
|
Ey *= t;
|
|
11150
|
-
let Jx
|
|
11151
|
-
let Jy
|
|
11088
|
+
let Jx;
|
|
11089
|
+
let Jy;
|
|
11152
11090
|
if (Ex * Ex + Ey * Ey > 6) {
|
|
11153
11091
|
const k = this.b1.smass + this.b2.smass;
|
|
11154
11092
|
if (k > napeNs.Config.epsilon) {
|
|
@@ -11175,13 +11113,10 @@ var _ZPP_PivotJoint = class _ZPP_PivotJoint extends ZPP_Constraint {
|
|
|
11175
11113
|
Ey *= t5;
|
|
11176
11114
|
}
|
|
11177
11115
|
}
|
|
11178
|
-
let Ka = 0;
|
|
11179
|
-
let Kb = 0;
|
|
11180
|
-
let Kc = 0;
|
|
11181
11116
|
const m = this.b1.smass + this.b2.smass;
|
|
11182
|
-
Ka = m;
|
|
11183
|
-
Kb = 0;
|
|
11184
|
-
Kc = m;
|
|
11117
|
+
let Ka = m;
|
|
11118
|
+
let Kb = 0;
|
|
11119
|
+
let Kc = m;
|
|
11185
11120
|
if (this.b1.sinertia != 0) {
|
|
11186
11121
|
const X = r1x * this.b1.sinertia;
|
|
11187
11122
|
const Y = r1y * this.b1.sinertia;
|
|
@@ -12103,22 +12038,14 @@ var _ZPP_PulleyJoint = class _ZPP_PulleyJoint extends ZPP_Constraint {
|
|
|
12103
12038
|
applyImpulsePos() {
|
|
12104
12039
|
const napeNs = ZPP_Constraint._nape;
|
|
12105
12040
|
let j;
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
let r3x = 0;
|
|
12115
|
-
let r3y = 0;
|
|
12116
|
-
r3x = this.b3.axisy * this.a3localx - this.b3.axisx * this.a3localy;
|
|
12117
|
-
r3y = this.a3localx * this.b3.axisx + this.a3localy * this.b3.axisy;
|
|
12118
|
-
let r4x = 0;
|
|
12119
|
-
let r4y = 0;
|
|
12120
|
-
r4x = this.b4.axisy * this.a4localx - this.b4.axisx * this.a4localy;
|
|
12121
|
-
r4y = this.a4localx * this.b4.axisx + this.a4localy * this.b4.axisy;
|
|
12041
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
12042
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
12043
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
12044
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
12045
|
+
const r3x = this.b3.axisy * this.a3localx - this.b3.axisx * this.a3localy;
|
|
12046
|
+
const r3y = this.a3localx * this.b3.axisx + this.a3localy * this.b3.axisy;
|
|
12047
|
+
const r4x = this.b4.axisy * this.a4localx - this.b4.axisx * this.a4localy;
|
|
12048
|
+
const r4y = this.a4localx * this.b4.axisx + this.a4localy * this.b4.axisy;
|
|
12122
12049
|
let slack;
|
|
12123
12050
|
let n12x = this.n12x;
|
|
12124
12051
|
let n12y = this.n12y;
|
|
@@ -12222,24 +12149,20 @@ var _ZPP_PulleyJoint = class _ZPP_PulleyJoint extends ZPP_Constraint {
|
|
|
12222
12149
|
let C1 = C121 + this.ratio * C341;
|
|
12223
12150
|
if (this.equal) {
|
|
12224
12151
|
C1 -= this.jointMax;
|
|
12225
|
-
slack = false;
|
|
12226
12152
|
} else if (C1 < this.jointMin) {
|
|
12227
12153
|
C1 = this.jointMin - C1;
|
|
12228
12154
|
n12x = -n12x;
|
|
12229
12155
|
n12y = -n12y;
|
|
12230
12156
|
n34x = -n34x;
|
|
12231
12157
|
n34y = -n34y;
|
|
12232
|
-
slack = false;
|
|
12233
12158
|
} else if (C1 > this.jointMax) {
|
|
12234
12159
|
C1 -= this.jointMax;
|
|
12235
|
-
slack = false;
|
|
12236
12160
|
} else {
|
|
12237
12161
|
n12x = 0;
|
|
12238
12162
|
n12y = 0;
|
|
12239
12163
|
n34x = 0;
|
|
12240
12164
|
n34y = 0;
|
|
12241
12165
|
C1 = 0;
|
|
12242
|
-
slack = true;
|
|
12243
12166
|
}
|
|
12244
12167
|
E = C1;
|
|
12245
12168
|
E *= 0.5;
|
|
@@ -13377,18 +13300,12 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13377
13300
|
this.b2.angvel += (this.jAccy * this.a2relx - this.jAccx * this.a2rely + this.jAccz) * this.b2.iinertia;
|
|
13378
13301
|
}
|
|
13379
13302
|
applyImpulseVel() {
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
let Jx = 0;
|
|
13387
|
-
let Jy = 0;
|
|
13388
|
-
let Jz = 0;
|
|
13389
|
-
Jx = this.biasx - Ex;
|
|
13390
|
-
Jy = this.biasy - Ey;
|
|
13391
|
-
Jz = this.biasz - Ez;
|
|
13303
|
+
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));
|
|
13304
|
+
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));
|
|
13305
|
+
const Ez = this.b2.angvel + this.b2.kinangvel - this.b1.angvel - this.b1.kinangvel;
|
|
13306
|
+
let Jx = this.biasx - Ex;
|
|
13307
|
+
let Jy = this.biasy - Ey;
|
|
13308
|
+
let Jz = this.biasz - Ez;
|
|
13392
13309
|
const X = this.kMassa * Jx + this.kMassb * Jy + this.kMassc * Jz;
|
|
13393
13310
|
const Y = this.kMassb * Jx + this.kMassd * Jy + this.kMasse * Jz;
|
|
13394
13311
|
Jz = this.kMassc * Jx + this.kMasse * Jy + this.kMassf * Jz;
|
|
@@ -13432,23 +13349,16 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13432
13349
|
}
|
|
13433
13350
|
applyImpulsePos() {
|
|
13434
13351
|
const napeNs = ZPP_Constraint._nape;
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
let
|
|
13440
|
-
let
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
let
|
|
13444
|
-
let
|
|
13445
|
-
let Ez = 0;
|
|
13446
|
-
Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
13447
|
-
Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
13448
|
-
Ez = this.b2.rot - this.b1.rot - this.phase;
|
|
13449
|
-
let Jx = 0;
|
|
13450
|
-
let Jy = 0;
|
|
13451
|
-
let Jz = 0;
|
|
13352
|
+
const r1x = this.b1.axisy * this.a1localx - this.b1.axisx * this.a1localy;
|
|
13353
|
+
const r1y = this.a1localx * this.b1.axisx + this.a1localy * this.b1.axisy;
|
|
13354
|
+
const r2x = this.b2.axisy * this.a2localx - this.b2.axisx * this.a2localy;
|
|
13355
|
+
const r2y = this.a2localx * this.b2.axisx + this.a2localy * this.b2.axisy;
|
|
13356
|
+
let Ex = this.b2.posx + r2x - (this.b1.posx + r1x);
|
|
13357
|
+
let Ey = this.b2.posy + r2y - (this.b1.posy + r1y);
|
|
13358
|
+
let Ez = this.b2.rot - this.b1.rot - this.phase;
|
|
13359
|
+
let Jx;
|
|
13360
|
+
let Jy;
|
|
13361
|
+
let Jz;
|
|
13452
13362
|
if (this.breakUnderError && Ex * Ex + Ey * Ey + Ez * Ez > this.maxError * this.maxError) {
|
|
13453
13363
|
return true;
|
|
13454
13364
|
}
|
|
@@ -13496,19 +13406,13 @@ var _ZPP_WeldJoint = class _ZPP_WeldJoint extends ZPP_Constraint {
|
|
|
13496
13406
|
Ez *= 0.5;
|
|
13497
13407
|
}
|
|
13498
13408
|
}
|
|
13499
|
-
|
|
13409
|
+
const m = this.b1.smass + this.b2.smass;
|
|
13410
|
+
let Ka = m;
|
|
13500
13411
|
let Kb = 0;
|
|
13501
|
-
let Kd =
|
|
13412
|
+
let Kd = m;
|
|
13502
13413
|
let Kc = 0;
|
|
13503
13414
|
let Ke = 0;
|
|
13504
13415
|
let Kf = 0;
|
|
13505
|
-
const m = this.b1.smass + this.b2.smass;
|
|
13506
|
-
Ka = m;
|
|
13507
|
-
Kb = 0;
|
|
13508
|
-
Kd = m;
|
|
13509
|
-
Kc = 0;
|
|
13510
|
-
Ke = 0;
|
|
13511
|
-
Kf = 0;
|
|
13512
13416
|
if (this.b1.sinertia != 0) {
|
|
13513
13417
|
const X = r1x * this.b1.sinertia;
|
|
13514
13418
|
const Y = r1y * this.b1.sinertia;
|
|
@@ -88590,7 +88494,7 @@ var PulleyJoint = class _PulleyJoint extends Constraint {
|
|
|
88590
88494
|
};
|
|
88591
88495
|
|
|
88592
88496
|
// src/index.ts
|
|
88593
|
-
var VERSION = "3.3.
|
|
88497
|
+
var VERSION = "3.3.29";
|
|
88594
88498
|
export {
|
|
88595
88499
|
AABB,
|
|
88596
88500
|
AngleJoint,
|