@adatechnology/game-vehicles-three 0.9.12 → 0.10.0
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/README.md +4 -0
- package/dist/{chunk-GEB4YOV7.js → chunk-5T52WAQS.js} +57 -3
- package/dist/chunk-5T52WAQS.js.map +1 -0
- package/dist/index.d.ts +24 -4
- package/dist/index.global.js +955 -99
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/{testing-CY8IYz1H.d.ts → testing-CRVetKNa.d.ts} +10 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +5 -3
- package/package.json +11 -11
- package/dist/chunk-GEB4YOV7.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -39,6 +39,7 @@ var GameVehiclesThree = (() => {
|
|
|
39
39
|
PROVING_AREA_ID: () => PROVING_AREA_ID,
|
|
40
40
|
PROVING_TEXT: () => PROVING_TEXT,
|
|
41
41
|
PRUNE_BELOW: () => PRUNE_BELOW,
|
|
42
|
+
RAIN_SHELL_INTERVAL: () => RAIN_SHELL_INTERVAL,
|
|
42
43
|
TRUCK_ENGINE: () => TRUCK_ENGINE,
|
|
43
44
|
VEHICLES_AREA_ID: () => VEHICLES_AREA_ID,
|
|
44
45
|
VEHICLE_LOD_DISTANCE: () => VEHICLE_LOD_DISTANCE,
|
|
@@ -61,6 +62,7 @@ var GameVehiclesThree = (() => {
|
|
|
61
62
|
createVehicleLamps: () => createVehicleLamps,
|
|
62
63
|
createVehicleLod: () => createVehicleLod,
|
|
63
64
|
createVehicleLodQueue: () => createVehicleLodQueue,
|
|
65
|
+
createVehicleRainCovers: () => createVehicleRainCovers,
|
|
64
66
|
createVehicleSound: () => createVehicleSound,
|
|
65
67
|
createVehiclesTestModule: () => createVehiclesTestModule,
|
|
66
68
|
createVehiclesThree: () => createVehiclesThree,
|
|
@@ -313,6 +315,50 @@ var GameVehiclesThree = (() => {
|
|
|
313
315
|
return lx > fp.minX - radius && lx < fp.maxX + radius && lz > fp.minZ - radius && lz < fp.maxZ + radius;
|
|
314
316
|
};
|
|
315
317
|
}
|
|
318
|
+
var prepare = (f) => ({ x: f.x, z: f.z, halfX: f.halfX, halfZ: f.halfZ, cos: Math.cos(f.yaw), sin: Math.sin(f.yaw), top: f.top });
|
|
319
|
+
var insideTurned = (f, x, z) => {
|
|
320
|
+
const dx = x - f.x;
|
|
321
|
+
const dz = z - f.z;
|
|
322
|
+
return Math.abs(dx * f.cos + dz * f.sin) <= f.halfX && Math.abs(-dx * f.sin + dz * f.cos) <= f.halfZ;
|
|
323
|
+
};
|
|
324
|
+
function createFootprintRainCover() {
|
|
325
|
+
let roofs = [];
|
|
326
|
+
let openings = [];
|
|
327
|
+
let bounds = [0, 0, 0, 0];
|
|
328
|
+
let revision = 0;
|
|
329
|
+
return {
|
|
330
|
+
bounds: () => bounds,
|
|
331
|
+
version: () => revision,
|
|
332
|
+
coverTopAt(x, z) {
|
|
333
|
+
let top;
|
|
334
|
+
for (const roof of roofs) {
|
|
335
|
+
if (top !== void 0 && roof.top <= top || !insideTurned(roof, x, z)) continue;
|
|
336
|
+
top = roof.top;
|
|
337
|
+
}
|
|
338
|
+
if (top === void 0) return void 0;
|
|
339
|
+
for (const opening of openings) if (insideTurned(opening, x, z)) return void 0;
|
|
340
|
+
return top;
|
|
341
|
+
},
|
|
342
|
+
set(footprints, cutouts, bumpVersion) {
|
|
343
|
+
roofs = footprints.map(prepare);
|
|
344
|
+
openings = cutouts.map(prepare);
|
|
345
|
+
let x0 = Infinity;
|
|
346
|
+
let z0 = Infinity;
|
|
347
|
+
let x1 = -Infinity;
|
|
348
|
+
let z1 = -Infinity;
|
|
349
|
+
for (const roof of roofs) {
|
|
350
|
+
const reach = Math.abs(roof.halfX * roof.cos) + Math.abs(roof.halfZ * roof.sin);
|
|
351
|
+
const reachZ = Math.abs(roof.halfX * roof.sin) + Math.abs(roof.halfZ * roof.cos);
|
|
352
|
+
x0 = Math.min(x0, roof.x - reach);
|
|
353
|
+
x1 = Math.max(x1, roof.x + reach);
|
|
354
|
+
z0 = Math.min(z0, roof.z - reachZ);
|
|
355
|
+
z1 = Math.max(z1, roof.z + reachZ);
|
|
356
|
+
}
|
|
357
|
+
bounds = roofs.length === 0 ? [0, 0, 0, 0] : [x0, z0, x1, z1];
|
|
358
|
+
if (bumpVersion) revision++;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
316
362
|
var SURFACE_IDS = ["concrete", "asphalt", "wood", "tile", "dirt", "grass", "gravel", "sand", "metal", "water", "glass", "carpet"];
|
|
317
363
|
var GAIT_IDS = ["walk", "run"];
|
|
318
364
|
var LANDING_IDS = ["light", "heavy"];
|
|
@@ -5075,8 +5121,9 @@ var GameVehiclesThree = (() => {
|
|
|
5075
5121
|
c.rod(new V3(hx + 0.88, ih + 0.97, z - 0.05), new V3(hx + 0.78, ih + 1.12, z - 0.05), 0.012, MT.chrome);
|
|
5076
5122
|
c.sphere(0.025, MT.plastic, hx + 0.78, ih + 1.12, z - 0.05);
|
|
5077
5123
|
});
|
|
5078
|
-
kit.seat(c, hx + 0.05, ih, 0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }) });
|
|
5079
|
-
kit.seat(c, hx + 0.05, ih, -0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }) });
|
|
5124
|
+
kit.seat(c, hx + 0.05, ih, 0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }), role: "front_passenger" });
|
|
5125
|
+
kit.seat(c, hx + 0.05, ih, -0.45, { w: 0.52, h: 0.62, back: 0.6, lean: 0.12, mat: CM("#25282b", { roughness: 0.8 }), id: "driver", role: "driver" });
|
|
5126
|
+
c.addDoor({ id: "cabin_door", widthMetres: 0.72, heightMetres: 1.65 });
|
|
5080
5127
|
c.roundBox(0.45, 0.42, 1.9, 0.04, CM("#25282b", { roughness: 0.8 }), hx - 1.35, ih + 0.21, 0.1);
|
|
5081
5128
|
c.seatTops.push({ x: hx - 1.35, y: ih + 0.44, z: 0.1, w: 1.8, l: 0.4 });
|
|
5082
5129
|
c.roundBox(3, 0.02, 2, 0.01, CM("#3a3f44", { roughness: 0.9 }), hx, hy0 + hh - 0.06, 0).castShadow = false;
|
|
@@ -6017,8 +6064,9 @@ var GameVehiclesThree = (() => {
|
|
|
6017
6064
|
m.tumble = T;
|
|
6018
6065
|
m.frontQuad = qf;
|
|
6019
6066
|
if (intr && s.shelf) {
|
|
6020
|
-
const sx0 = gh.rb + 0.03, sx1 = gh.rb + s.shelf;
|
|
6021
|
-
|
|
6067
|
+
const sx0 = gh.rb + 0.03, sx1 = Math.min(gh.rb + s.shelf, gh.rb + 0.26);
|
|
6068
|
+
if (sx1 > sx0 + 0.04)
|
|
6069
|
+
c.roundBox(sx1 - sx0, 0.014, gh.Wg - 0.24, 6e-3, CM("#1b1c1e", { roughness: 0.92 }), (sx0 + sx1) / 2, gh.belt - 0.02, 0).castShadow = false;
|
|
6022
6070
|
}
|
|
6023
6071
|
if (intr)
|
|
6024
6072
|
kit.interior(
|
|
@@ -6029,11 +6077,17 @@ var GameVehiclesThree = (() => {
|
|
|
6029
6077
|
ft: gh.ft,
|
|
6030
6078
|
rb: gh.rb,
|
|
6031
6079
|
rt: gh.rt,
|
|
6032
|
-
roof:
|
|
6080
|
+
roof: gh.roof + 0.02,
|
|
6033
6081
|
belt: gh.belt,
|
|
6034
|
-
floor: s.bottomY + 0.
|
|
6082
|
+
floor: s.bottomY + 0.02,
|
|
6083
|
+
seatH: 0.12,
|
|
6084
|
+
dashD: 0.32,
|
|
6085
|
+
dashH: 0.24,
|
|
6086
|
+
visorUp: true,
|
|
6035
6087
|
zIn: gh.Wg / 2 - 0.09,
|
|
6036
6088
|
zRoof: halfAt(gh.Wg, T, gh.roof) - 0.12,
|
|
6089
|
+
xFront: s.shelf ? gh.fb - 0.86 : void 0,
|
|
6090
|
+
rowPitch: s.shelf ? 0.72 : void 0,
|
|
6037
6091
|
xRear: gh.rb + 0.06
|
|
6038
6092
|
},
|
|
6039
6093
|
intr
|
|
@@ -6581,7 +6635,7 @@ var GameVehiclesThree = (() => {
|
|
|
6581
6635
|
]);
|
|
6582
6636
|
c2.roundBox(0.03, 0.05, 0.16, 0.012, MT.trim, I.S.endX(-1, 0.84) - 0.01, 0.84, 0);
|
|
6583
6637
|
},
|
|
6584
|
-
interior: { rows: 2, col: "#4a4c52", trim: "#26272a" },
|
|
6638
|
+
interior: { rows: 2, col: "#4a4c52", trim: "#26272a", rowPitch: 0.72 },
|
|
6585
6639
|
hood: { motor: "gasoline" },
|
|
6586
6640
|
wheels: [
|
|
6587
6641
|
[1.17, 0.2875, 0.175, wheelOpts("hubcap")],
|
|
@@ -8081,7 +8135,7 @@ var GameVehiclesThree = (() => {
|
|
|
8081
8135
|
const lip = K.grid(-1, 0, { z1: 0.7, y0: 0.88, y1: 0.97, du: 0.03, dv: 0.02 });
|
|
8082
8136
|
K.skin(lip, GLOSS, { u0: 0.05, u1: 0.95, yb: 0.925, yt: 0.955, off: 0.016, thick: 0.02, nv: 2 });
|
|
8083
8137
|
},
|
|
8084
|
-
interior: { rows: 2, col: "#1c1d20", trim: "#121316" },
|
|
8138
|
+
interior: { rows: 2, col: "#1c1d20", trim: "#121316", xFront: -0.46, rowPitch: 0.62 },
|
|
8085
8139
|
hood: { motor: "v8_na" },
|
|
8086
8140
|
wheels: [
|
|
8087
8141
|
[1.35, 0.3435, 0.255, { rim: ALLOYD, spokeMat: ALLOY, spokes: 10, rimR: 0.72 }],
|
|
@@ -8342,16 +8396,20 @@ var GameVehiclesThree = (() => {
|
|
|
8342
8396
|
x: xd - 0.07,
|
|
8343
8397
|
y: belt + 0.02,
|
|
8344
8398
|
w: zi * 2,
|
|
8345
|
-
d: 0.
|
|
8346
|
-
h: Math.min(0.
|
|
8399
|
+
d: 0.34,
|
|
8400
|
+
h: Math.min(0.28, belt - fl - 0.16),
|
|
8347
8401
|
drv: -zi * 0.52,
|
|
8348
8402
|
mat: trim,
|
|
8349
8403
|
top: fab
|
|
8350
8404
|
});
|
|
8351
8405
|
kit.steeringWheel(c, xd - 0.66, belt + 0.06, -zi * 0.52, { r: 0.22, tilt: 1.12, col: 0.5, mat: trim });
|
|
8352
8406
|
const sx = Math.max(f - len + 0.62, xd - 1.08);
|
|
8353
|
-
kit.seat(c, sx, fl, -zi * 0.52, { w: 0.
|
|
8354
|
-
kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.
|
|
8407
|
+
kit.seat(c, sx, fl, -zi * 0.52, { w: 0.52, mat: fab, h: 0.24, back: 0.64, lean: 0.18, id: "driver", role: "driver" });
|
|
8408
|
+
kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.24, back: 0.6, lean: 0.18, role: "front_passenger" });
|
|
8409
|
+
const doorW = Math.max(0.75, f - 0.1 - (xr - 0.06));
|
|
8410
|
+
const doorH = Math.max(1.05, ry - fl - 0.1);
|
|
8411
|
+
c.addDoor({ id: "door_front_left", widthMetres: Math.round(doorW * 1e3) / 1e3, heightMetres: Math.round(doorH * 1e3) / 1e3 });
|
|
8412
|
+
c.addDoor({ id: "door_front_right", widthMetres: Math.round(doorW * 1e3) / 1e3, heightMetres: Math.round(doorH * 1e3) / 1e3 });
|
|
8355
8413
|
c.rod(new V3(sx + 0.55, fl, -0.05), new V3(sx + 0.5, fl + 0.48, -0.08), 0.014, MT.chrome);
|
|
8356
8414
|
c.sphere(0.035, MT.plastic, sx + 0.5, fl + 0.5, -0.08);
|
|
8357
8415
|
c.roundBox(0.03, ry - fl - 0.12, zi * 2, 0.01, trim, f - len + 0.07, (ry + fl) / 2, 0);
|
|
@@ -9128,7 +9186,8 @@ var GameVehiclesThree = (() => {
|
|
|
9128
9186
|
kit.busRows(c, { x0: dx0 - 0.15, x1: -4.15, pitch: 0.64, floor: fl, zIn: zi, aisle: 0.46, col: "#355a7a", ceil: 2.95, seatH: 0.4 });
|
|
9129
9187
|
kit.dashboard(c, { x: f - 0.05, y: 1.42, w: zi * 2, d: 0.42, h: 0.4, drv: -0.7, mat: CM("#202124"), top: CM("#2a2b2e") });
|
|
9130
9188
|
kit.steeringWheel(c, f - 0.6, 1.48, -0.7, { r: 0.25, tilt: 1.1, col: 0.45 });
|
|
9131
|
-
kit.seat(c, f - 1.05, fl, -0.7, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.45 });
|
|
9189
|
+
kit.seat(c, f - 1.05, fl, -0.7, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.45, id: "driver", role: "driver" });
|
|
9190
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.85, heightMetres: 1.95 });
|
|
9132
9191
|
c.roundBox(0.9, 0.38, 0.5, 0.08, CM("#2a2b2d"), f - 0.6, fl + 0.19, -0.05);
|
|
9133
9192
|
c.rod(new V3(dx0 - 0.05, fl, zi - 0.35), new V3(dx0 - 0.05, 2.95, zi - 0.35), 0.02, MT.chrome);
|
|
9134
9193
|
c.roundBox(L - 0.5, 0.02, zi * 2, 0.01, MT.headliner, 0, 2.98, 0).castShadow = false;
|
|
@@ -9462,9 +9521,11 @@ var GameVehiclesThree = (() => {
|
|
|
9462
9521
|
[1, 1.5, -2.2].forEach(function(x) {
|
|
9463
9522
|
c.rod(new V3(x, fl, 0), new V3(x, 2.95, 0), 0.018, pole);
|
|
9464
9523
|
});
|
|
9465
|
-
kit.dashboard(c, { x: fx2(1.3) - 0.08, y: 1.3, w: 1.2, d: 0.
|
|
9524
|
+
kit.dashboard(c, { x: fx2(1.3) - 0.08, y: 1.3, w: 1.2, d: 0.34, h: 0.28, drv: -0.68, mat: CM("#1d1e20"), top: CM("#2a2b2e") });
|
|
9466
9525
|
kit.steeringWheel(c, f - 0.62, 1.38, -0.68, { r: 0.25, tilt: 1.15, col: 0.4 });
|
|
9467
|
-
kit.seat(c, f - 1.15, 0.6, -0.68, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.46 });
|
|
9526
|
+
kit.seat(c, f - 1.15, 0.6, -0.68, { w: 0.5, mat: CM("#2c2d30", { roughness: 0.85 }), h: 0.46, id: "driver", role: "driver" });
|
|
9527
|
+
c.addDoor({ id: "door_front_right", widthMetres: 1, heightMetres: 2.05 });
|
|
9528
|
+
c.addDoor({ id: "door_rear_right", widthMetres: 1, heightMetres: 2.05 });
|
|
9468
9529
|
c.roundBox(0.4, 0.95, 0.32, 0.05, CM("#9aa0a4", { metalness: 0.5 }), 3.95, fl + 0.48, -0.55);
|
|
9469
9530
|
[0, 2.09, 4.19].forEach(function(a) {
|
|
9470
9531
|
c.rod(
|
|
@@ -9802,7 +9863,9 @@ var GameVehiclesThree = (() => {
|
|
|
9802
9863
|
c.cylinder(0.05, 0.05, 0.012, MT.gauge, -0.165, 1.6, 0.1, "x");
|
|
9803
9864
|
kit.steeringWheel(c, -0.38, 1.66, 0, { r: 0.2, tilt: 1, col: 0.42, mat: MT.trim });
|
|
9804
9865
|
c.roundBox(1, 0.05, 0.94, 0.02, CM("#5c5f62", { metalness: 0.5 }), -0.7, 1.12, 0);
|
|
9805
|
-
kit.seat(c, -1, 1.35, 0, { w: 0.
|
|
9866
|
+
kit.seat(c, -1.08, 1.35, 0, { w: 0.54, h: 0.16, back: 0.44, lean: 0.12, mat: MT.seat, headrest: false, id: "driver", role: "driver" });
|
|
9867
|
+
c.addDoor({ id: "cab_entry_left", widthMetres: 0.85, heightMetres: 1.15 });
|
|
9868
|
+
c.addDoor({ id: "cab_entry_right", widthMetres: 0.85, heightMetres: 1.15 });
|
|
9806
9869
|
c.roundBox(0.3, 0.2, 0.3, 0.04, dgray, -1, 1.28, 0);
|
|
9807
9870
|
[
|
|
9808
9871
|
[0.25, 1],
|
|
@@ -10152,7 +10215,11 @@ var GameVehiclesThree = (() => {
|
|
|
10152
10215
|
const fl = 0.6, fab = CM("#2f3136", { roughness: 0.9 });
|
|
10153
10216
|
GH.liner(c, ST, -0.3, 1, fl, MT.carpet, { h: 0.03, maxW: 0.98 });
|
|
10154
10217
|
[0.26, -0.26].forEach(function(z) {
|
|
10155
|
-
kit.seat(c, 0.05, fl, z, { w: 0.
|
|
10218
|
+
kit.seat(c, 0.05, fl, z, { w: 0.48, h: 0.12, back: 0.6, lean: 0.12, mat: fab, role: "pilot" });
|
|
10219
|
+
if (z < 0) {
|
|
10220
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.68, heightMetres: 0.95 });
|
|
10221
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.68, heightMetres: 0.95 });
|
|
10222
|
+
}
|
|
10156
10223
|
EA.pedals(c, 1.15, fl, z);
|
|
10157
10224
|
});
|
|
10158
10225
|
c.roundBox(0.35, 0.5, 0.24, 0.05, CM("#232427"), 0.95, fl + 0.28, 0, { rot: [0, 0, 0.35] });
|
|
@@ -10520,7 +10587,11 @@ var GameVehiclesThree = (() => {
|
|
|
10520
10587
|
const fl = 0.68, fab = CM("#4b4339", { roughness: 0.9 });
|
|
10521
10588
|
GH.liner(c, ST, -0.6, 1.8, fl, MT.carpet, { h: 0.03, maxW: 1.15 });
|
|
10522
10589
|
[0.3, -0.3].forEach(function(z) {
|
|
10523
|
-
kit.seat(c, 1.05, fl, z, { w: 0.48, h: 0.
|
|
10590
|
+
kit.seat(c, 1.05, fl, z, { w: 0.48, h: 0.28, back: 0.64, lean: 0.12, mat: fab, role: "pilot" });
|
|
10591
|
+
if (z < 0) {
|
|
10592
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 1.05 });
|
|
10593
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 1.05 });
|
|
10594
|
+
}
|
|
10524
10595
|
EA.cyclic(c, 1.4, fl, z);
|
|
10525
10596
|
EA.pedals(c, 2.1, fl, z);
|
|
10526
10597
|
});
|
|
@@ -10924,7 +10995,11 @@ var GameVehiclesThree = (() => {
|
|
|
10924
10995
|
const fl = 0.7, fab = CM("#2c3540", { roughness: 0.9 });
|
|
10925
10996
|
GH.liner(c, ST, -2.9, 2.5, fl, MT.carpet, { h: 0.03, maxW: 1.5 });
|
|
10926
10997
|
[0.42, -0.42].forEach(function(z) {
|
|
10927
|
-
kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.4, back: 0.7, lean: 0.12, mat: fab });
|
|
10998
|
+
kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.4, back: 0.7, lean: 0.12, mat: fab, role: "pilot" });
|
|
10999
|
+
if (z < 0) {
|
|
11000
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.78, heightMetres: 1.15 });
|
|
11001
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.78, heightMetres: 1.15 });
|
|
11002
|
+
}
|
|
10928
11003
|
EA.cyclic(c, 1.95, fl, z);
|
|
10929
11004
|
EA.pedals(c, 2.75, fl, z);
|
|
10930
11005
|
});
|
|
@@ -11357,10 +11432,12 @@ var GameVehiclesThree = (() => {
|
|
|
11357
11432
|
kit.cutMesh(fus, [EA.sideCutP(tdP, 0.5)], 40, { sub: 0.12 });
|
|
11358
11433
|
EA.colorize(fus.geometry, col);
|
|
11359
11434
|
const fab = CM("#2e3328", { roughness: 0.85 });
|
|
11360
|
-
kit.seat(c, 4.75, 1.55, 0, { w: 0.5, h: 0.
|
|
11435
|
+
kit.seat(c, 4.75, 1.55, 0, { w: 0.5, h: 0.1, back: 0.7, lean: 0.15, mat: fab, role: "pilot" });
|
|
11361
11436
|
c.roundBox(0.2, 0.3, 0.6, 0.04, CM("#232427"), 5.35, 1.98, 0, { rot: [0, 0, 0.3] });
|
|
11362
11437
|
c.roundBox(0.2, 0.2, 0.15, 0.03, MT.plastic, 5.25, 2.15, 0);
|
|
11363
|
-
kit.seat(c, 3.2, 2.12, 0, { w: 0.5, h: 0.
|
|
11438
|
+
kit.seat(c, 3.2, 2.12, 0, { w: 0.5, h: 0.1, back: 0.72, lean: 0.15, mat: fab, role: "pilot" });
|
|
11439
|
+
c.addDoor({ id: "canopy_left", widthMetres: 0.72, heightMetres: 0.95 });
|
|
11440
|
+
c.addDoor({ id: "door_cargo_left", widthMetres: 0.9, heightMetres: 1.15 });
|
|
11364
11441
|
EA.instPanel(c, 3.85, 2.62, 0.8, { gauges: 6, z0: -0.25, tilt: 0.3, screens: [[0.05, 0.2, 0.14, 0.18]] });
|
|
11365
11442
|
EA.cyclic(c, 3.55, 2.12, 0);
|
|
11366
11443
|
EA.collective(c, 3.3, 2.12, -0.38);
|
|
@@ -12170,6 +12247,10 @@ var GameVehiclesThree = (() => {
|
|
|
12170
12247
|
mirrorCol: "#22231d",
|
|
12171
12248
|
wheels: []
|
|
12172
12249
|
};
|
|
12250
|
+
s.interior = Object.assign(
|
|
12251
|
+
{ floor: s.bottomY + 0.02, roof: s.gh.roof + 0.02, seatH: 0.14, dashD: 0.32, dashH: 0.24, visorUp: true },
|
|
12252
|
+
s.interior || {}
|
|
12253
|
+
);
|
|
12173
12254
|
kit.car(c, s);
|
|
12174
12255
|
[xf, xr].forEach(function(x) {
|
|
12175
12256
|
;
|
|
@@ -12434,8 +12515,8 @@ var GameVehiclesThree = (() => {
|
|
|
12434
12515
|
x: xd - 0.07,
|
|
12435
12516
|
y: belt + 0.02,
|
|
12436
12517
|
w: zi * 2,
|
|
12437
|
-
d: 0.
|
|
12438
|
-
h: Math.min(0.
|
|
12518
|
+
d: 0.34,
|
|
12519
|
+
h: Math.min(0.28, belt - fl - 0.16),
|
|
12439
12520
|
drv: -zi * 0.52,
|
|
12440
12521
|
mat: trim,
|
|
12441
12522
|
top: fab,
|
|
@@ -12443,8 +12524,12 @@ var GameVehiclesThree = (() => {
|
|
|
12443
12524
|
});
|
|
12444
12525
|
kit.steeringWheel(c, xd - 0.66, belt + 0.06, -zi * 0.52, { r: 0.23, tilt: 1.12, col: 0.5, mat: trim });
|
|
12445
12526
|
const sx = Math.max(f - len + 0.62, xd - 1.08);
|
|
12446
|
-
kit.seat(c, sx, fl, -zi * 0.52, { w: 0.
|
|
12447
|
-
kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.
|
|
12527
|
+
kit.seat(c, sx, fl, -zi * 0.52, { w: 0.52, mat: fab, h: 0.24, back: 0.64, lean: 0.18, id: "driver", role: "driver" });
|
|
12528
|
+
kit.seat(c, sx, fl, zi * 0.42, { w: zi * 0.98, n: 2, mat: fab, h: 0.24, back: 0.6, lean: 0.18, role: "front_passenger" });
|
|
12529
|
+
const mDoorW = Math.max(0.75, f - 0.1 - (xr - 0.06));
|
|
12530
|
+
const mDoorH = Math.max(1.05, ry - fl - 0.1);
|
|
12531
|
+
c.addDoor({ id: "door_front_left", widthMetres: Math.round(mDoorW * 1e3) / 1e3, heightMetres: Math.round(mDoorH * 1e3) / 1e3 });
|
|
12532
|
+
c.addDoor({ id: "door_front_right", widthMetres: Math.round(mDoorW * 1e3) / 1e3, heightMetres: Math.round(mDoorH * 1e3) / 1e3 });
|
|
12448
12533
|
c.rod(new V3(sx + 0.55, fl, -0.05), new V3(sx + 0.5, fl + 0.48, -0.08), 0.014, OLIVE_STEEL);
|
|
12449
12534
|
c.sphere(0.035, BLACK, sx + 0.5, fl + 0.5, -0.08);
|
|
12450
12535
|
c.roundBox(0.25, 0.16, 0.34, 0.02, CM("#3b402d", { roughness: 0.7 }), xd - 0.35, belt + 0.12, 0.1);
|
|
@@ -12986,7 +13071,9 @@ var GameVehiclesThree = (() => {
|
|
|
12986
13071
|
[-0.9, -2.2].forEach(function(x) {
|
|
12987
13072
|
c.roundBox(0.3, 0.04, 0.1, 0.02, RED_LIGHT, x, roofY - 0.1, 0).castShadow = false;
|
|
12988
13073
|
});
|
|
12989
|
-
kit.seat(c, 0.95, fl + 0.1, -0.62, { w: 0.5, h: 0.42, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }) });
|
|
13074
|
+
kit.seat(c, 0.95, fl + 0.1, -0.62, { w: 0.5, h: 0.42, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }), id: "driver", role: "driver" });
|
|
13075
|
+
c.addDoor({ id: "hatch_driver", widthMetres: 0.58, heightMetres: 0.6 });
|
|
13076
|
+
c.addDoor({ id: "ramp_rear", widthMetres: 1.4, heightMetres: 1.35 });
|
|
12990
13077
|
kit.steeringWheel(c, 1.5, 1.42, -0.62, { r: 0.2, tilt: 0.9, col: 0.35 });
|
|
12991
13078
|
c.roundBox(0.35, 0.3, 0.7, 0.04, CM("#25261f"), 1.85, 1.45, -0.6);
|
|
12992
13079
|
kit.seat(c, 0.15, fl, 0, { w: 0.5, h: 0.45, back: 0.62, lean: 0.12, mat: CM("#2f3226", { roughness: 0.9 }) });
|
|
@@ -13355,7 +13442,9 @@ var GameVehiclesThree = (() => {
|
|
|
13355
13442
|
});
|
|
13356
13443
|
const fl = 0.72, fab = CM("#2f3226", { roughness: 0.9 });
|
|
13357
13444
|
c.roundBox(3, 0.04, 1.6, 0.01, MT.carpet, 0.2, fl, 0);
|
|
13358
|
-
kit.seat(c, 1, fl
|
|
13445
|
+
kit.seat(c, 1, fl, -0.55, { w: 0.46, h: 0.14, back: 0.5, lean: 0.25, mat: fab, id: "driver", role: "driver" });
|
|
13446
|
+
c.addDoor({ id: "hatch_driver", widthMetres: 0.54, heightMetres: 0.58 });
|
|
13447
|
+
c.addDoor({ id: "hatch_commander", widthMetres: 0.6, heightMetres: 0.6 });
|
|
13359
13448
|
kit.steeringWheel(c, 1.5, 1.38, -0.55, { r: 0.18, tilt: 0.9, col: 0.3 });
|
|
13360
13449
|
c.roundBox(0.3, 0.26, 0.6, 0.04, CM("#25261f"), 1.75, 1.35, -0.5);
|
|
13361
13450
|
const nT = c.vehicle.children.length;
|
|
@@ -13403,8 +13492,8 @@ var GameVehiclesThree = (() => {
|
|
|
13403
13492
|
for (let k = 0; k < 4; k++)
|
|
13404
13493
|
c.rod(new V3(tx - 1.55, ty + 0.14, -0.6 + k * 0.4), new V3(tx - 1.55, ty + 0.4, -0.6 + k * 0.4), 0.015, OLIVE_STEEL);
|
|
13405
13494
|
c.rod(new V3(tx - 1.55, ty + 0.4, -0.65), new V3(tx - 1.55, ty + 0.4, 0.65), 0.015, OLIVE_STEEL);
|
|
13406
|
-
kit.seat(c, tx - 0.4, fl + 0.
|
|
13407
|
-
kit.seat(c, tx - 0.4, fl + 0.
|
|
13495
|
+
kit.seat(c, tx - 0.4, fl + 0.12, 0.42, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
|
|
13496
|
+
kit.seat(c, tx - 0.4, fl + 0.12, -0.42, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
|
|
13408
13497
|
c.roundBox(0.8, 0.3, 0.3, 0.05, BARREL, tx + 0.1, ty + 0.1, 0);
|
|
13409
13498
|
c.roundBox(1.6, 0.02, 1.2, 0.01, MT.headliner, tx - 0.2, ty + 0.66, 0).castShadow = false;
|
|
13410
13499
|
rigid(c, c.vehicle.children.slice(nT));
|
|
@@ -13597,7 +13686,18 @@ var GameVehiclesThree = (() => {
|
|
|
13597
13686
|
{ rot: [0, 0, -0.18] }
|
|
13598
13687
|
);
|
|
13599
13688
|
hatch(c, 2.05, roofY - 0.1, -0.78, 0.28, 0, OLIVE_STEEL, { yaw: 0 });
|
|
13600
|
-
kit.seat(c, 1.
|
|
13689
|
+
kit.seat(c, 1.65, 0.3, -0.76, {
|
|
13690
|
+
w: 0.46,
|
|
13691
|
+
h: 0.14,
|
|
13692
|
+
back: 0.5,
|
|
13693
|
+
lean: 0.5,
|
|
13694
|
+
mat: CM("#2f3226", { roughness: 0.9 }),
|
|
13695
|
+
id: "driver",
|
|
13696
|
+
role: "driver",
|
|
13697
|
+
headroomMetres: 0.9
|
|
13698
|
+
});
|
|
13699
|
+
c.addDoor({ id: "hatch_driver", widthMetres: 0.56, heightMetres: 0.58 });
|
|
13700
|
+
c.addDoor({ id: "hatch_commander", widthMetres: 0.68, heightMetres: 0.68 });
|
|
13601
13701
|
[-0.95, -0.78, -0.61].forEach(function(z, i) {
|
|
13602
13702
|
periscope(c, 2.3, roofY - 0.08, z, 0.14, i === 1 ? lbl("driver_periscope") : null);
|
|
13603
13703
|
});
|
|
@@ -13674,9 +13774,9 @@ var GameVehiclesThree = (() => {
|
|
|
13674
13774
|
});
|
|
13675
13775
|
c.roundBox(0.25, 0.3, 1.6, 0.06, CANVAS2, bx + 0.12, ty + 0.4, 0);
|
|
13676
13776
|
c.part("cargo", trl("labels.luggage_basket"), null, new V3(bx + 0.1, ty + 0.5, 0), 1);
|
|
13677
|
-
kit.seat(c, tx - 0.55, ty - 0.45, 0.6, { w: 0.
|
|
13678
|
-
kit.seat(c, tx + 0.2, ty - 0.55, 0.62, { w: 0.
|
|
13679
|
-
kit.seat(c, tx - 0.3, ty - 0.55, -0.62, { w: 0.
|
|
13777
|
+
kit.seat(c, tx - 0.55, ty - 0.45, 0.6, { w: 0.46, h: 0.16, back: 0.45, lean: 0.1, mat: fab, role: "crew" });
|
|
13778
|
+
kit.seat(c, tx + 0.2, ty - 0.55, 0.62, { w: 0.46, h: 0.16, back: 0.42, lean: 0.1, mat: fab, role: "crew" });
|
|
13779
|
+
kit.seat(c, tx - 0.3, ty - 0.55, -0.62, { w: 0.46, h: 0.16, back: 0.42, lean: 0.1, mat: fab, role: "crew" });
|
|
13680
13780
|
c.roundBox(1.1, 0.35, 0.4, 0.05, BARREL, tx + 0.6, ty + 0.35, 0.05);
|
|
13681
13781
|
c.roundBox(2.2, 0.02, 1.6, 0.01, MT.headliner, tx - 0.3, tTop - 0.08, 0).castShadow = false;
|
|
13682
13782
|
c.cylinder(0.05, 0.05, 0.03, RED_LIGHT, tx - 0.4, tTop - 0.1, 0.2);
|
|
@@ -13917,10 +14017,12 @@ var GameVehiclesThree = (() => {
|
|
|
13917
14017
|
const fl = 0.86, fab = CM("#2f3226", { roughness: 0.9 });
|
|
13918
14018
|
c.roundBox(5.6, 0.04, 2.05, 0.01, MT.carpet, -0.4, fl, 0).castShadow = false;
|
|
13919
14019
|
[0.5, -0.5].forEach(function(z) {
|
|
13920
|
-
kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.42, back: 0.72, lean: 0.12, mat: fab });
|
|
13921
|
-
c.rod(new V3(2, fl, z), new V3(1.95, fl + 0.55, z), 0.016, BLACK);
|
|
13922
|
-
c.sphere(0.035, BLACK, 1.95, fl + 0.57, z);
|
|
14020
|
+
kit.seat(c, 1.55, fl, z, { w: 0.5, h: 0.42, back: 0.72, lean: 0.12, mat: fab, role: "pilot" });
|
|
14021
|
+
c.rod(new V3(2, fl, z), new V3(1.95, fl + 0.55, z), 0.016, BLACK).userData.noCabinRay = true;
|
|
14022
|
+
c.sphere(0.035, BLACK, 1.95, fl + 0.57, z).userData.noCabinRay = true;
|
|
13923
14023
|
});
|
|
14024
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 1.15 });
|
|
14025
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 1.15 });
|
|
13924
14026
|
c.roundBox(0.25, 0.45, 1.9, 0.05, CM("#232427"), 2.45, fl + 0.55, 0);
|
|
13925
14027
|
c.roundBox(0.4, 0.05, 1.95, 0.02, CM("#1a1b1d"), 2.4, fl + 0.8, 0, { rot: [0, 0, 0.25] });
|
|
13926
14028
|
[-0.75, -0.45, -0.15, 0.15, 0.45, 0.75].forEach(function(z) {
|
|
@@ -15055,9 +15157,13 @@ var GameVehiclesThree = (() => {
|
|
|
15055
15157
|
ft: gh.ft,
|
|
15056
15158
|
rb: gh.rb,
|
|
15057
15159
|
rt: gh.rt,
|
|
15058
|
-
roof:
|
|
15160
|
+
roof: gh.roof + 0.02,
|
|
15059
15161
|
belt: gh.belt,
|
|
15060
|
-
floor: s.bottomY + 0.
|
|
15162
|
+
floor: s.bottomY + 0.02,
|
|
15163
|
+
seatH: 0.12,
|
|
15164
|
+
dashD: 0.32,
|
|
15165
|
+
dashH: 0.24,
|
|
15166
|
+
visorUp: true,
|
|
15061
15167
|
zIn: gh.Wg / 2 - 0.09,
|
|
15062
15168
|
zRoof: halfAt(gh.Wg, T, gh.roof) - 0.12,
|
|
15063
15169
|
xRear: gh.rb + 0.06
|
|
@@ -18530,7 +18636,7 @@ var GameVehiclesThree = (() => {
|
|
|
18530
18636
|
c.cylinder(0.025, 0.025, 0.2, EXH, -1.98, 0.3, z, "x");
|
|
18531
18637
|
});
|
|
18532
18638
|
c.part("engine", trl("labels.air_cooled_engine_rear"), null, new V3(-1.6, 0.55, 0), 1);
|
|
18533
|
-
const fab = CM("#4b3a2e", { roughness: 0.85 }), fl = 0.
|
|
18639
|
+
const fab = CM("#4b3a2e", { roughness: 0.85 }), fl = 0.31;
|
|
18534
18640
|
c.roundBox(1.7, 0.03, 0.62, 0.01, MT.carpet, -0.15, fl, 0).castShadow = false;
|
|
18535
18641
|
c.roundBox(0.2, 0.24, 1.14, 0.04, col, 0.66, 0.92, 0);
|
|
18536
18642
|
c.roundBox(0.16, 0.05, 1.12, 0.02, CM("#1b1c1e"), 0.6, 1.03, 0);
|
|
@@ -18541,9 +18647,18 @@ var GameVehiclesThree = (() => {
|
|
|
18541
18647
|
c.rod(new V3(0.12, fl, 0), new V3(0.02, fl + 0.42, 0), 0.01, MT.chrome);
|
|
18542
18648
|
c.sphere(0.025, MT.plastic, 0.02, fl + 0.44, 0);
|
|
18543
18649
|
[-1, 1].forEach(function(sd) {
|
|
18544
|
-
kit.seat(c, -0.
|
|
18650
|
+
kit.seat(c, -0.08, fl, sd * 0.27, {
|
|
18651
|
+
w: 0.44,
|
|
18652
|
+
mat: fab,
|
|
18653
|
+
back: 0.58,
|
|
18654
|
+
lean: 0.2,
|
|
18655
|
+
h: 0.14,
|
|
18656
|
+
headrest: false,
|
|
18657
|
+
id: sd < 0 ? "driver" : "front_right",
|
|
18658
|
+
role: sd < 0 ? "driver" : "front_passenger"
|
|
18659
|
+
});
|
|
18545
18660
|
});
|
|
18546
|
-
kit.seat(c, -0.
|
|
18661
|
+
kit.seat(c, -0.58, fl, 0, { w: 0.94, n: 3, mat: fab, back: 0.44, lean: 0.14, h: 0.11, len: 0.42, headrest: false, role: "rear" });
|
|
18547
18662
|
[1, -1].forEach(function(sd) {
|
|
18548
18663
|
for (let yk = 0.56; yk < 0.95; yk += 0.075) {
|
|
18549
18664
|
const zf = Math.min(loftHalf(stS, -0.3, yk - 0.04), loftHalf(stS, 0.5, yk - 0.04)) - 0.045;
|
|
@@ -20600,11 +20715,12 @@ var GameVehiclesThree = (() => {
|
|
|
20600
20715
|
c.roundBox(0.012, 0.012, 0.06, 4e-3, MT.steel, 2.06, 0.62, 0, PG);
|
|
20601
20716
|
const fl = -0.4, fab = CM("#3c3a35", { roughness: 0.9 });
|
|
20602
20717
|
c.roundBox(2, 0.025, 0.6, 0.01, MT.carpet, 0.55, fl, 0, PG).castShadow = false;
|
|
20603
|
-
kit.seat(c, 0.62, fl, 0, { w: 0.48, h: 0.
|
|
20604
|
-
kit.seat(c, -0.22, fl + 0.04, 0, { w: 0.5, h: 0.
|
|
20718
|
+
kit.seat(c, 0.62, fl, 0, { w: 0.48, h: 0.16, back: 0.55, lean: 0.2, mat: fab, parent: grp, headrest: false, role: "pilot" });
|
|
20719
|
+
kit.seat(c, -0.22, fl + 0.04, 0, { w: 0.5, h: 0.16, back: 0.58, lean: 0.2, mat: fab, parent: grp, headrest: false, role: "crew" });
|
|
20720
|
+
c.addDoor({ id: "canopy_door", widthMetres: 0.7, heightMetres: 0.85 });
|
|
20605
20721
|
[1.12, 0.3].forEach(function(x) {
|
|
20606
|
-
c.rod(new V3(x, fl, 0), new V3(x - 0.05, fl + 0.5, 0), 0.012, MT.plastic, PG);
|
|
20607
|
-
c.sphere(0.025, MT.plastic, x - 0.055, fl + 0.52, 0, 1, 1.4, 1, PG);
|
|
20722
|
+
c.rod(new V3(x, fl, 0), new V3(x - 0.05, fl + 0.5, 0), 0.012, MT.plastic, PG).userData.noCabinRay = true;
|
|
20723
|
+
c.sphere(0.025, MT.plastic, x - 0.055, fl + 0.52, 0, 1, 1.4, 1, PG).userData.noCabinRay = true;
|
|
20608
20724
|
});
|
|
20609
20725
|
c.roundBox(0.05, 0.22, 0.6, 0.02, CM("#2a2b2d", { roughness: 0.8 }), 1.75, 0.3, 0, PG);
|
|
20610
20726
|
[-0.2, -0.08, 0.04, 0.16, -0.14].forEach(function(z, i) {
|
|
@@ -20958,7 +21074,8 @@ var GameVehiclesThree = (() => {
|
|
|
20958
21074
|
const fl = 0.98, fab = CM("#3d4552", { roughness: 0.9 });
|
|
20959
21075
|
liner(c, ST, -4.6, 5.9, fl, MT.carpet, { h: 0.03 });
|
|
20960
21076
|
[0.38, -0.38].forEach(function(z) {
|
|
20961
|
-
kit.seat(c, 4.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: CM("#2a2c30", { roughness: 0.8 }) });
|
|
21077
|
+
kit.seat(c, 4.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: CM("#2a2c30", { roughness: 0.8 }), role: "pilot" });
|
|
21078
|
+
if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.78, heightMetres: 1.55 });
|
|
20962
21079
|
kit.yoke(c, 5.5, 1.75, z);
|
|
20963
21080
|
EA.pedals(c, 5.95, fl, z);
|
|
20964
21081
|
});
|
|
@@ -21352,7 +21469,8 @@ var GameVehiclesThree = (() => {
|
|
|
21352
21469
|
const fl = 2.06, fab = CM("#4a4640", { roughness: 0.9 });
|
|
21353
21470
|
liner(c, ST, -3.2, 2, fl, MT.carpet, { h: 0.03 });
|
|
21354
21471
|
[0.38, -0.38].forEach(function(z) {
|
|
21355
|
-
kit.seat(c, 0.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: fab });
|
|
21472
|
+
kit.seat(c, 0.95, fl, z, { w: 0.5, h: 0.38, back: 0.7, lean: 0.14, mat: fab, role: "pilot" });
|
|
21473
|
+
if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.78, heightMetres: 1.4 });
|
|
21356
21474
|
kit.yoke(c, 1.5, 2.85, z);
|
|
21357
21475
|
EA.pedals(c, 1.95, fl, z);
|
|
21358
21476
|
});
|
|
@@ -21767,7 +21885,8 @@ var GameVehiclesThree = (() => {
|
|
|
21767
21885
|
const fl = 0.8, fab = CM("#c9bda6", { roughness: 0.75 });
|
|
21768
21886
|
liner(c, ST, -2, 4, fl, MT.carpet, { h: 0.03 });
|
|
21769
21887
|
[0.36, -0.36].forEach(function(z) {
|
|
21770
|
-
kit.seat(c, 3.55, fl, z, { w: 0.48, h: 0.36, back: 0.66, lean: 0.14, mat: CM("#2a2c30") });
|
|
21888
|
+
kit.seat(c, 3.55, fl, z, { w: 0.48, h: 0.36, back: 0.66, lean: 0.14, mat: CM("#2a2c30"), role: "pilot" });
|
|
21889
|
+
if (z < 0) c.addDoor({ id: "cabin_door_left", widthMetres: 0.72, heightMetres: 1.35 });
|
|
21771
21890
|
kit.yoke(c, 4.05, 1.55, z);
|
|
21772
21891
|
});
|
|
21773
21892
|
EA.instPanel(c, 4.3, 1.68, 1.35, {
|
|
@@ -22135,11 +22254,12 @@ var GameVehiclesThree = (() => {
|
|
|
22135
22254
|
[1.55, 1.24],
|
|
22136
22255
|
[0.2, 1.46]
|
|
22137
22256
|
].forEach(function(q, i) {
|
|
22138
|
-
kit.seat(c, q[0], q[1], 0, { w: 0.5, h: 0.32, back: 0.85, lean: 0.24, mat: fab, headrest: false });
|
|
22257
|
+
kit.seat(c, q[0], q[1], 0, { w: 0.5, h: 0.32, back: 0.85, lean: 0.24, mat: fab, headrest: false, role: i === 0 ? "pilot" : "crew" });
|
|
22139
22258
|
c.roundBox(0.14, 0.3, 0.44, 0.04, CM("#202224"), q[0] - 0.42, q[1] + 1.05, 0, { rot: [0, 0, 0.24] });
|
|
22140
22259
|
c.rod(new V3(q[0] - 0.38, q[1] + 1.25, -0.06), new V3(q[0] - 0.3, q[1] + 1.4, 0.06), 0.012, MT.yellow);
|
|
22141
|
-
c.rod(new V3(q[0] + 0.35, q[1], 0), new V3(q[0] + 0.32, q[1] + 0.45, 0), 0.016, blk);
|
|
22142
|
-
c.sphere(0.03, blk, q[0] + 0.31, q[1] + 0.48, 0, 1, 1.5, 1);
|
|
22260
|
+
c.rod(new V3(q[0] + 0.35, q[1], 0), new V3(q[0] + 0.32, q[1] + 0.45, 0), 0.016, blk).userData.noCabinRay = true;
|
|
22261
|
+
c.sphere(0.03, blk, q[0] + 0.31, q[1] + 0.48, 0, 1, 1.5, 1).userData.noCabinRay = true;
|
|
22262
|
+
if (i === 0) c.addDoor({ id: "canopy_door", widthMetres: 0.68, heightMetres: 0.85 });
|
|
22143
22263
|
const px = q[0] + 0.75;
|
|
22144
22264
|
c.roundBox(0.16, 0.3, 0.6, 0.04, CM("#232427"), px, q[1] + 0.65, 0, { rot: [0, 0, 0.2] });
|
|
22145
22265
|
[-0.15, 0.15].forEach(function(z) {
|
|
@@ -22973,10 +23093,26 @@ var GameVehiclesThree = (() => {
|
|
|
22973
23093
|
roofLining(c, extra);
|
|
22974
23094
|
if (!c.meta.damage) c.meta.damage = crashDamage;
|
|
22975
23095
|
}
|
|
23096
|
+
function withCabinPackaging(s) {
|
|
23097
|
+
if (s.interior === false) return s;
|
|
23098
|
+
return Object.assign({}, s, {
|
|
23099
|
+
interior: Object.assign(
|
|
23100
|
+
{
|
|
23101
|
+
floor: s.bottomY + 0.02,
|
|
23102
|
+
roof: s.gh.roof + 0.02,
|
|
23103
|
+
seatH: 0.12,
|
|
23104
|
+
dashD: 0.32,
|
|
23105
|
+
dashH: 0.24,
|
|
23106
|
+
visorUp: true
|
|
23107
|
+
},
|
|
23108
|
+
s.interior || {}
|
|
23109
|
+
)
|
|
23110
|
+
});
|
|
23111
|
+
}
|
|
22976
23112
|
function suvBuild(c, s, o) {
|
|
22977
23113
|
o = o || {};
|
|
22978
23114
|
const n0 = c.deform.length;
|
|
22979
|
-
kit.car(c, s);
|
|
23115
|
+
kit.car(c, withCabinPackaging(s));
|
|
22980
23116
|
const low = c.deform[n0], m = c.meta;
|
|
22981
23117
|
let extra = [];
|
|
22982
23118
|
if (o.flares !== false) extra = extra.concat(fenderFlares(c, s.arches, s.W, s.bottomY, o.flare));
|
|
@@ -23463,7 +23599,7 @@ var GameVehiclesThree = (() => {
|
|
|
23463
23599
|
);
|
|
23464
23600
|
function pickupBuild(c, s, o) {
|
|
23465
23601
|
const n0 = c.deform.length;
|
|
23466
|
-
kit.car(c, s);
|
|
23602
|
+
kit.car(c, withCabinPackaging(s));
|
|
23467
23603
|
const low = c.deform[n0], m = c.meta;
|
|
23468
23604
|
let extra = [];
|
|
23469
23605
|
cargoBed(c, { low, x0: m.rear + 0.06, x1: o.bedFront, floor: o.floor, top: s.gh.belt, W: s.W, arches: s.arches });
|
|
@@ -23859,7 +23995,7 @@ var GameVehiclesThree = (() => {
|
|
|
23859
23995
|
wheels: []
|
|
23860
23996
|
};
|
|
23861
23997
|
const n0 = c.deform.length;
|
|
23862
|
-
kit.car(c, s);
|
|
23998
|
+
kit.car(c, withCabinPackaging(s));
|
|
23863
23999
|
const low = c.deform[n0], m = c.meta;
|
|
23864
24000
|
cargoBed(c, { low, x0: m.rear + 0.06, x1: -0.42, floor: 1.78, top: 2.25, W, arches: [] });
|
|
23865
24001
|
c.roundBox(0.08, 0.08, W + 0.1, 0.03, MT.chrome, m.front + 0.06, 1.72, 0);
|
|
@@ -24179,7 +24315,10 @@ var GameVehiclesThree = (() => {
|
|
|
24179
24315
|
xRear: P.cabBack - 0.12,
|
|
24180
24316
|
xFront: P.cabBack + 0.42,
|
|
24181
24317
|
seatH: 0.42,
|
|
24182
|
-
front: "bench"
|
|
24318
|
+
front: "bench",
|
|
24319
|
+
dashD: 0.32,
|
|
24320
|
+
dashH: 0.24,
|
|
24321
|
+
visorUp: true
|
|
24183
24322
|
});
|
|
24184
24323
|
c.roundBox(
|
|
24185
24324
|
0.04,
|
|
@@ -25215,8 +25354,8 @@ var GameVehiclesThree = (() => {
|
|
|
25215
25354
|
});
|
|
25216
25355
|
}
|
|
25217
25356
|
function cyclic(c, x, fl, z) {
|
|
25218
|
-
c.rod(new V3(x, fl, z), new V3(x - 0.04, fl + 0.55, z), 0.014, MT.plastic);
|
|
25219
|
-
c.roundBox(0.04, 0.12, 0.04, 0.015, MT.plastic, x - 0.05, fl + 0.6, z);
|
|
25357
|
+
c.rod(new V3(x, fl, z), new V3(x - 0.04, fl + 0.55, z), 0.014, MT.plastic).userData.noCabinRay = true;
|
|
25358
|
+
c.roundBox(0.04, 0.12, 0.04, 0.015, MT.plastic, x - 0.05, fl + 0.6, z).userData.noCabinRay = true;
|
|
25220
25359
|
}
|
|
25221
25360
|
function collective(c, x, fl, z) {
|
|
25222
25361
|
c.rod(new V3(x - 0.35, fl + 0.18, z), new V3(x + 0.05, fl + 0.32, z), 0.016, MT.plastic);
|
|
@@ -25747,8 +25886,8 @@ var GameVehiclesThree = (() => {
|
|
|
25747
25886
|
c.rod(new V3(0.62, cy + 0.72, 0.62), new V3(0.55, cy + 0.82, 0.62), 0.02, MT.chrome);
|
|
25748
25887
|
c.rod(new V3(0.55, cy + 0.7, 0.98), new V3(0.42, cy + 0.88, 1), 0.015, MT.chrome);
|
|
25749
25888
|
c.sphere(0.035, MT.plastic, 0.42, cy + 0.9, 1);
|
|
25750
|
-
kit.seat(c, -0.1, cy + 2e-3, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
|
|
25751
|
-
kit.seat(c, -0.1, cy + 2e-3, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false });
|
|
25889
|
+
kit.seat(c, -0.1, cy + 2e-3, 0.72, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false, open: true, role: "front_passenger" });
|
|
25890
|
+
kit.seat(c, -0.1, cy + 2e-3, -0.74, { w: 0.55, h: 0.42, back: 0.48, lean: 0.12, mat: vinyl, headrest: false, open: true, id: "driver", role: "driver" });
|
|
25752
25891
|
[1, -1].forEach(function(s) {
|
|
25753
25892
|
const pts = [];
|
|
25754
25893
|
for (let i = 0; i <= 8; i++) {
|
|
@@ -26059,7 +26198,8 @@ var GameVehiclesThree = (() => {
|
|
|
26059
26198
|
c.rod(new V3(0, 0, 0), new V3(0, Math.cos(a8) * 0.36, Math.sin(a8) * 0.36), 0.014, MT.wood, { parent: whl });
|
|
26060
26199
|
}
|
|
26061
26200
|
c.cylinder(0.05, 0.05, 0.14, MT.wood, 0.06, 0, 0, "x", { parent: whl });
|
|
26062
|
-
kit.seat(c, hx - 0.
|
|
26201
|
+
kit.seat(c, hx - 0.12, hy0 + 2e-3, 0, { w: 0.54, h: 0.55, back: 0.45, mat: inner, headrest: false, id: "driver", role: "driver" });
|
|
26202
|
+
c.addDoor({ id: "cabin_door", widthMetres: 0.68, heightMetres: 1.55 });
|
|
26063
26203
|
c.roundBox(1.8, 0.12, 0.65, 0.04, CM("#7c5a3b"), hx - 0.2, hy0 + 0.5, -0.72);
|
|
26064
26204
|
c.roundBox(1.7, 0.08, 0.55, 0.04, CM("#6b7c8f", { roughness: 1 }), hx - 0.2, hy0 + 0.6, -0.72);
|
|
26065
26205
|
c.roundBox(1.9, 0.02, 2.1, 0.01, inner, hx, hy0 + hh - 0.06, 0).castShadow = false;
|
|
@@ -26275,11 +26415,13 @@ var GameVehiclesThree = (() => {
|
|
|
26275
26415
|
const fl = 0.74, fab = CM("#4a463f", { roughness: 0.9 });
|
|
26276
26416
|
c.roundBox(2.2, 0.03, 0.98, 0.01, MT.carpet, 0.2, fl, 0).castShadow = false;
|
|
26277
26417
|
[0.26, -0.26].forEach(function(z) {
|
|
26278
|
-
kit.seat(c, 0.38, fl, z, { w: 0.
|
|
26418
|
+
kit.seat(c, 0.38, fl, z, { w: 0.48, h: 0.24, back: 0.62, lean: 0.18, mat: fab, role: "pilot" });
|
|
26279
26419
|
EA.pedals(c, 1.18, fl, z);
|
|
26280
26420
|
kit.yoke(c, 0.98, 1.47, z);
|
|
26281
26421
|
});
|
|
26282
|
-
kit.seat(c, -0.52, fl, 0, { w: 0.96, n: 2, h: 0.
|
|
26422
|
+
kit.seat(c, -0.52, fl, 0, { w: 0.96, n: 2, h: 0.24, back: 0.58, lean: 0.2, mat: fab });
|
|
26423
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.75, heightMetres: 0.95 });
|
|
26424
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.75, heightMetres: 0.95 });
|
|
26283
26425
|
EA.instPanel(c, 1.1, 1.52, 1, { gauges: 6, z0: -0.38, screens: [[0, 0.12, 0.14, 0.22]] });
|
|
26284
26426
|
c.roundBox(0.1, 0.1, 0.1, 0.02, MT.plastic, 1, 1.32, 0);
|
|
26285
26427
|
c.cylinder(0.018, 0.018, 0.1, MT.chrome, 0.93, 1.34, 0.02, "x");
|
|
@@ -26554,9 +26696,10 @@ var GameVehiclesThree = (() => {
|
|
|
26554
26696
|
);
|
|
26555
26697
|
const fl = -0.36;
|
|
26556
26698
|
c.roundBox(1.3, 0.03, 0.8, 0.01, MT.carpet, -0.4, fl, 0, { parent: grp }).castShadow = false;
|
|
26557
|
-
kit.seat(c, -0.55, fl, 0, { w: 0.5, h: 0.
|
|
26558
|
-
c.
|
|
26559
|
-
c.
|
|
26699
|
+
kit.seat(c, -0.55, fl, 0, { w: 0.5, h: 0.18, back: 0.66, lean: 0.12, mat: CM("#3a3530", { roughness: 0.9 }), parent: grp, role: "pilot" });
|
|
26700
|
+
c.addDoor({ id: "canopy_door", widthMetres: 0.7, heightMetres: 0.85 });
|
|
26701
|
+
c.rod(new V3(0, fl, 0), new V3(-0.06, fl + 0.55, 0), 0.016, MT.plastic, { parent: grp }).userData.noCabinRay = true;
|
|
26702
|
+
c.roundBox(0.04, 0.13, 0.05, 0.015, MT.plastic, -0.07, fl + 0.6, 0, { parent: grp }).userData.noCabinRay = true;
|
|
26560
26703
|
c.roundBox(0.16, 0.3, 0.8, 0.04, CM("#232427"), 0.36, 0.5, 0, { parent: grp, rot: [0, 0, 0.2] });
|
|
26561
26704
|
[-0.24, -0.12, 0, 0.12, 0.24].forEach(function(z, i) {
|
|
26562
26705
|
c.cylinder(0.036, 0.036, 0.012, MT.gauge, 0.27, 0.55 - i % 2 * 0.09, z, "x", { seg: 16, parent: grp }).castShadow = false;
|
|
@@ -26966,10 +27109,12 @@ var GameVehiclesThree = (() => {
|
|
|
26966
27109
|
const fl = 0.72, fab = CM("#3b3a38", { roughness: 0.9 });
|
|
26967
27110
|
c.roundBox(1.9, 0.03, 1.16, 0.01, MT.carpet, 0.2, fl, 0).castShadow = false;
|
|
26968
27111
|
[0.3, -0.3].forEach(function(z) {
|
|
26969
|
-
kit.seat(c, 0.35, fl, z, { w: 0.48, h: 0.
|
|
27112
|
+
kit.seat(c, 0.35, fl, z, { w: 0.48, h: 0.2, back: 0.62, lean: 0.14, mat: fab, role: "pilot" });
|
|
26970
27113
|
EA.pedals(c, 1.35, fl, z);
|
|
26971
27114
|
});
|
|
26972
|
-
kit.seat(c, -0.55, fl + 0.06, 0, { w: 1.06, n: 2, h: 0.
|
|
27115
|
+
kit.seat(c, -0.55, fl + 0.06, 0, { w: 1.06, n: 2, h: 0.2, back: 0.6, lean: 0.12, mat: fab });
|
|
27116
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.72, heightMetres: 1.05 });
|
|
27117
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.72, heightMetres: 1.05 });
|
|
26973
27118
|
c.roundBox(0.42, 0.62, 0.3, 0.06, CM("#232427"), 1.15, fl + 0.32, 0, { rot: [0, 0, 0.35] });
|
|
26974
27119
|
c.roundBox(0.06, 0.3, 0.3, 0.02, CM("#1a1b1d"), 1.25, fl + 0.65, 0, { rot: [0, 0, 0.6] });
|
|
26975
27120
|
[-0.07, 0.07].forEach(function(z) {
|
|
@@ -27300,6 +27445,8 @@ var GameVehiclesThree = (() => {
|
|
|
27300
27445
|
EA.collective(c, 1.3, fl, -0.72);
|
|
27301
27446
|
EA.collective(c, 1.3, fl, 0.12);
|
|
27302
27447
|
kit.seat(c, -0.35, fl + 0.04, 0, { w: 1.56, n: 4, h: 0.38, back: 0.62, lean: 0.1, mat: fab });
|
|
27448
|
+
c.addDoor({ id: "door_front_left", widthMetres: 0.78, heightMetres: 1.15 });
|
|
27449
|
+
c.addDoor({ id: "door_front_right", widthMetres: 0.78, heightMetres: 1.15 });
|
|
27303
27450
|
EA.instPanel(c, 2.25, 1.55, 1.2, { gauges: 8, z0: -0.45, tilt: 0.3, screens: [[0.05, 0.25, 0.14, 0.2]] });
|
|
27304
27451
|
c.roundBox(0.5, 0.45, 0.32, 0.06, CM("#232427"), 2.05, fl + 0.24, 0);
|
|
27305
27452
|
c.roundBox(2.3, 0.02, 1.4, 0.01, MT.headliner, 0.45, 2.24, 0).castShadow = false;
|
|
@@ -32095,6 +32242,12 @@ var GameVehiclesThree = (() => {
|
|
|
32095
32242
|
this.particles = [];
|
|
32096
32243
|
this.emitters = [];
|
|
32097
32244
|
this.seatTops = [];
|
|
32245
|
+
this._seatsCache = null;
|
|
32246
|
+
this._doorsCache = null;
|
|
32247
|
+
this._rawSeats = [];
|
|
32248
|
+
this._explicitSeats = [];
|
|
32249
|
+
this._explicitDoors = [];
|
|
32250
|
+
this._noCabinRayObjs = /* @__PURE__ */ new Set();
|
|
32098
32251
|
this.hood = null;
|
|
32099
32252
|
this.rollState = null;
|
|
32100
32253
|
this.flipped = false;
|
|
@@ -32296,6 +32449,32 @@ var GameVehiclesThree = (() => {
|
|
|
32296
32449
|
dirToEffects(d) {
|
|
32297
32450
|
return d.clone().applyQuaternion(this.vehicle.quaternion);
|
|
32298
32451
|
}
|
|
32452
|
+
/** Measured seat spaces in vehicle local coordinates (computed lazily on first read). */
|
|
32453
|
+
get seats() {
|
|
32454
|
+
if (this._seatsCache === null) kit.finalizeCabinSpaces(this);
|
|
32455
|
+
return this._seatsCache;
|
|
32456
|
+
}
|
|
32457
|
+
set seats(value) {
|
|
32458
|
+
this._seatsCache = value;
|
|
32459
|
+
}
|
|
32460
|
+
/** Measured door and hatch openings in vehicle local coordinates (computed lazily on first read). */
|
|
32461
|
+
get doors() {
|
|
32462
|
+
if (this._doorsCache === null) kit.finalizeCabinSpaces(this);
|
|
32463
|
+
return this._doorsCache;
|
|
32464
|
+
}
|
|
32465
|
+
set doors(value) {
|
|
32466
|
+
this._doorsCache = value;
|
|
32467
|
+
}
|
|
32468
|
+
/** Declares an explicit seat space (e.g. open motorcycle/quad saddle) preserved verbatim by cabin space finalisation. */
|
|
32469
|
+
addSeat(seat) {
|
|
32470
|
+
this._explicitSeats.push(seat);
|
|
32471
|
+
return seat;
|
|
32472
|
+
}
|
|
32473
|
+
/** Declares an explicit door or hatch opening preserved verbatim by cabin space finalisation. */
|
|
32474
|
+
addDoor(door) {
|
|
32475
|
+
this._explicitDoors.push(door);
|
|
32476
|
+
return door;
|
|
32477
|
+
}
|
|
32299
32478
|
/** Declares or refines a damage zone: `c.zone(id, label, box, parts, options)`. Pass `label === false` to remove an auto-derived zone. */
|
|
32300
32479
|
zone(id, label, box2, parts, o) {
|
|
32301
32480
|
const d = Object.assign({ id }, o || {});
|
|
@@ -33217,7 +33396,8 @@ var GameVehiclesThree = (() => {
|
|
|
33217
33396
|
gp.userData.rigid = true;
|
|
33218
33397
|
c.vehicle.add(gp);
|
|
33219
33398
|
const n0 = c.seatTops.length;
|
|
33220
|
-
|
|
33399
|
+
const raw0 = c._rawSeats.length;
|
|
33400
|
+
kit.seat(c, 0, fl, 0, Object.assign({}, o, { face: void 0, parent: gp, dir: 1 }));
|
|
33221
33401
|
const st = c.seatTops[n0];
|
|
33222
33402
|
if (st) {
|
|
33223
33403
|
st.x = x;
|
|
@@ -33226,6 +33406,17 @@ var GameVehiclesThree = (() => {
|
|
|
33226
33406
|
st.w = st.l;
|
|
33227
33407
|
st.l = t;
|
|
33228
33408
|
}
|
|
33409
|
+
const faceSign = o.face === "+z" ? 1 : -1;
|
|
33410
|
+
for (let idx = raw0; idx < c._rawSeats.length; idx++) {
|
|
33411
|
+
const entry = c._rawSeats[idx];
|
|
33412
|
+
const localZ = entry.hipPoint[2];
|
|
33413
|
+
c._rawSeats[idx] = {
|
|
33414
|
+
...entry,
|
|
33415
|
+
hipPoint: [x - faceSign * localZ, entry.hipPoint[1], z],
|
|
33416
|
+
facing: [0, 0, faceSign],
|
|
33417
|
+
parent: null
|
|
33418
|
+
};
|
|
33419
|
+
}
|
|
33229
33420
|
return gp;
|
|
33230
33421
|
}
|
|
33231
33422
|
const PR = o.parent;
|
|
@@ -33265,7 +33456,28 @@ var GameVehiclesThree = (() => {
|
|
|
33265
33456
|
});
|
|
33266
33457
|
}
|
|
33267
33458
|
}
|
|
33268
|
-
|
|
33459
|
+
const hipY = fl + h + 0.01;
|
|
33460
|
+
c.seatTops.push({ x, y: hipY, z, w, l: cl });
|
|
33461
|
+
for (let j = 0; j < n; j++) {
|
|
33462
|
+
const zz = z + (j - (n - 1) / 2) * pw;
|
|
33463
|
+
c._rawSeats.push({
|
|
33464
|
+
id: o.id ? n > 1 ? `${o.id}_${j}` : o.id : void 0,
|
|
33465
|
+
role: o.role,
|
|
33466
|
+
hipPoint: [x, hipY, zz],
|
|
33467
|
+
seatWidth: pw,
|
|
33468
|
+
seatLen: cl,
|
|
33469
|
+
facing: [dir >= 0 ? 1 : -1, 0, 0],
|
|
33470
|
+
isBench: n > 1,
|
|
33471
|
+
benchIndex: j,
|
|
33472
|
+
benchCount: n,
|
|
33473
|
+
open: o.open,
|
|
33474
|
+
doorId: o.doorId,
|
|
33475
|
+
headroomMetres: o.headroomMetres,
|
|
33476
|
+
legroomMetres: o.legroomMetres,
|
|
33477
|
+
widthMetres: o.widthMetres,
|
|
33478
|
+
parent: PR ?? null
|
|
33479
|
+
});
|
|
33480
|
+
}
|
|
33269
33481
|
};
|
|
33270
33482
|
kit.steeringWheel = function(c, x, y, z, o) {
|
|
33271
33483
|
o = o || {};
|
|
@@ -33288,6 +33500,9 @@ var GameVehiclesThree = (() => {
|
|
|
33288
33500
|
c.rod(new V3(5e-3, 0, 0), new V3(p[0], p[1] * 0.95, p[2] * 0.95), 0.016, mat, { parent: g, seg: 6 });
|
|
33289
33501
|
});
|
|
33290
33502
|
c.rod(new V3(0.03, 0, 0), new V3(o.col || 0.34, 0, 0), 0.032, mat, { parent: g, seg: 10 });
|
|
33503
|
+
g.traverse(function(node) {
|
|
33504
|
+
c._noCabinRayObjs.add(node);
|
|
33505
|
+
});
|
|
33291
33506
|
return g;
|
|
33292
33507
|
};
|
|
33293
33508
|
kit.yoke = function(c, x, y, z, o) {
|
|
@@ -33354,8 +33569,8 @@ var GameVehiclesThree = (() => {
|
|
|
33354
33569
|
x: x0 - 0.07,
|
|
33355
33570
|
y: belt + 0.04,
|
|
33356
33571
|
w: zi * 2,
|
|
33357
|
-
d: 0.5,
|
|
33358
|
-
h: Math.min(0.42, belt + 0.04 - fl - 0.1),
|
|
33572
|
+
d: o.dashD ?? 0.5,
|
|
33573
|
+
h: o.dashH ?? Math.min(0.42, belt + 0.04 - fl - 0.1),
|
|
33359
33574
|
drv: drv * zs,
|
|
33360
33575
|
mat: trim,
|
|
33361
33576
|
top: fab
|
|
@@ -33383,22 +33598,32 @@ var GameVehiclesThree = (() => {
|
|
|
33383
33598
|
if (r === 0) {
|
|
33384
33599
|
if (o.front === "bench") {
|
|
33385
33600
|
const wb = zi * 2 - 0.62;
|
|
33386
|
-
kit.seat(c, x, fl, drv * zs, { w: 0.5, mat: fab, back, lean, h: seatH });
|
|
33387
|
-
kit.seat(c, x, fl, -drv * (zi - wb / 2 - 0.03), { w: wb, n: 2, mat: fab, back, lean, h: seatH });
|
|
33601
|
+
kit.seat(c, x, fl, drv * zs, { w: 0.5, mat: fab, back, lean, h: seatH, id: "driver", role: "driver" });
|
|
33602
|
+
kit.seat(c, x, fl, -drv * (zi - wb / 2 - 0.03), { w: wb, n: 2, mat: fab, back, lean, h: seatH, role: "front_passenger" });
|
|
33388
33603
|
} else {
|
|
33389
33604
|
;
|
|
33390
33605
|
[-1, 1].forEach(function(s) {
|
|
33391
|
-
|
|
33606
|
+
const isDriver = s === drv;
|
|
33607
|
+
kit.seat(c, x, fl, s * zs, {
|
|
33608
|
+
w: Math.min(0.52, zi - zs + 0.22),
|
|
33609
|
+
mat: fab,
|
|
33610
|
+
back,
|
|
33611
|
+
lean,
|
|
33612
|
+
h: seatH,
|
|
33613
|
+
id: isDriver ? "driver" : void 0,
|
|
33614
|
+
role: isDriver ? "driver" : "front_passenger"
|
|
33615
|
+
});
|
|
33392
33616
|
});
|
|
33393
33617
|
if (!o.noConsole) consoleBox(c, x + 0.16, fl, Math.min(0.26, seatH), trim);
|
|
33394
33618
|
}
|
|
33395
|
-
} else kit.seat(c, x, fl, 0, { w: zi * 2 - 0.1, n: r === 2 ? 2 : 3, mat: fab, back, lean, h: seatH * 0.95 });
|
|
33619
|
+
} else kit.seat(c, x, fl, 0, { w: zi * 2 - 0.1, n: r === 2 ? 2 : 3, mat: fab, back, lean, h: seatH * 0.95, role: "rear" });
|
|
33620
|
+
const trimLen = Math.min(0.8, (o.rowPitch ?? 0.88) - 0.06);
|
|
33396
33621
|
[-1, 1].forEach(function(s) {
|
|
33397
|
-
c.roundBox(
|
|
33622
|
+
c.roundBox(trimLen, belt - fl - 0.08, 0.035, 0.015, trim, x + 0.12, (belt + fl) / 2 + 0.02, s * (zi + 0.02));
|
|
33398
33623
|
c.roundBox(0.3, 0.05, 0.07, 0.02, fab, x + 0.16, fl + seatH + 0.16, s * (zi - 0.015));
|
|
33399
33624
|
c.roundBox(0.08, 0.025, 0.02, 8e-3, MATERIALS.chrome, x + 0.36, belt - 0.11, s * (zi - 5e-3));
|
|
33400
33625
|
});
|
|
33401
|
-
x -= r === 0 ? 0.88 : 0.8;
|
|
33626
|
+
x -= r === 0 ? o.rowPitch ?? 0.88 : 0.8;
|
|
33402
33627
|
}
|
|
33403
33628
|
if (o.ft != null) {
|
|
33404
33629
|
const hx1 = o.ft - 0.04;
|
|
@@ -33408,7 +33633,11 @@ var GameVehiclesThree = (() => {
|
|
|
33408
33633
|
c.rod(new V3(o.ft - 0.1, roof - 0.02, 0), new V3(o.ft - 0.12, roof - 0.08, 0), 8e-3, MATERIALS.plastic, { seg: 5 });
|
|
33409
33634
|
c.roundBox(0.03, 0.06, 0.22, 0.02, MATERIALS.plastic, o.ft - 0.12, roof - 0.11, 0);
|
|
33410
33635
|
[-1, 1].forEach(function(s) {
|
|
33411
|
-
|
|
33636
|
+
if (o.visorUp) {
|
|
33637
|
+
c.roundBox(0.02, 0.07, 0.34, 0.01, MATERIALS.headliner, o.ft - 0.08, roof - 0.03, s * zs, { rot: [0, 0, 1.35] });
|
|
33638
|
+
} else {
|
|
33639
|
+
c.roundBox(0.02, 0.15, 0.34, 0.01, MATERIALS.headliner, o.ft - 0.14, roof - 0.07, s * zs, { rot: [0, 0, 0.35] });
|
|
33640
|
+
}
|
|
33412
33641
|
});
|
|
33413
33642
|
}
|
|
33414
33643
|
};
|
|
@@ -33454,6 +33683,265 @@ var GameVehiclesThree = (() => {
|
|
|
33454
33683
|
Object.assign(I, shared2);
|
|
33455
33684
|
return shared2;
|
|
33456
33685
|
}
|
|
33686
|
+
var HEADROOM_RAY_OFFSETS = [
|
|
33687
|
+
[0, 0],
|
|
33688
|
+
[0.06, 0],
|
|
33689
|
+
[-0.06, 0],
|
|
33690
|
+
[0, -0.06],
|
|
33691
|
+
[0, 0.06]
|
|
33692
|
+
];
|
|
33693
|
+
var HEADROOM_START_OFFSET = 0.02;
|
|
33694
|
+
var HEADROOM_MIN_HIT = 0.2;
|
|
33695
|
+
var LEGROOM_KNEE_OFFSET = 0.12;
|
|
33696
|
+
var LEGROOM_START_PAD = 0.02;
|
|
33697
|
+
var LEGROOM_MIN_HIT = 0.02;
|
|
33698
|
+
var SHOULDER_HEIGHT_OFFSET = 0.38;
|
|
33699
|
+
var SHOULDER_MIN_HIT = 0.14;
|
|
33700
|
+
var ROW_EPSILON = 0.25;
|
|
33701
|
+
var NEIGHBOR_ROW_TOLERANCE = 0.35;
|
|
33702
|
+
var DOOR_ROOF_TRIM = 0.05;
|
|
33703
|
+
var round4 = (value) => Number.isFinite(value) ? Math.round(value * 1e4) / 1e4 : value;
|
|
33704
|
+
function installCabinSpace(kit) {
|
|
33705
|
+
const THREE = kit.THREE;
|
|
33706
|
+
const V3 = THREE.Vector3;
|
|
33707
|
+
const raycaster = new THREE.Raycaster();
|
|
33708
|
+
const originVec = new V3();
|
|
33709
|
+
const dirVec = new V3();
|
|
33710
|
+
function castFirst(c, ox, oy, oz, dx, dy, dz, minDist) {
|
|
33711
|
+
originVec.set(ox, oy, oz);
|
|
33712
|
+
dirVec.set(dx, dy, dz);
|
|
33713
|
+
raycaster.set(originVec, dirVec);
|
|
33714
|
+
const hits = raycaster.intersectObject(c.vehicle, true);
|
|
33715
|
+
const ignored = c._noCabinRayObjs;
|
|
33716
|
+
for (let i = 0; i < hits.length; i++) {
|
|
33717
|
+
const h = hits[i];
|
|
33718
|
+
if (!h) continue;
|
|
33719
|
+
if (h.object.visible === false || h.object.userData?.noCabinRay === true || ignored?.has(h.object)) continue;
|
|
33720
|
+
if (h.distance >= minDist) return h.distance;
|
|
33721
|
+
}
|
|
33722
|
+
return Number.POSITIVE_INFINITY;
|
|
33723
|
+
}
|
|
33724
|
+
function measureHeadroom(c, hip) {
|
|
33725
|
+
let minClearance = Number.POSITIVE_INFINITY;
|
|
33726
|
+
for (let i = 0; i < HEADROOM_RAY_OFFSETS.length; i++) {
|
|
33727
|
+
const offset = HEADROOM_RAY_OFFSETS[i];
|
|
33728
|
+
const dist = castFirst(c, hip[0] + offset[0], hip[1] + HEADROOM_START_OFFSET, hip[2] + offset[1], 0, 1, 0, HEADROOM_MIN_HIT);
|
|
33729
|
+
const clear = Number.isFinite(dist) ? dist + HEADROOM_START_OFFSET : Number.POSITIVE_INFINITY;
|
|
33730
|
+
if (clear < minClearance) minClearance = clear;
|
|
33731
|
+
}
|
|
33732
|
+
return round4(minClearance);
|
|
33733
|
+
}
|
|
33734
|
+
function measureLegroom(c, hip, facing, seatLen) {
|
|
33735
|
+
const startOffset = seatLen / 2 + LEGROOM_START_PAD;
|
|
33736
|
+
const dist = castFirst(
|
|
33737
|
+
c,
|
|
33738
|
+
hip[0] + facing[0] * startOffset,
|
|
33739
|
+
hip[1] + LEGROOM_KNEE_OFFSET,
|
|
33740
|
+
hip[2] + facing[2] * startOffset,
|
|
33741
|
+
facing[0],
|
|
33742
|
+
0,
|
|
33743
|
+
facing[2],
|
|
33744
|
+
LEGROOM_MIN_HIT
|
|
33745
|
+
);
|
|
33746
|
+
return Number.isFinite(dist) ? round4(startOffset + dist) : Number.POSITIVE_INFINITY;
|
|
33747
|
+
}
|
|
33748
|
+
function measureShoulderWidth(c, raw, allRaw, headroom) {
|
|
33749
|
+
const hip = raw.hipPoint;
|
|
33750
|
+
const fx = raw.facing[0];
|
|
33751
|
+
const fz = raw.facing[2];
|
|
33752
|
+
const lx = -fz;
|
|
33753
|
+
const lz = fx;
|
|
33754
|
+
const sy = hip[1] + SHOULDER_HEIGHT_OFFSET;
|
|
33755
|
+
const wallPos = castFirst(c, hip[0], sy, hip[2], lx, 0, lz, SHOULDER_MIN_HIT);
|
|
33756
|
+
const wallNeg = castFirst(c, hip[0], sy, hip[2], -lx, 0, -lz, SHOULDER_MIN_HIT);
|
|
33757
|
+
let neighborPos = Number.POSITIVE_INFINITY;
|
|
33758
|
+
let neighborNeg = Number.POSITIVE_INFINITY;
|
|
33759
|
+
for (let i = 0; i < allRaw.length; i++) {
|
|
33760
|
+
const other = allRaw[i];
|
|
33761
|
+
if (!other || other === raw) continue;
|
|
33762
|
+
const dx = other.hipPoint[0] - hip[0];
|
|
33763
|
+
const dy = Math.abs(other.hipPoint[1] - hip[1]);
|
|
33764
|
+
const dz = other.hipPoint[2] - hip[2];
|
|
33765
|
+
if (dy > NEIGHBOR_ROW_TOLERANCE) continue;
|
|
33766
|
+
const alongFacing = Math.abs(dx * fx + dz * fz);
|
|
33767
|
+
if (alongFacing > NEIGHBOR_ROW_TOLERANCE) continue;
|
|
33768
|
+
const alongLat = dx * lx + dz * lz;
|
|
33769
|
+
if (alongLat > 0.05 && alongLat / 2 < neighborPos) neighborPos = alongLat / 2;
|
|
33770
|
+
else if (alongLat < -0.05 && -alongLat / 2 < neighborNeg) neighborNeg = -alongLat / 2;
|
|
33771
|
+
}
|
|
33772
|
+
const halfFallback = Number.isFinite(headroom) ? raw.seatWidth / 2 : Number.POSITIVE_INFINITY;
|
|
33773
|
+
const posSpace = Math.min(wallPos, neighborPos);
|
|
33774
|
+
const negSpace = Math.min(wallNeg, neighborNeg);
|
|
33775
|
+
const leftAvail = Number.isFinite(posSpace) ? posSpace : halfFallback;
|
|
33776
|
+
const rightAvail = Number.isFinite(negSpace) ? negSpace : halfFallback;
|
|
33777
|
+
const total = leftAvail + rightAvail;
|
|
33778
|
+
return round4(total);
|
|
33779
|
+
}
|
|
33780
|
+
function collectDoors(c) {
|
|
33781
|
+
const records = [];
|
|
33782
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33783
|
+
const explicit = c._explicitDoors || [];
|
|
33784
|
+
for (let i = 0; i < explicit.length; i++) {
|
|
33785
|
+
const d = explicit[i];
|
|
33786
|
+
if (seen.has(d.id)) continue;
|
|
33787
|
+
seen.add(d.id);
|
|
33788
|
+
const side2 = d.id.includes("left") ? -1 : d.id.includes("right") ? 1 : 0;
|
|
33789
|
+
records.push({ opening: d, center: [0, 0, side2], side: side2 });
|
|
33790
|
+
}
|
|
33791
|
+
const zones = c.zones || [];
|
|
33792
|
+
const cabin = c.meta?.cabin;
|
|
33793
|
+
const ghRoof = c.meta?.glasshouse?.roof;
|
|
33794
|
+
for (let i = 0; i < zones.length; i++) {
|
|
33795
|
+
const z = zones[i];
|
|
33796
|
+
if (!z || z.type !== "door" || !z.box || seen.has(z.id)) continue;
|
|
33797
|
+
seen.add(z.id);
|
|
33798
|
+
const b = z.box;
|
|
33799
|
+
const dx = Math.abs(b.x1 - b.x0);
|
|
33800
|
+
const dz = Math.abs(b.z1 - b.z0);
|
|
33801
|
+
const dy = Math.abs(b.y1 - b.y0);
|
|
33802
|
+
const isSideDoor = dx >= dz;
|
|
33803
|
+
const widthMetres = isSideDoor ? dx : dz;
|
|
33804
|
+
let heightMetres = dy;
|
|
33805
|
+
if (isSideDoor && ghRoof != null) {
|
|
33806
|
+
const floorY = cabin?.y0 != null ? cabin.y0 + 0.05 : b.y0;
|
|
33807
|
+
const roofY = ghRoof - DOOR_ROOF_TRIM;
|
|
33808
|
+
if (roofY - floorY > heightMetres) heightMetres = roofY - floorY;
|
|
33809
|
+
}
|
|
33810
|
+
const center = [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, (b.z0 + b.z1) / 2];
|
|
33811
|
+
const side2 = typeof z.side === "number" ? z.side : center[2] < -0.1 ? -1 : center[2] > 0.1 ? 1 : 0;
|
|
33812
|
+
records.push({
|
|
33813
|
+
opening: {
|
|
33814
|
+
id: z.id,
|
|
33815
|
+
widthMetres: round4(widthMetres),
|
|
33816
|
+
heightMetres: round4(heightMetres)
|
|
33817
|
+
},
|
|
33818
|
+
center,
|
|
33819
|
+
side: side2
|
|
33820
|
+
});
|
|
33821
|
+
}
|
|
33822
|
+
return records;
|
|
33823
|
+
}
|
|
33824
|
+
function pickDoorId(hip, doors) {
|
|
33825
|
+
if (doors.length === 0) return void 0;
|
|
33826
|
+
const seatSide = hip[2] < -0.05 ? -1 : hip[2] > 0.05 ? 1 : 0;
|
|
33827
|
+
let bestId;
|
|
33828
|
+
let bestScore = Number.POSITIVE_INFINITY;
|
|
33829
|
+
for (let i = 0; i < doors.length; i++) {
|
|
33830
|
+
const d = doors[i];
|
|
33831
|
+
const dx = d.center[0] - hip[0];
|
|
33832
|
+
const dz = d.center[2] - hip[2];
|
|
33833
|
+
const sidePenalty = seatSide !== 0 && d.side !== 0 && seatSide !== d.side ? 10 : 0;
|
|
33834
|
+
const score = dx * dx + dz * dz + sidePenalty;
|
|
33835
|
+
if (score < bestScore) {
|
|
33836
|
+
bestScore = score;
|
|
33837
|
+
bestId = d.opening.id;
|
|
33838
|
+
}
|
|
33839
|
+
}
|
|
33840
|
+
return bestId;
|
|
33841
|
+
}
|
|
33842
|
+
function inferRole(c, raw, maxX, driverAssigned) {
|
|
33843
|
+
if (raw.role) return raw.role;
|
|
33844
|
+
const kind = c.meta?.kind;
|
|
33845
|
+
if (kind === "bike") return "rider";
|
|
33846
|
+
if (kind === "tank") return "crew";
|
|
33847
|
+
if (Math.abs(raw.facing[2]) > 0.5) return "cargo";
|
|
33848
|
+
const isFrontRow = raw.hipPoint[0] >= maxX - ROW_EPSILON;
|
|
33849
|
+
if (kind === "plane" || kind === "heli") return isFrontRow ? "pilot" : "crew";
|
|
33850
|
+
if (isFrontRow) {
|
|
33851
|
+
if (!driverAssigned && raw.hipPoint[2] <= 0.05) return "driver";
|
|
33852
|
+
return "front_passenger";
|
|
33853
|
+
}
|
|
33854
|
+
return "rear";
|
|
33855
|
+
}
|
|
33856
|
+
function finalizeCabinSpaces(c) {
|
|
33857
|
+
c.root.updateMatrixWorld(true);
|
|
33858
|
+
const doorRecords = collectDoors(c);
|
|
33859
|
+
c.doors = doorRecords.map((r) => r.opening);
|
|
33860
|
+
const seats = [];
|
|
33861
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
33862
|
+
const pushSeat = (seat) => {
|
|
33863
|
+
let id = seat.id;
|
|
33864
|
+
if (usedIds.has(id)) {
|
|
33865
|
+
let suffix = 2;
|
|
33866
|
+
while (usedIds.has(`${id}_${suffix}`)) suffix++;
|
|
33867
|
+
id = `${id}_${suffix}`;
|
|
33868
|
+
}
|
|
33869
|
+
usedIds.add(id);
|
|
33870
|
+
seats.push(id === seat.id ? seat : { ...seat, id });
|
|
33871
|
+
};
|
|
33872
|
+
const explicit = c._explicitSeats || [];
|
|
33873
|
+
for (let i = 0; i < explicit.length; i++) {
|
|
33874
|
+
pushSeat(explicit[i]);
|
|
33875
|
+
}
|
|
33876
|
+
const invVehicle = new THREE.Matrix4().copy(c.vehicle.matrixWorld).invert();
|
|
33877
|
+
const tmpPoint = new V3();
|
|
33878
|
+
const rawSeats = (c._rawSeats || []).map((entry) => {
|
|
33879
|
+
if (!entry.parent || entry.parent === c.vehicle) return entry;
|
|
33880
|
+
entry.parent.updateMatrixWorld(true);
|
|
33881
|
+
tmpPoint.set(entry.hipPoint[0], entry.hipPoint[1], entry.hipPoint[2]).applyMatrix4(entry.parent.matrixWorld).applyMatrix4(invVehicle);
|
|
33882
|
+
return { ...entry, hipPoint: [tmpPoint.x, tmpPoint.y, tmpPoint.z] };
|
|
33883
|
+
});
|
|
33884
|
+
if (rawSeats.length === 0 && explicit.length === 0 && Array.isArray(c.seatTops) && c.seatTops.length > 0) {
|
|
33885
|
+
const isOpenBoat = c.meta?.kind === "boat";
|
|
33886
|
+
for (let i = 0; i < c.seatTops.length; i++) {
|
|
33887
|
+
const st = c.seatTops[i];
|
|
33888
|
+
rawSeats.push({
|
|
33889
|
+
hipPoint: [st.x, st.y, st.z],
|
|
33890
|
+
seatWidth: st.w,
|
|
33891
|
+
seatLen: st.l,
|
|
33892
|
+
facing: [1, 0, 0],
|
|
33893
|
+
isBench: false,
|
|
33894
|
+
benchIndex: 0,
|
|
33895
|
+
benchCount: 1,
|
|
33896
|
+
open: isOpenBoat
|
|
33897
|
+
});
|
|
33898
|
+
}
|
|
33899
|
+
}
|
|
33900
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
33901
|
+
for (let i = 0; i < rawSeats.length; i++) {
|
|
33902
|
+
const x = rawSeats[i].hipPoint[0];
|
|
33903
|
+
if (x > maxX) maxX = x;
|
|
33904
|
+
}
|
|
33905
|
+
let driverAssigned = seats.some((s) => s.role === "driver");
|
|
33906
|
+
for (let i = 0; i < rawSeats.length; i++) {
|
|
33907
|
+
const raw = rawSeats[i];
|
|
33908
|
+
const role = inferRole(c, raw, maxX, driverAssigned);
|
|
33909
|
+
if (role === "driver") driverAssigned = true;
|
|
33910
|
+
const isOpen = raw.open === true;
|
|
33911
|
+
const headroomMetres = isOpen ? Number.POSITIVE_INFINITY : raw.headroomMetres != null ? round4(raw.headroomMetres) : measureHeadroom(c, raw.hipPoint);
|
|
33912
|
+
const legroomMetres = isOpen ? Number.POSITIVE_INFINITY : raw.legroomMetres != null ? round4(raw.legroomMetres) : measureLegroom(c, raw.hipPoint, raw.facing, raw.seatLen);
|
|
33913
|
+
const widthMetres = isOpen ? Number.POSITIVE_INFINITY : raw.widthMetres != null ? round4(raw.widthMetres) : measureShoulderWidth(c, raw, rawSeats, headroomMetres);
|
|
33914
|
+
const doorId = isOpen ? void 0 : raw.doorId !== void 0 ? raw.doorId : pickDoorId(raw.hipPoint, doorRecords);
|
|
33915
|
+
const sideTag = raw.hipPoint[2] < -0.05 ? "left" : raw.hipPoint[2] > 0.05 ? "right" : "center";
|
|
33916
|
+
const defaultId = role === "driver" ? "driver" : role === "front_passenger" ? `front_${sideTag}` : `${role}_${sideTag}`;
|
|
33917
|
+
const hipPoint = [round4(raw.hipPoint[0]), round4(raw.hipPoint[1]), round4(raw.hipPoint[2])];
|
|
33918
|
+
const seatSpace = doorId !== void 0 ? { id: raw.id ?? defaultId, role, hipPoint, headroomMetres, legroomMetres, widthMetres, doorId } : { id: raw.id ?? defaultId, role, hipPoint, headroomMetres, legroomMetres, widthMetres };
|
|
33919
|
+
pushSeat(seatSpace);
|
|
33920
|
+
}
|
|
33921
|
+
const kind = c.meta?.kind;
|
|
33922
|
+
if (seats.length === 0 && rawSeats.length === 0 && (kind === "bike" || kind === "quad")) {
|
|
33923
|
+
const zones = c.zones || [];
|
|
33924
|
+
const seatZone = zones.find((z) => z.id === "seat" && z.box);
|
|
33925
|
+
const hipPoint = seatZone?.box ? [
|
|
33926
|
+
round4((seatZone.box.x0 + seatZone.box.x1) / 2),
|
|
33927
|
+
round4(seatZone.box.y0 + (seatZone.box.y1 - seatZone.box.y0) * 0.75),
|
|
33928
|
+
round4((seatZone.box.z0 + seatZone.box.z1) / 2)
|
|
33929
|
+
] : [round4(((c.meta?.rear ?? -1) + (c.meta?.front ?? 1)) * 0.25), round4((c.meta?.top ?? 1.1) * 0.75), 0];
|
|
33930
|
+
pushSeat({
|
|
33931
|
+
id: "rider",
|
|
33932
|
+
role: "rider",
|
|
33933
|
+
hipPoint,
|
|
33934
|
+
headroomMetres: Number.POSITIVE_INFINITY,
|
|
33935
|
+
legroomMetres: Number.POSITIVE_INFINITY,
|
|
33936
|
+
widthMetres: Number.POSITIVE_INFINITY
|
|
33937
|
+
});
|
|
33938
|
+
}
|
|
33939
|
+
c.seats = seats;
|
|
33940
|
+
}
|
|
33941
|
+
kit.finalizeCabinSpaces = finalizeCabinSpaces;
|
|
33942
|
+
kit._.finalizeCabinSpaces = finalizeCabinSpaces;
|
|
33943
|
+
return { finalizeCabinSpaces };
|
|
33944
|
+
}
|
|
33457
33945
|
var HOOD_LIFT = 8e-3;
|
|
33458
33946
|
function installHood(kit) {
|
|
33459
33947
|
const THREE = kit.THREE;
|
|
@@ -41197,6 +41685,7 @@ var GameVehiclesThree = (() => {
|
|
|
41197
41685
|
installGlass(kit);
|
|
41198
41686
|
installLights(kit);
|
|
41199
41687
|
installInterior(kit);
|
|
41688
|
+
installCabinSpace(kit);
|
|
41200
41689
|
installHood(kit);
|
|
41201
41690
|
installCar(kit);
|
|
41202
41691
|
installTrucks(kit);
|
|
@@ -41503,6 +41992,96 @@ var GameVehiclesThree = (() => {
|
|
|
41503
41992
|
for (const g of groups) found.push(lampOf(g.meshes, g.box, g.front, { aux: true }));
|
|
41504
41993
|
return found;
|
|
41505
41994
|
}
|
|
41995
|
+
var DOOR_SHELL_DEPTH = 0.09;
|
|
41996
|
+
var DOOR_SHELL_MAX_DEPTH = 0.25;
|
|
41997
|
+
var WELD2 = 1e-5;
|
|
41998
|
+
var cellOf = (v) => Math.round(v / WELD2);
|
|
41999
|
+
function weld(positions) {
|
|
42000
|
+
const ids = new Int32Array(positions.length / 3);
|
|
42001
|
+
const points = [];
|
|
42002
|
+
const cells = /* @__PURE__ */ new Map();
|
|
42003
|
+
const near = (x, y, z) => {
|
|
42004
|
+
const [cx, cy, cz] = [cellOf(x), cellOf(y), cellOf(z)];
|
|
42005
|
+
for (let i = -1; i <= 1; i++)
|
|
42006
|
+
for (let j = -1; j <= 1; j++)
|
|
42007
|
+
for (let k = -1; k <= 1; k++) {
|
|
42008
|
+
for (const id of cells.get(`${cx + i},${cy + j},${cz + k}`) ?? []) {
|
|
42009
|
+
if (Math.abs(points[id * 3] - x) <= WELD2 && Math.abs(points[id * 3 + 1] - y) <= WELD2 && Math.abs(points[id * 3 + 2] - z) <= WELD2) return id;
|
|
42010
|
+
}
|
|
42011
|
+
}
|
|
42012
|
+
return void 0;
|
|
42013
|
+
};
|
|
42014
|
+
for (let i = 0; i < ids.length; i++) {
|
|
42015
|
+
const x = positions[i * 3];
|
|
42016
|
+
const y = positions[i * 3 + 1];
|
|
42017
|
+
const z = positions[i * 3 + 2];
|
|
42018
|
+
let id = near(x, y, z);
|
|
42019
|
+
if (id === void 0) {
|
|
42020
|
+
id = points.length / 3;
|
|
42021
|
+
points.push(x, y, z);
|
|
42022
|
+
const key = `${cellOf(x)},${cellOf(y)},${cellOf(z)}`;
|
|
42023
|
+
const cell = cells.get(key);
|
|
42024
|
+
if (cell) cell.push(id);
|
|
42025
|
+
else cells.set(key, [id]);
|
|
42026
|
+
}
|
|
42027
|
+
ids[i] = id;
|
|
42028
|
+
}
|
|
42029
|
+
return { ids, points };
|
|
42030
|
+
}
|
|
42031
|
+
function freeEdgesOf(ids) {
|
|
42032
|
+
const uses = /* @__PURE__ */ new Map();
|
|
42033
|
+
for (let t = 0; t < ids.length; t += 3) {
|
|
42034
|
+
for (let k = 0; k < 3; k++) {
|
|
42035
|
+
const a = ids[t + k];
|
|
42036
|
+
const b = ids[t + (k + 1) % 3];
|
|
42037
|
+
if (a === b) continue;
|
|
42038
|
+
const key = a < b ? `${a}:${b}` : `${b}:${a}`;
|
|
42039
|
+
const use = uses.get(key);
|
|
42040
|
+
if (use) use.count++;
|
|
42041
|
+
else uses.set(key, { count: 1, from: a, to: b });
|
|
42042
|
+
}
|
|
42043
|
+
}
|
|
42044
|
+
const free = [];
|
|
42045
|
+
uses.forEach((use) => {
|
|
42046
|
+
if (use.count === 1) free.push([use.from, use.to]);
|
|
42047
|
+
});
|
|
42048
|
+
return free;
|
|
42049
|
+
}
|
|
42050
|
+
function doorShell(params) {
|
|
42051
|
+
const depth = params.depth ?? DOOR_SHELL_DEPTH;
|
|
42052
|
+
const [ox, oy, oz] = params.outward ?? [0, 0, params.side < 0 ? -1 : 1];
|
|
42053
|
+
const { positions } = params;
|
|
42054
|
+
const along = (i) => positions[i] * ox + positions[i + 1] * oy + positions[i + 2] * oz;
|
|
42055
|
+
let outermost = -Infinity;
|
|
42056
|
+
for (let i = 0; i < positions.length; i += 3) outermost = Math.max(outermost, along(i));
|
|
42057
|
+
const floor = outermost - DOOR_SHELL_MAX_DEPTH;
|
|
42058
|
+
const sink = (x, y, z) => {
|
|
42059
|
+
const move = Math.max(0, Math.min(depth, x * ox + y * oy + z * oz - floor));
|
|
42060
|
+
return [x - ox * move, y - oy * move, z - oz * move];
|
|
42061
|
+
};
|
|
42062
|
+
const inner = new Float32Array(positions.length);
|
|
42063
|
+
for (let t = 0; t < positions.length; t += 9) {
|
|
42064
|
+
for (const [to, from] of [
|
|
42065
|
+
[0, 0],
|
|
42066
|
+
[1, 2],
|
|
42067
|
+
[2, 1]
|
|
42068
|
+
]) {
|
|
42069
|
+
inner.set(sink(positions[t + from * 3], positions[t + from * 3 + 1], positions[t + from * 3 + 2]), t + to * 3);
|
|
42070
|
+
}
|
|
42071
|
+
}
|
|
42072
|
+
const { ids, points } = weld(positions);
|
|
42073
|
+
const free = freeEdgesOf(ids);
|
|
42074
|
+
const flange = new Float32Array(free.length * 18);
|
|
42075
|
+
const corner = (id, sunk) => {
|
|
42076
|
+
const [x, y, z] = [points[id * 3], points[id * 3 + 1], points[id * 3 + 2]];
|
|
42077
|
+
return sunk ? sink(x, y, z) : [x, y, z];
|
|
42078
|
+
};
|
|
42079
|
+
free.forEach(([a, b], i) => {
|
|
42080
|
+
const quad = [corner(b, false), corner(a, false), corner(a, true), corner(b, false), corner(a, true), corner(b, true)];
|
|
42081
|
+
quad.forEach((p, k) => flange.set(p, i * 18 + k * 3));
|
|
42082
|
+
});
|
|
42083
|
+
return { flange, inner, freeEdges: free.length };
|
|
42084
|
+
}
|
|
41506
42085
|
var ARMOUR_LEVELS = {
|
|
41507
42086
|
IIIA: { glassStops: 1700, glassHp: 6e3, glassTakes: 0.25, steel: 8 },
|
|
41508
42087
|
III: { glassStops: 3600, glassHp: 9e3, glassTakes: 0.25, steel: 30 }
|
|
@@ -42333,10 +42912,71 @@ var GameVehiclesThree = (() => {
|
|
|
42333
42912
|
if (centre.y < zone.y0 || centre.y > zone.y1) return false;
|
|
42334
42913
|
return Math.abs(centre.x - zone.x0) < SEAM_AT_EDGE || Math.abs(centre.x - zone.x1) < SEAM_AT_EDGE;
|
|
42335
42914
|
}
|
|
42915
|
+
function closeDoorSkin(three, meshes, params) {
|
|
42916
|
+
const THREE = three;
|
|
42917
|
+
const toVehicle = params.toVehicle;
|
|
42918
|
+
const positions = [];
|
|
42919
|
+
const at = new THREE.Vector3();
|
|
42920
|
+
for (const mesh2 of meshes) {
|
|
42921
|
+
const geometry = mesh2.geometry.index ? mesh2.geometry.toNonIndexed() : mesh2.geometry;
|
|
42922
|
+
const matrix = new THREE.Matrix4().multiplyMatrices(toVehicle, mesh2.matrixWorld);
|
|
42923
|
+
const position = geometry.getAttribute("position");
|
|
42924
|
+
for (let i = 0; i < position.count; i++) {
|
|
42925
|
+
at.fromBufferAttribute(position, i).applyMatrix4(matrix);
|
|
42926
|
+
positions.push(at.x, at.y, at.z);
|
|
42927
|
+
}
|
|
42928
|
+
if (geometry !== mesh2.geometry) geometry.dispose();
|
|
42929
|
+
}
|
|
42930
|
+
if (!positions.length) return [];
|
|
42931
|
+
const shell = doorShell({ positions, side: params.side, ...params.outward ? { outward: params.outward } : {} });
|
|
42932
|
+
const out = [];
|
|
42933
|
+
for (const [array, material] of [
|
|
42934
|
+
[shell.flange, params.paint],
|
|
42935
|
+
[shell.inner, params.liner]
|
|
42936
|
+
]) {
|
|
42937
|
+
if (!array.length) continue;
|
|
42938
|
+
const geometry = new THREE.BufferGeometry();
|
|
42939
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute(array, 3));
|
|
42940
|
+
geometry.computeVertexNormals();
|
|
42941
|
+
geometry.computeBoundingBox();
|
|
42942
|
+
geometry.computeBoundingSphere();
|
|
42943
|
+
out.push(new THREE.Mesh(geometry, material));
|
|
42944
|
+
}
|
|
42945
|
+
return out;
|
|
42946
|
+
}
|
|
42947
|
+
var TRUNK_FLOOR_OVER_CLEARANCE = 0.12;
|
|
42948
|
+
var TRUNK_INSET = 0.05;
|
|
42949
|
+
var TRUNK_SEAL = 0.025;
|
|
42950
|
+
function buildTrunkBay(THREE, params) {
|
|
42951
|
+
const B = params.box;
|
|
42952
|
+
const floor = Math.max(B.y0, params.clearance + TRUNK_FLOOR_OVER_CLEARANCE);
|
|
42953
|
+
const top = B.y1 - TRUNK_INSET;
|
|
42954
|
+
const length = B.x1 - B.x0 - 2 * TRUNK_INSET;
|
|
42955
|
+
const width = B.z1 - B.z0 - 2 * TRUNK_INSET;
|
|
42956
|
+
if (length <= 0 || width <= 0 || top <= floor) return [];
|
|
42957
|
+
params.carpet.side = THREE.BackSide;
|
|
42958
|
+
const open = new THREE.MeshBasicMaterial({ visible: false });
|
|
42959
|
+
const tub = new THREE.Mesh(new THREE.BoxGeometry(length, top - floor, width), [params.carpet, params.carpet, open, params.carpet, params.carpet, params.carpet]);
|
|
42960
|
+
tub.position.set((B.x0 + B.x1) / 2, (floor + top) / 2, (B.z0 + B.z1) / 2);
|
|
42961
|
+
const seal = new THREE.Mesh(new THREE.BoxGeometry(TRUNK_SEAL, TRUNK_SEAL, width), params.seal);
|
|
42962
|
+
seal.position.set(B.x0 + TRUNK_INSET, top, (B.z0 + B.z1) / 2);
|
|
42963
|
+
for (const mesh2 of [tub, seal]) {
|
|
42964
|
+
mesh2.castShadow = false;
|
|
42965
|
+
mesh2.userData.noFollow = true;
|
|
42966
|
+
mesh2.userData.trunkBay = true;
|
|
42967
|
+
}
|
|
42968
|
+
return [tub, seal];
|
|
42969
|
+
}
|
|
42336
42970
|
var HOLE_DECAL_SCALE = 2.4;
|
|
42337
42971
|
var HOLE_BATCH_CAPACITY = 64;
|
|
42338
42972
|
var DOOR_DEPTH = 0.07;
|
|
42339
42973
|
var DOOR_SKIN_DEPTH = 0.09;
|
|
42974
|
+
var LID_OUTWARD = [-Math.SQRT1_2, Math.SQRT1_2, 0];
|
|
42975
|
+
var TRUNK_CARPET_COLOR = "#3a3c3f";
|
|
42976
|
+
var TRUNK_SEAL_COLOR = "#2a2b2d";
|
|
42977
|
+
var DOOR_TRIM_MARGIN = 0.03;
|
|
42978
|
+
var DOOR_TRIM_SIZE = 0.3;
|
|
42979
|
+
var LID_HINGE_INSET = 0.02;
|
|
42340
42980
|
var DOOR_FLOOR_DEPTH = 0.2;
|
|
42341
42981
|
var DOOR_EDGE_PIECES = 8;
|
|
42342
42982
|
var DOOR_EDGE_REACH = 0.08;
|
|
@@ -42630,10 +43270,11 @@ var GameVehiclesThree = (() => {
|
|
|
42630
43270
|
const piv = new THREE.Group();
|
|
42631
43271
|
piv.name = p.id;
|
|
42632
43272
|
piv.userData.plateOf = p.id;
|
|
42633
|
-
|
|
43273
|
+
const hinge = { x: B.x1 - LID_HINGE_INSET, y: B.y1 - LID_HINGE_INSET };
|
|
43274
|
+
piv.position.set(hinge.x, hinge.y, 0);
|
|
42634
43275
|
piv.userData.rigid = true;
|
|
42635
43276
|
this.c.vehicle.add(piv);
|
|
42636
|
-
const panel = this.box(0.022, wy, wz, this.paint(), 0, -wy / 2, 0, piv);
|
|
43277
|
+
const panel = this.box(0.022, wy, wz, this.paint(), sk - 0.016 - hinge.x, B.y1 - 0.05 - hinge.y - wy / 2, 0, piv);
|
|
42637
43278
|
this.plates.set(p.id, piv);
|
|
42638
43279
|
this.extra.set(`recess_${p.id}`, [recess]);
|
|
42639
43280
|
this.showWhenOpen(p.id, piv, panel, recess);
|
|
@@ -42712,12 +43353,16 @@ var GameVehiclesThree = (() => {
|
|
|
42712
43353
|
const seals = panes.map((g) => I.paneSeals.get(g)).filter((s) => !!s);
|
|
42713
43354
|
const mirrors = this.mirrorsOn(z);
|
|
42714
43355
|
const frames = this.framesAround(panes, inv);
|
|
42715
|
-
const
|
|
42716
|
-
|
|
43356
|
+
const thin = I.followersIn(this.c, z, inv);
|
|
43357
|
+
const followers = [...thin, ...this.doorTrimIn(z, inv).filter((o) => !thin.includes(o))].filter((o) => !this.takeSeam(o, id, z, inv) && !this.inFloor(o, piv, z, inv));
|
|
43358
|
+
objs = [...pcs, ...this.shellOf(pcs, z, inv), ...followers, ...panes, ...seals, ...mirrors, ...frames];
|
|
42717
43359
|
}
|
|
42718
43360
|
} else {
|
|
42719
43361
|
const pcs = this.cutZone(z);
|
|
42720
|
-
if (pcs.length)
|
|
43362
|
+
if (pcs.length) {
|
|
43363
|
+
objs = [...pcs, ...this.shellOf(pcs, z, inv, LID_OUTWARD), ...I.followersIn(this.c, z, inv)];
|
|
43364
|
+
this.trunkBay(z);
|
|
43365
|
+
}
|
|
42721
43366
|
}
|
|
42722
43367
|
} catch {
|
|
42723
43368
|
objs = [];
|
|
@@ -42733,7 +43378,7 @@ var GameVehiclesThree = (() => {
|
|
|
42733
43378
|
if (di >= 0) deform.splice(di, 1);
|
|
42734
43379
|
}
|
|
42735
43380
|
if (p.role === "door" && objs.length > 0) {
|
|
42736
|
-
this.doorEdges(piv, z, this.doorTops.get(id) ?? B.y1 - 0.02);
|
|
43381
|
+
this.doorEdges(piv, z, this.doorTops.get(id) ?? B.y1 - 0.02, objs.some((o) => o.userData.doorShell));
|
|
42737
43382
|
this.liftDoorTrim(objs, z);
|
|
42738
43383
|
this.cutStripsAcross(piv, z, inv);
|
|
42739
43384
|
}
|
|
@@ -42741,6 +43386,48 @@ var GameVehiclesThree = (() => {
|
|
|
42741
43386
|
this.c.root.updateMatrixWorld(true);
|
|
42742
43387
|
return objs.length > 0;
|
|
42743
43388
|
}
|
|
43389
|
+
/** The skin closed into a door with depth: the fold all round its real edge, in the paint, and the inner panel behind it, in the door card's grey. */
|
|
43390
|
+
shellOf(skin, z, inv, outward) {
|
|
43391
|
+
const paint = this.paint().clone();
|
|
43392
|
+
paint.side = this.THREE.DoubleSide;
|
|
43393
|
+
const liner = this.I.makeMaterial(DOOR_CARD_COLOR, { roughness: 0.85 }).clone();
|
|
43394
|
+
liner.side = this.THREE.DoubleSide;
|
|
43395
|
+
for (const piece of skin) piece.userData.doorSkin = true;
|
|
43396
|
+
const meshes = closeDoorSkin(this.THREE, skin, { toVehicle: inv, side: z.side < 0 ? -1 : 1, paint, liner, ...outward ? { outward } : {} });
|
|
43397
|
+
meshes.forEach((mesh2, i) => {
|
|
43398
|
+
mesh2.userData.doorShell = meshes.length === 2 && i === 0 ? "fold" : "inner";
|
|
43399
|
+
mesh2.castShadow = false;
|
|
43400
|
+
this.c.vehicle.add(mesh2);
|
|
43401
|
+
});
|
|
43402
|
+
return meshes;
|
|
43403
|
+
}
|
|
43404
|
+
/**
|
|
43405
|
+
* The trunk under a lid that opens: a tub lined in carpet (floor, sides, the front wall at the back seat) under the opening, and the rubber seal
|
|
43406
|
+
* along the sill, so the opening shows the luggage space and not the dark inside of the body.
|
|
43407
|
+
*/
|
|
43408
|
+
trunkBay(z) {
|
|
43409
|
+
const carpet = this.I.makeMaterial(TRUNK_CARPET_COLOR, { roughness: 0.95 }).clone();
|
|
43410
|
+
const seal = this.I.makeMaterial(TRUNK_SEAL_COLOR, { roughness: 0.7 });
|
|
43411
|
+
for (const mesh2 of buildTrunkBay(this.THREE, { box: z.box, clearance: this.c.meta.clearance ?? 0.3, carpet, seal })) this.c.vehicle.add(mesh2);
|
|
43412
|
+
}
|
|
43413
|
+
/**
|
|
43414
|
+
* The small parts the model draws inside the door (the inner pull and its bezel, the lock knob, a speaker): they stand deeper than the thin
|
|
43415
|
+
* trim the followers take, but sit within the door, so they swing with it instead of staying in the air over the opening.
|
|
43416
|
+
*/
|
|
43417
|
+
doorTrimIn(z, inv) {
|
|
43418
|
+
const B = z.box;
|
|
43419
|
+
const THREE = this.THREE;
|
|
43420
|
+
const deform = new Set(this.c.deform ?? []);
|
|
43421
|
+
return this.c.vehicle.children.filter((o) => {
|
|
43422
|
+
if (!o.isMesh || !o.visible || deform.has(o) || o.userData.decal || o.userData.glass || o.userData.noFollow || this.c.wheels.includes(o)) return false;
|
|
43423
|
+
const box2 = this.I.localBox(this.c, o, inv);
|
|
43424
|
+
if (box2.isEmpty()) return false;
|
|
43425
|
+
const centre = box2.getCenter(new THREE.Vector3());
|
|
43426
|
+
const size = box2.getSize(new THREE.Vector3());
|
|
43427
|
+
const inside = centre.x > B.x0 - DOOR_TRIM_MARGIN && centre.x < B.x1 + DOOR_TRIM_MARGIN && centre.y > B.y0 && centre.y < B.y1 && centre.z > B.z0 - DOOR_TRIM_MARGIN && centre.z < B.z1 + DOOR_TRIM_MARGIN;
|
|
43428
|
+
return inside && Math.max(size.x, size.y, size.z) <= DOOR_TRIM_SIZE;
|
|
43429
|
+
});
|
|
43430
|
+
}
|
|
42744
43431
|
/** A thin part at the foot of the opening, well inside the skin (a step, a sill trim, a rail on the floor), is the floor's: it does not swing with the door. */
|
|
42745
43432
|
inFloor(o, piv, z, inv) {
|
|
42746
43433
|
const side2 = z.side < 0 ? -1 : 1;
|
|
@@ -42761,7 +43448,7 @@ var GameVehiclesThree = (() => {
|
|
|
42761
43448
|
return true;
|
|
42762
43449
|
}
|
|
42763
43450
|
/** A door has edges: a band that follows the skin all round closes it to its card and hides where the cut followed the triangles of the shell; the same band, in the same paint as on a real car, lines the opening. */
|
|
42764
|
-
doorEdges(piv, z, y1) {
|
|
43451
|
+
doorEdges(piv, z, y1, closed) {
|
|
42765
43452
|
const THREE = this.THREE;
|
|
42766
43453
|
const B = z.box;
|
|
42767
43454
|
const side2 = z.side < 0 ? -1 : 1;
|
|
@@ -42781,13 +43468,13 @@ var GameVehiclesThree = (() => {
|
|
|
42781
43468
|
const at = this.surface("z", side2, B, [[x, y]]);
|
|
42782
43469
|
return at != null && Math.abs(at - flat) < DOOR_EDGE_REACH ? at : flat;
|
|
42783
43470
|
});
|
|
42784
|
-
const band = (lift, path,
|
|
43471
|
+
const band = (lift, path, closed2) => {
|
|
42785
43472
|
const position = [];
|
|
42786
43473
|
const index = [];
|
|
42787
43474
|
path.forEach((at, i) => {
|
|
42788
43475
|
const [x, y] = loop[at];
|
|
42789
43476
|
position.push(x, y, heights[at] + side2 * lift, x, y, heights[at] + side2 * (lift - DOOR_DEPTH));
|
|
42790
|
-
if (!
|
|
43477
|
+
if (!closed2 && i === path.length - 1) return;
|
|
42791
43478
|
const a = i * 2;
|
|
42792
43479
|
const b = (i + 1) % path.length * 2;
|
|
42793
43480
|
index.push(a, a + 1, b, b, a + 1, b + 1);
|
|
@@ -42813,21 +43500,18 @@ var GameVehiclesThree = (() => {
|
|
|
42813
43500
|
const cardMaterial = this.I.makeMaterial(DOOR_CARD_COLOR, { roughness: 0.85 }).clone();
|
|
42814
43501
|
cardMaterial.side = THREE.DoubleSide;
|
|
42815
43502
|
const card = new THREE.Mesh(cardGeometry, cardMaterial);
|
|
42816
|
-
card.userData.noFollow = true;
|
|
42817
|
-
card.castShadow = false;
|
|
42818
|
-
this.c.vehicle.add(card);
|
|
42819
|
-
piv.attach(card);
|
|
42820
43503
|
const all = loop.map((_, i) => i);
|
|
42821
43504
|
const top = 2 * DOOR_EDGE_PIECES;
|
|
42822
43505
|
const sides = [...all.slice(3 * DOOR_EDGE_PIECES), ...all.slice(0, top + 1)];
|
|
42823
43506
|
const edges = new THREE.Mesh(band(2e-3, all, true), paint);
|
|
42824
43507
|
const lining = new THREE.Mesh(band(2e-3, sides, false), paint);
|
|
42825
|
-
|
|
43508
|
+
const onDoor = closed ? [] : [card, edges];
|
|
43509
|
+
for (const m of [...onDoor, lining]) {
|
|
42826
43510
|
m.userData.noFollow = true;
|
|
42827
43511
|
m.castShadow = false;
|
|
42828
43512
|
this.c.vehicle.add(m);
|
|
42829
43513
|
}
|
|
42830
|
-
piv.attach(
|
|
43514
|
+
for (const m of onDoor) piv.attach(m);
|
|
42831
43515
|
}
|
|
42832
43516
|
/** The frame the model draws round a door's window (a dark strip over the glass) goes with the door: left behind it hangs in the air over the opening. */
|
|
42833
43517
|
framesAround(panes, inv) {
|
|
@@ -43838,6 +44522,7 @@ var GameVehiclesThree = (() => {
|
|
|
43838
44522
|
c.vehicle.position.y -= d / 4;
|
|
43839
44523
|
}
|
|
43840
44524
|
};
|
|
44525
|
+
var LID_OPEN = 1.31;
|
|
43841
44526
|
var DURATION = 1.2;
|
|
43842
44527
|
function createVehicleClips(model, vis, kit, c) {
|
|
43843
44528
|
const zones = kit.zonesOf(c);
|
|
@@ -43850,7 +44535,7 @@ var GameVehiclesThree = (() => {
|
|
|
43850
44535
|
if (!z || vis && !vis.plates.has(p.id)) continue;
|
|
43851
44536
|
const sgn = z.hinge === "rear" ? -1 : 1;
|
|
43852
44537
|
doors[p.id] = { rotation: [0, (z.side < 0 ? -1 : 1) * sgn * 1.15, 0] };
|
|
43853
|
-
} else if (p.role === "lid" && (!vis || vis.plates.has(p.id))) lid[p.id] = { rotation: [0, 0, -
|
|
44538
|
+
} else if (p.role === "lid" && (!vis || vis.plates.has(p.id))) lid[p.id] = { rotation: [0, 0, -LID_OPEN] };
|
|
43854
44539
|
else if (p.role === "hood" && (!vis || vis.hood?.id === p.id)) hood[p.id] = { rotation: [0, 0, (vis?.hood?.open ?? c.hood?.open ?? 1) * (vis?.hood?.sign ?? c.hood?.sign ?? 1)] };
|
|
43855
44540
|
}
|
|
43856
44541
|
const clips = [];
|
|
@@ -44246,7 +44931,7 @@ var GameVehiclesThree = (() => {
|
|
|
44246
44931
|
if (vis) {
|
|
44247
44932
|
const pos = new V3(d.box.center[0], Math.max(0.2, (c.meta.clearance ?? 0.3) * 0.8), d.box.center[2]);
|
|
44248
44933
|
if (fluid === "coolant") kit.addEmitter(c, new V3(d.box.center[0], d.box.center[1] + 0.2, d.box.center[2]), "white", { rate: 5, s: 0.8 });
|
|
44249
|
-
if ((c.meta.kind ?? "car") !== "boat") l.pud = I.puddle(c, fluidKind(fluid), pos, fluid === "oil" ? 0.8 : fluid === "brake_fluid" ? 0.4 : 1.1);
|
|
44934
|
+
if ((c.meta.kind ?? "car") !== "boat" && options.puddles !== false) l.pud = I.puddle(c, fluidKind(fluid), pos, fluid === "oil" ? 0.8 : fluid === "brake_fluid" ? 0.4 : 1.1);
|
|
44250
44935
|
}
|
|
44251
44936
|
}
|
|
44252
44937
|
const out3 = dirToWorld(new V3(dirLocal.x * 0.5, dirLocal.y * 0.5 - 0.6, dirLocal.z * 0.5));
|
|
@@ -45204,6 +45889,130 @@ var GameVehiclesThree = (() => {
|
|
|
45204
45889
|
leak
|
|
45205
45890
|
};
|
|
45206
45891
|
}
|
|
45892
|
+
var RAIN_OPENING_DIAMETER = 0.3;
|
|
45893
|
+
var RAIN_MOVE_STEP = 1;
|
|
45894
|
+
var RAIN_TURN_STEP = 0.08;
|
|
45895
|
+
var UPRIGHT = 0.7;
|
|
45896
|
+
var GONE2 = /* @__PURE__ */ new Set(["broken", "melted", "ashes"]);
|
|
45897
|
+
var COVERING_ROLES = /* @__PURE__ */ new Set(["roof"]);
|
|
45898
|
+
var COVERED_KINDS = /* @__PURE__ */ new Set(["car", "bus", "truck"]);
|
|
45899
|
+
var TALL_PANEL = 1.5;
|
|
45900
|
+
var NEAR_TOP = 0.85;
|
|
45901
|
+
var BODY_PANELS = 3;
|
|
45902
|
+
var OPENING_ROLES = /* @__PURE__ */ new Set(["roof", "glass"]);
|
|
45903
|
+
function bodyRoof(source, alive, kind) {
|
|
45904
|
+
const top = source.vehicle.meta.top;
|
|
45905
|
+
if (!COVERED_KINDS.has(kind) || top === void 0 || source.model.parts.some((def) => COVERING_ROLES.has(def.role))) return null;
|
|
45906
|
+
const panels = source.model.parts.filter((def) => def.role === "panel" && def.box.size[1] >= TALL_PANEL && def.box.center[1] + def.box.size[1] / 2 >= top * NEAR_TOP && alive(def.id));
|
|
45907
|
+
if (panels.length < BODY_PANELS) return null;
|
|
45908
|
+
const x0 = Math.min(...panels.map((def) => def.box.center[0] - def.box.size[0] / 2));
|
|
45909
|
+
const x1 = Math.max(...panels.map((def) => def.box.center[0] + def.box.size[0] / 2));
|
|
45910
|
+
const z1 = Math.max(...panels.map((def) => Math.abs(def.box.center[2]) + def.box.size[2] / 2));
|
|
45911
|
+
return { x: (x0 + x1) / 2, z: 0, halfX: (x1 - x0) / 2, halfZ: z1, top: Math.max(...panels.map((def) => def.box.center[1] + def.box.size[1] / 2)) };
|
|
45912
|
+
}
|
|
45913
|
+
var hasMoved = (elements, last) => {
|
|
45914
|
+
for (let index = 0; index < 16; index++) if (elements[index] !== last[index]) return true;
|
|
45915
|
+
return false;
|
|
45916
|
+
};
|
|
45917
|
+
var localOf = (box2, top = box2.center[1] + box2.size[1] / 2) => ({ x: box2.center[0], z: box2.center[2], halfX: box2.size[0] / 2, halfZ: box2.size[2] / 2, top });
|
|
45918
|
+
function createVehicleRainCover(source, options = {}) {
|
|
45919
|
+
const vehicle = source.vehicle;
|
|
45920
|
+
const node = vehicle.vehicle;
|
|
45921
|
+
const cabin = cabinBoxOf(vehicle);
|
|
45922
|
+
const cover = createFootprintRainCover();
|
|
45923
|
+
let roofs = [];
|
|
45924
|
+
let openings = [];
|
|
45925
|
+
let isShellChanged = true;
|
|
45926
|
+
let bumpedX = Infinity;
|
|
45927
|
+
let bumpedZ = Infinity;
|
|
45928
|
+
let bumpedYaw = 0;
|
|
45929
|
+
const placedAt = new Float64Array(16);
|
|
45930
|
+
const refreshShell = () => {
|
|
45931
|
+
if (!node?.localToWorld) return;
|
|
45932
|
+
const state = source.state();
|
|
45933
|
+
const byId = new Map(state.parts.map((part) => [part.id, part]));
|
|
45934
|
+
const mainGroup = state.groups[0] ? new Set(state.groups[0]) : null;
|
|
45935
|
+
const alive = (id) => {
|
|
45936
|
+
const part = byId.get(id);
|
|
45937
|
+
return part !== void 0 && !GONE2.has(part.status) && (mainGroup === null || mainGroup.has(id));
|
|
45938
|
+
};
|
|
45939
|
+
const nextRoofs = [];
|
|
45940
|
+
const nextOpenings = [];
|
|
45941
|
+
const roofParts = source.model.parts.filter((def) => COVERING_ROLES.has(def.role));
|
|
45942
|
+
const kind = String(vehicle.meta.kind);
|
|
45943
|
+
const hull = bodyRoof(source, alive, kind);
|
|
45944
|
+
const hasRoof = COVERED_KINDS.has(kind) && (roofParts.some((def) => alive(def.id)) || hull !== null);
|
|
45945
|
+
if (!state.destroyed && hasRoof) {
|
|
45946
|
+
if (roofParts.some((def) => alive(def.id))) {
|
|
45947
|
+
if (cabin) nextRoofs.push({ x: (cabin.x0 + cabin.x1) / 2, z: 0, halfX: (cabin.x1 - cabin.x0) / 2, halfZ: cabin.z, top: cabin.y0 + (cabin.y1 - cabin.y0) / 2 });
|
|
45948
|
+
for (const def of source.model.parts) {
|
|
45949
|
+
if (!alive(def.id) || !(COVERING_ROLES.has(def.role) || cabin && def.role === "glass")) continue;
|
|
45950
|
+
nextRoofs.push(localOf(def.box));
|
|
45951
|
+
}
|
|
45952
|
+
} else if (hull) {
|
|
45953
|
+
nextRoofs.push(hull);
|
|
45954
|
+
}
|
|
45955
|
+
for (const def of source.model.parts) {
|
|
45956
|
+
if (!OPENING_ROLES.has(def.role) || !(cabin || hull || COVERING_ROLES.has(def.role))) continue;
|
|
45957
|
+
if (!alive(def.id)) nextOpenings.push(localOf(def.box));
|
|
45958
|
+
}
|
|
45959
|
+
const frame = options.frame ?? vehicle.root;
|
|
45960
|
+
frame?.updateWorldMatrix?.(true, false);
|
|
45961
|
+
node.updateWorldMatrix?.(true, false);
|
|
45962
|
+
const inverse = node.matrixWorld.clone().invert();
|
|
45963
|
+
const V3 = node.position.constructor;
|
|
45964
|
+
for (const def of source.model.parts) {
|
|
45965
|
+
if (!OPENING_ROLES.has(def.role) || !alive(def.id)) continue;
|
|
45966
|
+
for (const hole of byId.get(def.id).holes) {
|
|
45967
|
+
if (!hole.through || hole.diameter < RAIN_OPENING_DIAMETER || !frame?.localToWorld) continue;
|
|
45968
|
+
const point = new V3(hole.point[0], hole.point[1], hole.point[2]);
|
|
45969
|
+
frame.localToWorld(point);
|
|
45970
|
+
point.applyMatrix4(inverse);
|
|
45971
|
+
nextOpenings.push({ x: point.x, z: point.z, halfX: hole.diameter / 2, halfZ: hole.diameter / 2, top: 0 });
|
|
45972
|
+
}
|
|
45973
|
+
}
|
|
45974
|
+
}
|
|
45975
|
+
roofs = nextRoofs;
|
|
45976
|
+
openings = nextOpenings;
|
|
45977
|
+
isShellChanged = true;
|
|
45978
|
+
};
|
|
45979
|
+
const place = () => {
|
|
45980
|
+
if (!node) return;
|
|
45981
|
+
node.updateWorldMatrix?.(true, false);
|
|
45982
|
+
const e = node.matrixWorld.elements;
|
|
45983
|
+
if (!isShellChanged && !hasMoved(e, placedAt)) return;
|
|
45984
|
+
placedAt.set(e);
|
|
45985
|
+
const scaleY = Math.hypot(e[4], e[5], e[6]);
|
|
45986
|
+
if (roofs.length === 0 || e[5] / (scaleY || 1) < UPRIGHT) {
|
|
45987
|
+
if (isShellChanged || bumpedX !== Infinity) cover.set([], [], true);
|
|
45988
|
+
bumpedX = Infinity;
|
|
45989
|
+
isShellChanged = false;
|
|
45990
|
+
return;
|
|
45991
|
+
}
|
|
45992
|
+
const scaleX = Math.hypot(e[0], e[1], e[2]);
|
|
45993
|
+
const scaleZ = Math.hypot(e[8], e[9], e[10]);
|
|
45994
|
+
const yaw = Math.atan2(e[2], e[0]);
|
|
45995
|
+
const toWorld = (f) => ({
|
|
45996
|
+
x: e[0] * f.x + e[4] * f.top + e[8] * f.z + e[12],
|
|
45997
|
+
z: e[2] * f.x + e[6] * f.top + e[10] * f.z + e[14],
|
|
45998
|
+
halfX: f.halfX * scaleX,
|
|
45999
|
+
halfZ: f.halfZ * scaleZ,
|
|
46000
|
+
yaw,
|
|
46001
|
+
top: e[1] * f.x + e[5] * f.top + e[9] * f.z + e[13]
|
|
46002
|
+
});
|
|
46003
|
+
const moved = Math.hypot(e[12] - bumpedX, e[14] - bumpedZ) >= RAIN_MOVE_STEP || Math.abs(yaw - bumpedYaw) >= RAIN_TURN_STEP;
|
|
46004
|
+
const isBump = isShellChanged || moved;
|
|
46005
|
+
cover.set(roofs.map(toWorld), openings.map(toWorld), isBump);
|
|
46006
|
+
isShellChanged = false;
|
|
46007
|
+
if (isBump) {
|
|
46008
|
+
bumpedX = e[12];
|
|
46009
|
+
bumpedZ = e[14];
|
|
46010
|
+
bumpedYaw = yaw;
|
|
46011
|
+
}
|
|
46012
|
+
};
|
|
46013
|
+
refreshShell();
|
|
46014
|
+
return { source: cover, refreshShell, place };
|
|
46015
|
+
}
|
|
45207
46016
|
var cabin_default = {
|
|
45208
46017
|
source: "Spec 012 (R6, T0.2) \u2014 SAE J1100 interior packaging & ISO 7250-1 / NASA-STD-3000 adult anthropometry (1.80 m seated height = 0.936 m, buttock-knee = 0.612 m, shoulder = 0.468 m)",
|
|
45209
46018
|
entryDuckFactor: 0.44,
|
|
@@ -45360,6 +46169,46 @@ var GameVehiclesThree = (() => {
|
|
|
45360
46169
|
};
|
|
45361
46170
|
}
|
|
45362
46171
|
|
|
46172
|
+
// src/rain-cover.ts
|
|
46173
|
+
var RAIN_SHELL_INTERVAL = 0.4;
|
|
46174
|
+
function createVehicleRainCovers() {
|
|
46175
|
+
const tracked = /* @__PURE__ */ new Map();
|
|
46176
|
+
let counter = 0;
|
|
46177
|
+
const end = (id) => {
|
|
46178
|
+
tracked.get(id)?.remove?.();
|
|
46179
|
+
tracked.delete(id);
|
|
46180
|
+
};
|
|
46181
|
+
return {
|
|
46182
|
+
track(id, source, frame) {
|
|
46183
|
+
tracked.set(id, { rain: createVehicleRainCover(source, { frame }), frame, remove: void 0, untilShell: counter++ % 8 * (RAIN_SHELL_INTERVAL / 8) });
|
|
46184
|
+
},
|
|
46185
|
+
untrack: end,
|
|
46186
|
+
sync(cover, dt) {
|
|
46187
|
+
if (!cover) return;
|
|
46188
|
+
for (const [id, entry] of tracked) {
|
|
46189
|
+
if (!entry.frame.parent) {
|
|
46190
|
+
if (entry.remove) end(id);
|
|
46191
|
+
continue;
|
|
46192
|
+
}
|
|
46193
|
+
if (!entry.remove) {
|
|
46194
|
+
entry.remove = cover.add(entry.rain.source);
|
|
46195
|
+
entry.rain.refreshShell();
|
|
46196
|
+
}
|
|
46197
|
+
entry.untilShell -= dt;
|
|
46198
|
+
if (entry.untilShell <= 0) {
|
|
46199
|
+
entry.untilShell = RAIN_SHELL_INTERVAL;
|
|
46200
|
+
entry.rain.refreshShell();
|
|
46201
|
+
}
|
|
46202
|
+
entry.rain.place();
|
|
46203
|
+
}
|
|
46204
|
+
},
|
|
46205
|
+
clear() {
|
|
46206
|
+
for (const id of [...tracked.keys()]) end(id);
|
|
46207
|
+
},
|
|
46208
|
+
ids: () => [...tracked.keys()]
|
|
46209
|
+
};
|
|
46210
|
+
}
|
|
46211
|
+
|
|
45363
46212
|
// ../game-audio/dist/chunk-ZE4VVIU3.js
|
|
45364
46213
|
var DISTANCE_CURVES = {
|
|
45365
46214
|
/** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
|
|
@@ -48988,7 +49837,7 @@ var GameVehiclesThree = (() => {
|
|
|
48988
49837
|
|
|
48989
49838
|
// src/colliders.ts
|
|
48990
49839
|
var SHELL_ROLES2 = /* @__PURE__ */ new Set(["panel", "fender", "roof", "frame", "glass", "pillar", "door", "lid", "hood", "bumper"]);
|
|
48991
|
-
var
|
|
49840
|
+
var GONE3 = /* @__PURE__ */ new Set(["broken", "melted", "ashes"]);
|
|
48992
49841
|
var MIN_AREA = 1e-9;
|
|
48993
49842
|
var CHUNK = 0.8;
|
|
48994
49843
|
var CELL_BIAS2 = 512;
|
|
@@ -49157,7 +50006,7 @@ var GameVehiclesThree = (() => {
|
|
|
49157
50006
|
const state = new Map(vehicle.state().parts.map((part) => [part.id, part]));
|
|
49158
50007
|
const isGone = (id) => {
|
|
49159
50008
|
const part = state.get(id);
|
|
49160
|
-
return part !== void 0 && (
|
|
50009
|
+
return part !== void 0 && (GONE3.has(part.status) || part.group !== 0);
|
|
49161
50010
|
};
|
|
49162
50011
|
const budget = { left: options.budget ?? DEFAULT_BUDGET };
|
|
49163
50012
|
pending = false;
|
|
@@ -49897,6 +50746,7 @@ var GameVehiclesThree = (() => {
|
|
|
49897
50746
|
const kits = /* @__PURE__ */ new WeakMap();
|
|
49898
50747
|
const placed = /* @__PURE__ */ new Map();
|
|
49899
50748
|
const cabins = createCabinSmoke();
|
|
50749
|
+
const rainCovers = createVehicleRainCovers();
|
|
49900
50750
|
let host = null;
|
|
49901
50751
|
let three = null;
|
|
49902
50752
|
let counter = 0;
|
|
@@ -49966,7 +50816,7 @@ var GameVehiclesThree = (() => {
|
|
|
49966
50816
|
impl: (root, id) => {
|
|
49967
50817
|
const r = root;
|
|
49968
50818
|
const kit = r.userData.kit;
|
|
49969
|
-
const d = createVehicleDestructible(kit, r.userData.vehicle, { id, frame: root, name: text.items[itemKey] ?? key, creaseQueue });
|
|
50819
|
+
const d = createVehicleDestructible(kit, r.userData.vehicle, { id, frame: root, name: text.items[itemKey] ?? key, creaseQueue, puddles: false });
|
|
49970
50820
|
tapEffects(d);
|
|
49971
50821
|
const colliders = createVehicleColliders(kit.THREE, d, root, { budget: COLLIDER_BUDGET });
|
|
49972
50822
|
d.colliders = colliders.pieces;
|
|
@@ -49993,6 +50843,7 @@ var GameVehiclesThree = (() => {
|
|
|
49993
50843
|
return hitBody(h);
|
|
49994
50844
|
};
|
|
49995
50845
|
cabins.track(id, d, root);
|
|
50846
|
+
rainCovers.track(id, d, root);
|
|
49996
50847
|
r.userData.destructible = d;
|
|
49997
50848
|
return d;
|
|
49998
50849
|
},
|
|
@@ -50304,6 +51155,7 @@ var GameVehiclesThree = (() => {
|
|
|
50304
51155
|
if (host?.bench && boxKey() !== helpersShown && (host.bench.layer("damageables") || host.bench.layer("zones") || helpersShown !== "")) refreshLayers();
|
|
50305
51156
|
lane?.step(dt);
|
|
50306
51157
|
cabins.sync(effects());
|
|
51158
|
+
rainCovers.sync(host?.rainCover, dt);
|
|
50307
51159
|
};
|
|
50308
51160
|
const count2 = () => {
|
|
50309
51161
|
let drawCalls = 0;
|
|
@@ -50414,6 +51266,7 @@ var GameVehiclesThree = (() => {
|
|
|
50414
51266
|
stopCrease?.();
|
|
50415
51267
|
stopLodBatch?.();
|
|
50416
51268
|
cabins.clear(effects());
|
|
51269
|
+
rainCovers.clear();
|
|
50417
51270
|
clearHelpers();
|
|
50418
51271
|
clearLane();
|
|
50419
51272
|
host = null;
|
|
@@ -50422,6 +51275,9 @@ var GameVehiclesThree = (() => {
|
|
|
50422
51275
|
};
|
|
50423
51276
|
}
|
|
50424
51277
|
function loadVehiclesTestModule(room, options = {}) {
|
|
51278
|
+
return room.loadModule(createVehiclesTestModule({ ...options, three: learnThree(room, options) }));
|
|
51279
|
+
}
|
|
51280
|
+
function learnThree(room, options) {
|
|
50425
51281
|
let three = options.three;
|
|
50426
51282
|
if (!three) {
|
|
50427
51283
|
room.loadModule({ id: "vehicles_probe", name: "Vehicles probe", group: "Vehicles", items: () => [], attach: (lent) => {
|
|
@@ -50429,7 +51285,7 @@ var GameVehiclesThree = (() => {
|
|
|
50429
51285
|
return () => void 0;
|
|
50430
51286
|
} });
|
|
50431
51287
|
}
|
|
50432
|
-
return
|
|
51288
|
+
return three;
|
|
50433
51289
|
}
|
|
50434
51290
|
|
|
50435
51291
|
// ../game-camera/dist/index.js
|