@adatechnology/game-vehicles-three 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TZ23KYPZ.js → chunk-LVDWW5KZ.js} +613 -6
- package/dist/chunk-LVDWW5KZ.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.global.js +710 -496
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +9 -465
- package/dist/index.js.map +1 -1
- package/dist/{testing-CRVetKNa.d.ts → testing-BgTVk344.d.ts} +2 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-TZ23KYPZ.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -427,6 +427,42 @@ var GameVehiclesThree = (() => {
|
|
|
427
427
|
};
|
|
428
428
|
|
|
429
429
|
// ../game-vehicles-fleet/dist/index.js
|
|
430
|
+
var motorcycles = [
|
|
431
|
+
"bicycle",
|
|
432
|
+
"scooter",
|
|
433
|
+
"commuter_motorcycle",
|
|
434
|
+
"trail_bike",
|
|
435
|
+
"adventure_bike",
|
|
436
|
+
"highway_police_bike",
|
|
437
|
+
"quad_bike",
|
|
438
|
+
"step_through_scooter",
|
|
439
|
+
"naked_bike",
|
|
440
|
+
"sport_bike",
|
|
441
|
+
"cruiser",
|
|
442
|
+
"delivery_bike"
|
|
443
|
+
];
|
|
444
|
+
var cars = [
|
|
445
|
+
"compact_hatch",
|
|
446
|
+
"taxi",
|
|
447
|
+
"entry_hatch",
|
|
448
|
+
"electric_hatch",
|
|
449
|
+
"midsize_sedan",
|
|
450
|
+
"police_sedan",
|
|
451
|
+
"highway_police_sedan",
|
|
452
|
+
"beetle",
|
|
453
|
+
"boxy_hatch",
|
|
454
|
+
"family_hatch",
|
|
455
|
+
"rideshare_hatch",
|
|
456
|
+
"turbo_hatch",
|
|
457
|
+
"fastback_sedan",
|
|
458
|
+
"classic_six_sedan",
|
|
459
|
+
"v8_coupe"
|
|
460
|
+
];
|
|
461
|
+
var suvs = ["compact_suv", "hybrid_suv", "midsize_suv", "large_suv"];
|
|
462
|
+
var pickups = ["compact_pickup", "crossover_pickup", "midsize_pickup", "monster_truck"];
|
|
463
|
+
var vans = ["cargo_van", "ambulance"];
|
|
464
|
+
var heavy = ["box_truck", "tanker_truck", "school_bus", "city_bus", "armored_truck"];
|
|
465
|
+
var agricultural = ["tractor"];
|
|
430
466
|
var military = [
|
|
431
467
|
"light_4x4",
|
|
432
468
|
"troop_truck",
|
|
@@ -437,6 +473,20 @@ var GameVehiclesThree = (() => {
|
|
|
437
473
|
"light_attack_turboprop",
|
|
438
474
|
"attack_helicopter"
|
|
439
475
|
];
|
|
476
|
+
var water = ["river_skiff", "speedboat", "fishing_boat", "jet_ski", "sailboat", "rescue_dinghy", "patrol_boat"];
|
|
477
|
+
var air = [
|
|
478
|
+
"single_engine_plane",
|
|
479
|
+
"crop_duster",
|
|
480
|
+
"piston_helicopter",
|
|
481
|
+
"rescue_helicopter",
|
|
482
|
+
"tandem_trainer",
|
|
483
|
+
"regional_turboprop",
|
|
484
|
+
"amphibian_turboprop",
|
|
485
|
+
"light_jet",
|
|
486
|
+
"trainer_helicopter",
|
|
487
|
+
"turbine_helicopter",
|
|
488
|
+
"police_helicopter"
|
|
489
|
+
];
|
|
440
490
|
var fleetGroupIds = [
|
|
441
491
|
"motorcycles",
|
|
442
492
|
"cars",
|
|
@@ -449,6 +499,18 @@ var GameVehiclesThree = (() => {
|
|
|
449
499
|
"water",
|
|
450
500
|
"air"
|
|
451
501
|
];
|
|
502
|
+
var fleetGroups = {
|
|
503
|
+
motorcycles,
|
|
504
|
+
cars,
|
|
505
|
+
suvs,
|
|
506
|
+
pickups,
|
|
507
|
+
vans,
|
|
508
|
+
heavy,
|
|
509
|
+
agricultural,
|
|
510
|
+
military,
|
|
511
|
+
water,
|
|
512
|
+
air
|
|
513
|
+
};
|
|
452
514
|
var legacyVehicleSeeds = {
|
|
453
515
|
compact_hatch: "hatch",
|
|
454
516
|
taxi: "taxi",
|
|
@@ -28214,6 +28276,9 @@ var GameVehiclesThree = (() => {
|
|
|
28214
28276
|
}
|
|
28215
28277
|
return palette[0][0];
|
|
28216
28278
|
};
|
|
28279
|
+
var fleetGroupOf = (id) => Object.entries(fleetGroups).find(([, ids]) => ids.includes(id))?.[0];
|
|
28280
|
+
var HULL_CEILING = { motorcycles: 64, cars: 256, suvs: 256, pickups: 256, vans: 300, heavy: 550, agricultural: 150, military: 500, air: 500, water: 450 };
|
|
28281
|
+
var fleetHullCeilingOf = (id) => HULL_CEILING[fleetGroupOf(id) ?? ""];
|
|
28217
28282
|
|
|
28218
28283
|
// src/lite.ts
|
|
28219
28284
|
var LITE_CLASSES = ["paint", "trim", "metal", "glass", "light", "plate"];
|
|
@@ -37107,9 +37172,9 @@ var GameVehiclesThree = (() => {
|
|
|
37107
37172
|
opts = opts || {};
|
|
37108
37173
|
dir = dir.clone().normalize();
|
|
37109
37174
|
const m = c.meta;
|
|
37110
|
-
const
|
|
37111
|
-
const Wref =
|
|
37112
|
-
const R0 = (0.55 + 0.45 * force) * (
|
|
37175
|
+
const air2 = m.kind === "plane" || m.kind === "heli";
|
|
37176
|
+
const Wref = air2 ? m.fuselageWidth || 1.3 : m.width || 1.7;
|
|
37177
|
+
const R0 = (0.55 + 0.45 * force) * (air2 ? 1.25 : 1);
|
|
37113
37178
|
const maxD = Math.min(0.18 * Wref, 0.26, R0 * 0.32, opts.maxDepth || 9) * (1 - 0.85 * clamp(m.stiff || 0, 0, 1));
|
|
37114
37179
|
const H = {
|
|
37115
37180
|
p,
|
|
@@ -37262,7 +37327,7 @@ var GameVehiclesThree = (() => {
|
|
|
37262
37327
|
}
|
|
37263
37328
|
const surf = findSurface(c, p, dir);
|
|
37264
37329
|
if (surf) {
|
|
37265
|
-
if (kit.config.impactStain && !opts.noStain && force > 0.45 && !
|
|
37330
|
+
if (kit.config.impactStain && !opts.noStain && force > 0.45 && !air2 && m.kind !== "boat") {
|
|
37266
37331
|
const sp = surf.p.clone().addScaledVector(surf.n, 2e-3);
|
|
37267
37332
|
markDecal(
|
|
37268
37333
|
kit.splat(c, sp, surf.n, 0.08 + force * 0.04, {
|
|
@@ -38705,17 +38770,17 @@ var GameVehiclesThree = (() => {
|
|
|
38705
38770
|
return { lo, hi };
|
|
38706
38771
|
}
|
|
38707
38772
|
function regionCands(c, z, cands) {
|
|
38708
|
-
if (!cands.some(
|
|
38773
|
+
if (!cands.some(heavy2)) return cands;
|
|
38709
38774
|
const R = decalRegion(c, z);
|
|
38710
38775
|
const Mw = c.vehicle.matrixWorld;
|
|
38711
38776
|
return cands.map(function(o) {
|
|
38712
|
-
if (!
|
|
38777
|
+
if (!heavy2(o)) return o;
|
|
38713
38778
|
if (!o.geometry.boundingSphere) o.geometry.computeBoundingSphere();
|
|
38714
38779
|
if (!o.geometry.boundingBox) o.geometry.computeBoundingBox();
|
|
38715
38780
|
return proxyIn(o, Mw, R);
|
|
38716
38781
|
});
|
|
38717
38782
|
}
|
|
38718
|
-
function
|
|
38783
|
+
function heavy2(o) {
|
|
38719
38784
|
const g = o.geometry;
|
|
38720
38785
|
const pos = g && g.attributes && g.attributes.position;
|
|
38721
38786
|
return o.raycast === THREE.Mesh.prototype.raycast && !o.isSkinnedMesh && !Array.isArray(o.material) && pos && !pos.isInterleavedBufferAttribute && pos.itemSize === 3 && !g.groups.length && !(g.morphAttributes && g.morphAttributes.position) && (g.index ? g.index.count : pos.count) / 3 >= PROXY_MIN_TRIANGLES;
|
|
@@ -49728,13 +49793,14 @@ var GameVehiclesThree = (() => {
|
|
|
49728
49793
|
return { gauge: tracks.gauge, rearX: tracks.rearX - middle, frontX: tracks.frontX - middle, roadWheels: tracks.roadWheels, roadRadius: tracks.radius };
|
|
49729
49794
|
};
|
|
49730
49795
|
var RIDER_MASS_KG = 75;
|
|
49731
|
-
var MOTORCYCLE_POWER_FACTOR = 1.3;
|
|
49732
49796
|
var MOTORCYCLE_POWER_RATING_1 = 11800 / (132 + RIDER_MASS_KG);
|
|
49733
49797
|
var MOTORCYCLE_POWER_RATING_10 = 33400 / (168 + RIDER_MASS_KG);
|
|
49734
|
-
var motorcyclePower = (rating) =>
|
|
49798
|
+
var motorcyclePower = (rating) => MOTORCYCLE_POWER_RATING_1 + (MOTORCYCLE_POWER_RATING_10 - MOTORCYCLE_POWER_RATING_1) * (rating - 1) / 9;
|
|
49799
|
+
var PHYSICS_TORQUE_SCALE = { car: 1.45, motorcycle: 1.3 };
|
|
49735
49800
|
var carPower = (rating) => (0.06 + 0.015 * rating) * (defaultSemiSpec.engine.peakRpm * 2 * Math.PI / 60);
|
|
49801
|
+
var TRACKED_POWER = 20.05;
|
|
49736
49802
|
var peakTorqueOf = (type, rating, mass, peakRpm) => {
|
|
49737
|
-
const power = type === "motorcycle" ? motorcyclePower(rating) : carPower(rating);
|
|
49803
|
+
const power = type === "motorcycle" ? motorcyclePower(rating) : type === "tracked" ? TRACKED_POWER : carPower(rating);
|
|
49738
49804
|
return mass * power * 60 / (2 * Math.PI * peakRpm);
|
|
49739
49805
|
};
|
|
49740
49806
|
var cyclistFor = (top, wheelRadius) => {
|
|
@@ -49790,6 +49856,7 @@ var GameVehiclesThree = (() => {
|
|
|
49790
49856
|
gears,
|
|
49791
49857
|
drag,
|
|
49792
49858
|
brakeForce,
|
|
49859
|
+
...type === "car" || type === "motorcycle" ? { physicsTorqueScale: PHYSICS_TORQUE_SCALE[type] } : {},
|
|
49793
49860
|
tyre: { ...spec.tyre, friction: 0.8 + 0.03 * stats2.handling },
|
|
49794
49861
|
...pedal ? { pedal } : {},
|
|
49795
49862
|
...tracks ? { tracks } : {}
|
|
@@ -50215,8 +50282,8 @@ var GameVehiclesThree = (() => {
|
|
|
50215
50282
|
state.charge = clamp3(state.charge + net * dt / 3600 / capacity, 0, 1);
|
|
50216
50283
|
if (before >= crankCharge && state.charge < crankCharge && !running) events.push({ type: "battery_flat" });
|
|
50217
50284
|
const work = running ? clamp3(0.15 + 0.85 * throttle * (driver.state.rpm / 6500), 0, 1) : 0;
|
|
50218
|
-
const
|
|
50219
|
-
const cool =
|
|
50285
|
+
const air2 = cooling.stopped + (cooling.fast - cooling.stopped) * clamp3(Math.abs(driver.state.u) / 27.8, 0, 1);
|
|
50286
|
+
const cool = air2 * clamp3(radiator, 0.05, 1) * (running ? 1 + (controls.climate.on ? 0.15 : 0) : 1);
|
|
50220
50287
|
const opened = state.coolantC >= thermostat ? 1 : 0.15;
|
|
50221
50288
|
state.coolantC += (heat * work - cool * opened * (state.coolantC - ambient)) * dt;
|
|
50222
50289
|
state.coolantC = coolantC ?? Math.max(ambient, state.coolantC);
|
|
@@ -50335,14 +50402,14 @@ var GameVehiclesThree = (() => {
|
|
|
50335
50402
|
const outside = options.outsideHumidity ?? 0.6;
|
|
50336
50403
|
const breath = options.breath ?? 4e-3;
|
|
50337
50404
|
const wet = options.wet ?? 2e-3;
|
|
50338
|
-
const
|
|
50405
|
+
const air2 = options.air ?? { shut: 2e-3, window: 0.05, climate: 0.01, demist: 0.06 };
|
|
50339
50406
|
const coldSpan = options.coldSpan ?? 15;
|
|
50340
50407
|
const rates = options.rates ?? { build: 0.05, clear: 0.03, demist: 0.25 };
|
|
50341
50408
|
const state = { humidity: outside, fog: 0 };
|
|
50342
50409
|
return {
|
|
50343
50410
|
state,
|
|
50344
50411
|
step({ dt, occupants, outsideC, cabinC, rain = 0, speed = 0, windows = 0, climate, engineWarm = 1 }) {
|
|
50345
|
-
const exchange =
|
|
50412
|
+
const exchange = air2.shut + air2.window * clamp4(windows, 0, 1) + (climate.on ? air2.climate : 0) + (climate.demist ? air2.demist : 0);
|
|
50346
50413
|
const source = breath * Math.max(0, occupants) + wet * clamp4(rain, 0, 1) * (occupants > 0 ? 1 : 0);
|
|
50347
50414
|
const towards = climate.on ? outside * 0.4 : outside;
|
|
50348
50415
|
state.humidity = clamp4(state.humidity + (source - exchange * (state.humidity - towards)) * dt, 0, 1);
|
|
@@ -50916,6 +50983,33 @@ var GameVehiclesThree = (() => {
|
|
|
50916
50983
|
var vehicleColliders = (THREE, vehicle, frame) => createVehicleColliders(THREE, vehicle, frame).pieces();
|
|
50917
50984
|
var vehicleHulls = (THREE, vehicle, frame) => createVehicleColliders(THREE, vehicle, frame, { hulls: true }).hulls();
|
|
50918
50985
|
|
|
50986
|
+
// src/hull-plan-cache.ts
|
|
50987
|
+
var createHullPlanCache = () => {
|
|
50988
|
+
const shared2 = /* @__PURE__ */ new Map();
|
|
50989
|
+
const flights = /* @__PURE__ */ new Map();
|
|
50990
|
+
let planned = 0, reused = 0;
|
|
50991
|
+
let isDisposed = false;
|
|
50992
|
+
return {
|
|
50993
|
+
get: (key) => shared2.get(key),
|
|
50994
|
+
set: (key, value) => {
|
|
50995
|
+
if (!isDisposed && !shared2.has(key)) shared2.set(key, value);
|
|
50996
|
+
},
|
|
50997
|
+
flight: (key) => flights.get(key),
|
|
50998
|
+
setFlight: (key, flight) => void (isDisposed || flights.set(key, flight)),
|
|
50999
|
+
clearFlight: (key) => void flights.delete(key),
|
|
51000
|
+
noteReused: () => void reused++,
|
|
51001
|
+
noteDivided: () => void planned++,
|
|
51002
|
+
stats: () => ({ models: shared2.size, planned, reused }),
|
|
51003
|
+
dispose: () => {
|
|
51004
|
+
isDisposed = true;
|
|
51005
|
+
shared2.clear();
|
|
51006
|
+
flights.clear();
|
|
51007
|
+
planned = 0;
|
|
51008
|
+
reused = 0;
|
|
51009
|
+
}
|
|
51010
|
+
};
|
|
51011
|
+
};
|
|
51012
|
+
|
|
50919
51013
|
// src/vehicle-lod.ts
|
|
50920
51014
|
var VEHICLE_LOD_DISTANCE = 14;
|
|
50921
51015
|
var HIT_BATCH_VERTICES = 16384;
|
|
@@ -51173,6 +51267,578 @@ var GameVehiclesThree = (() => {
|
|
|
51173
51267
|
};
|
|
51174
51268
|
}
|
|
51175
51269
|
|
|
51270
|
+
// ../game-physics/dist/index.js
|
|
51271
|
+
var CONTACT_READ_STRIDE = 7;
|
|
51272
|
+
var KIT_WORLD = {
|
|
51273
|
+
fixedStep: 1 / 120,
|
|
51274
|
+
velocityIterations: 32,
|
|
51275
|
+
positionIterations: 2,
|
|
51276
|
+
sleepAfter: 0.5,
|
|
51277
|
+
sleepSpeed: 0.08,
|
|
51278
|
+
penetrationSlop: 2e-3,
|
|
51279
|
+
maxPushOut: 2e-3,
|
|
51280
|
+
slipSpeed: 0.02,
|
|
51281
|
+
contactReportSpeed: 0.5,
|
|
51282
|
+
maxContacts: 4096,
|
|
51283
|
+
maxBodies: 8192
|
|
51284
|
+
};
|
|
51285
|
+
var POSE = new Float64Array(7);
|
|
51286
|
+
var VELOCITY = new Float64Array(6);
|
|
51287
|
+
var POSE2 = new Float64Array(7);
|
|
51288
|
+
var GOLDEN_ANGLE = Math.PI * (1 + Math.sqrt(5));
|
|
51289
|
+
var isPhysicsServices = (value) => {
|
|
51290
|
+
if (typeof value !== "object" || value === null) return false;
|
|
51291
|
+
const candidate = value;
|
|
51292
|
+
return typeof candidate.corpses === "function" && typeof candidate.setInterest === "function" && typeof candidate.blast === "object" && typeof candidate.loop === "object" && typeof candidate.world === "object";
|
|
51293
|
+
};
|
|
51294
|
+
|
|
51295
|
+
// src/crash-parts-clamp.ts
|
|
51296
|
+
var PASSES = 8;
|
|
51297
|
+
var holdWithin = (old, next, slop) => {
|
|
51298
|
+
const faces = convexFaces(old);
|
|
51299
|
+
if (!faces) return next;
|
|
51300
|
+
const middle = [0, 1, 2].map((k) => {
|
|
51301
|
+
let sum = 0;
|
|
51302
|
+
for (let i = k; i < old.length; i += 3) sum += old[i];
|
|
51303
|
+
return sum / (old.length / 3);
|
|
51304
|
+
});
|
|
51305
|
+
const planes = faces.map(([a, b, c]) => {
|
|
51306
|
+
const ux = old[b * 3] - old[a * 3], uy = old[b * 3 + 1] - old[a * 3 + 1], uz = old[b * 3 + 2] - old[a * 3 + 2];
|
|
51307
|
+
const wx = old[c * 3] - old[a * 3], wy = old[c * 3 + 1] - old[a * 3 + 1], wz = old[c * 3 + 2] - old[a * 3 + 2];
|
|
51308
|
+
const nx = uy * wz - uz * wy, ny = uz * wx - ux * wz, nz = ux * wy - uy * wx;
|
|
51309
|
+
const length = Math.hypot(nx, ny, nz) || 1;
|
|
51310
|
+
const towardMiddle = nx * (middle[0] - old[a * 3]) + ny * (middle[1] - old[a * 3 + 1]) + nz * (middle[2] - old[a * 3 + 2]);
|
|
51311
|
+
const sign2 = (towardMiddle > 0 ? -1 : 1) / length;
|
|
51312
|
+
const normal = [nx * sign2, ny * sign2, nz * sign2];
|
|
51313
|
+
return { normal, offset: normal[0] * old[a * 3] + normal[1] * old[a * 3 + 1] + normal[2] * old[a * 3 + 2] + slop };
|
|
51314
|
+
});
|
|
51315
|
+
let out;
|
|
51316
|
+
for (let i = 0; i < next.length; i += 3) {
|
|
51317
|
+
const p = [next[i], next[i + 1], next[i + 2]];
|
|
51318
|
+
let moved = false;
|
|
51319
|
+
for (let pass = 0; pass < PASSES; pass++) {
|
|
51320
|
+
let clean = true;
|
|
51321
|
+
for (const { normal, offset } of planes) {
|
|
51322
|
+
const past = normal[0] * p[0] + normal[1] * p[1] + normal[2] * p[2] - offset;
|
|
51323
|
+
if (past <= 0) continue;
|
|
51324
|
+
p[0] = p[0] - normal[0] * past;
|
|
51325
|
+
p[1] = p[1] - normal[1] * past;
|
|
51326
|
+
p[2] = p[2] - normal[2] * past;
|
|
51327
|
+
moved = true;
|
|
51328
|
+
clean = false;
|
|
51329
|
+
}
|
|
51330
|
+
if (clean) break;
|
|
51331
|
+
}
|
|
51332
|
+
if (!moved) continue;
|
|
51333
|
+
out ?? (out = Float32Array.from(next));
|
|
51334
|
+
out[i] = p[0];
|
|
51335
|
+
out[i + 1] = p[1];
|
|
51336
|
+
out[i + 2] = p[2];
|
|
51337
|
+
}
|
|
51338
|
+
return out ?? next;
|
|
51339
|
+
};
|
|
51340
|
+
|
|
51341
|
+
// src/crash-parts-chassis.ts
|
|
51342
|
+
var HULL_SLOP = 2e-3;
|
|
51343
|
+
var convexOf = (points) => ({ kind: "convex", points });
|
|
51344
|
+
var createChassisHulls = (colliders, partIndexOf) => {
|
|
51345
|
+
let children = [];
|
|
51346
|
+
const shape = () => {
|
|
51347
|
+
const hulls = colliders.hulls();
|
|
51348
|
+
if (hulls.length === 0) throw new Error("crash parts: the car has no hulls yet (its plan is still in the worker: wait for `isHullPending()`)");
|
|
51349
|
+
children = hulls.map((hull, handle) => ({ handle, key: hull.key, partId: hull.id, partIndex: partIndexOf.get(hull.id) ?? -1, applied: hull.points, wanted: hull, isHeld: false }));
|
|
51350
|
+
return { kind: "compound", mutable: true, children: children.map((child) => ({ shape: convexOf(child.applied), position: [0, 0, 0], tag: child.partIndex })) };
|
|
51351
|
+
};
|
|
51352
|
+
const release = (world, chassis, partId) => {
|
|
51353
|
+
const mine = children.filter((child) => child.partId === partId);
|
|
51354
|
+
for (const child of mine) world.setChildShape(chassis, child.handle, null);
|
|
51355
|
+
children = children.filter((child) => child.partId !== partId);
|
|
51356
|
+
return mine.map((child) => child.applied);
|
|
51357
|
+
};
|
|
51358
|
+
const settle = (world, chassis, isTouching) => {
|
|
51359
|
+
const now = new Map(colliders.hulls().map((hull) => [hull.key, hull]));
|
|
51360
|
+
let remade = 0;
|
|
51361
|
+
let held = 0;
|
|
51362
|
+
const next = [];
|
|
51363
|
+
for (const child of children) {
|
|
51364
|
+
const hull = now.get(child.key);
|
|
51365
|
+
now.delete(child.key);
|
|
51366
|
+
if (!hull) {
|
|
51367
|
+
world.setChildShape(chassis, child.handle, null);
|
|
51368
|
+
continue;
|
|
51369
|
+
}
|
|
51370
|
+
next.push(child);
|
|
51371
|
+
if (hull === child.wanted && !child.isHeld) continue;
|
|
51372
|
+
const points = isTouching(child.applied) ? holdWithin(child.applied, hull.points, HULL_SLOP) : hull.points;
|
|
51373
|
+
child.wanted = hull;
|
|
51374
|
+
child.isHeld = points !== hull.points;
|
|
51375
|
+
if (child.isHeld) held++;
|
|
51376
|
+
if (points === child.applied) continue;
|
|
51377
|
+
world.setChildShape(chassis, child.handle, convexOf(points));
|
|
51378
|
+
child.applied = points;
|
|
51379
|
+
remade++;
|
|
51380
|
+
}
|
|
51381
|
+
children = next;
|
|
51382
|
+
return { remade, held, unplaced: now.size };
|
|
51383
|
+
};
|
|
51384
|
+
return { shape, release, settle, count: () => children.length, hasWork: () => colliders.isHullPending() || children.some((child) => child.isHeld) };
|
|
51385
|
+
};
|
|
51386
|
+
|
|
51387
|
+
// src/crash-parts-math.ts
|
|
51388
|
+
var MIN_INERTIA_PER_MASS = 1e-3;
|
|
51389
|
+
var rotateBy = (q, v) => {
|
|
51390
|
+
const [x, y, z, w] = q;
|
|
51391
|
+
const tx = 2 * (y * v[2] - z * v[1]);
|
|
51392
|
+
const ty = 2 * (z * v[0] - x * v[2]);
|
|
51393
|
+
const tz = 2 * (x * v[1] - y * v[0]);
|
|
51394
|
+
return [v[0] + w * tx + y * tz - z * ty, v[1] + w * ty + z * tx - x * tz, v[2] + w * tz + x * ty - y * tx];
|
|
51395
|
+
};
|
|
51396
|
+
var multiplyQuat = (a, b) => [
|
|
51397
|
+
a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1],
|
|
51398
|
+
a[3] * b[1] - a[0] * b[2] + a[1] * b[3] + a[2] * b[0],
|
|
51399
|
+
a[3] * b[2] + a[0] * b[1] - a[1] * b[0] + a[2] * b[3],
|
|
51400
|
+
a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2]
|
|
51401
|
+
];
|
|
51402
|
+
var boxInertia = (mass, size) => [
|
|
51403
|
+
mass / 12 * (size[1] * size[1] + size[2] * size[2]),
|
|
51404
|
+
mass / 12 * (size[0] * size[0] + size[2] * size[2]),
|
|
51405
|
+
mass / 12 * (size[0] * size[0] + size[1] * size[1])
|
|
51406
|
+
];
|
|
51407
|
+
var lever = (mass, d, k) => mass * (d[0] * d[0] + d[1] * d[1] + d[2] * d[2] - d[k] * d[k]);
|
|
51408
|
+
var withoutPart = (total, part) => {
|
|
51409
|
+
const mass = total.mass - part.mass;
|
|
51410
|
+
if (!(mass > 0)) throw new Error(`crash parts: a part of ${part.mass} kg cannot leave a body of ${total.mass} kg`);
|
|
51411
|
+
const centre = [0, 1, 2].map((k) => (total.mass * total.centre[k] - part.mass * part.centre[k]) / mass);
|
|
51412
|
+
const partOffset = [part.centre[0] - total.centre[0], part.centre[1] - total.centre[1], part.centre[2] - total.centre[2]];
|
|
51413
|
+
const shift = [centre[0] - total.centre[0], centre[1] - total.centre[1], centre[2] - total.centre[2]];
|
|
51414
|
+
const floor = mass * MIN_INERTIA_PER_MASS;
|
|
51415
|
+
const inertia = [0, 1, 2].map((k) => Math.max(floor, total.inertia[k] - (part.inertia[k] + lever(part.mass, partOffset, k)) - lever(mass, shift, k)));
|
|
51416
|
+
return { mass, centre, inertia };
|
|
51417
|
+
};
|
|
51418
|
+
var bodyMassOf = (parts) => {
|
|
51419
|
+
const mass = parts.reduce((sum, part) => sum + part.mass, 0);
|
|
51420
|
+
const centre = [0, 1, 2].map((k) => parts.reduce((sum, part) => sum + part.mass * part.box.center[k], 0) / mass);
|
|
51421
|
+
const inertia = [0, 1, 2].map((k) => parts.reduce((sum, part) => {
|
|
51422
|
+
const offset = [part.box.center[0] - centre[0], part.box.center[1] - centre[1], part.box.center[2] - centre[2]];
|
|
51423
|
+
return sum + boxInertia(part.mass, part.box.size)[k] + lever(part.mass, offset, k);
|
|
51424
|
+
}, 0));
|
|
51425
|
+
return { mass, centre, inertia };
|
|
51426
|
+
};
|
|
51427
|
+
|
|
51428
|
+
// src/crash-parts-bodies.ts
|
|
51429
|
+
var CLEAR_CHECK_STEPS = 30;
|
|
51430
|
+
var PUSH_OUT_PASSES = 3;
|
|
51431
|
+
var createPartBodies = (THREE, world, frame) => {
|
|
51432
|
+
const bodies = /* @__PURE__ */ new Map();
|
|
51433
|
+
const pose = new Float64Array(7);
|
|
51434
|
+
const speed = new Float64Array(6);
|
|
51435
|
+
const clearOut = [];
|
|
51436
|
+
const push = new Float64Array(3);
|
|
51437
|
+
const scratch2 = { box: new THREE.Box3(), corner: new THREE.Vector3(), position: new THREE.Vector3(), quaternion: new THREE.Quaternion(), parent: new THREE.Quaternion() };
|
|
51438
|
+
let steps = 0;
|
|
51439
|
+
let pushed = 0;
|
|
51440
|
+
const extentOf = (holder) => {
|
|
51441
|
+
holder.updateWorldMatrix(true, true);
|
|
51442
|
+
frame.updateWorldMatrix(true, false);
|
|
51443
|
+
const { box: box2, corner } = scratch2;
|
|
51444
|
+
box2.setFromObject(holder);
|
|
51445
|
+
const low = [Infinity, Infinity, Infinity];
|
|
51446
|
+
const high = [-Infinity, -Infinity, -Infinity];
|
|
51447
|
+
for (let k = 0; k < 8; k++) {
|
|
51448
|
+
corner.set(k & 1 ? box2.max.x : box2.min.x, k & 2 ? box2.max.y : box2.min.y, k & 4 ? box2.max.z : box2.min.z);
|
|
51449
|
+
frame.worldToLocal(corner);
|
|
51450
|
+
low[0] = Math.min(low[0], corner.x);
|
|
51451
|
+
low[1] = Math.min(low[1], corner.y);
|
|
51452
|
+
low[2] = Math.min(low[2], corner.z);
|
|
51453
|
+
high[0] = Math.max(high[0], corner.x);
|
|
51454
|
+
high[1] = Math.max(high[1], corner.y);
|
|
51455
|
+
high[2] = Math.max(high[2], corner.z);
|
|
51456
|
+
}
|
|
51457
|
+
return { centre: [(low[0] + high[0]) / 2, (low[1] + high[1]) / 2, (low[2] + high[2]) / 2], size: [high[0] - low[0], high[1] - low[1], high[2] - low[2]] };
|
|
51458
|
+
};
|
|
51459
|
+
const holderTurn = (holder) => {
|
|
51460
|
+
holder.getWorldQuaternion(scratch2.quaternion);
|
|
51461
|
+
frame.getWorldQuaternion(scratch2.parent);
|
|
51462
|
+
const turn = scratch2.parent.clone().invert().multiply(scratch2.quaternion);
|
|
51463
|
+
return [turn.x, turn.y, turn.z, turn.w];
|
|
51464
|
+
};
|
|
51465
|
+
const follower = (holder, offset) => ({ holder, offset, turn: holderTurn(holder) });
|
|
51466
|
+
const pushOutOfTheFixedWorld = (body) => {
|
|
51467
|
+
for (let pass = 0; pass < PUSH_OUT_PASSES; pass++) {
|
|
51468
|
+
const depth = world.penetration(body.id, push);
|
|
51469
|
+
if (depth <= 0) return;
|
|
51470
|
+
world.readPose(body.id, pose, 0);
|
|
51471
|
+
world.setPose(body.id, [pose[0] + push[0] * depth, pose[1] + push[1] * depth, pose[2] + push[2] * depth], [pose[3], pose[4], pose[5], pose[6]], true);
|
|
51472
|
+
pushed++;
|
|
51473
|
+
}
|
|
51474
|
+
};
|
|
51475
|
+
const create = ({ partIndex, mass, hulls, extent, holder, chassis, chassisMass }) => {
|
|
51476
|
+
world.readPose(chassis, pose, 0);
|
|
51477
|
+
world.readVelocity(chassis, speed, 0);
|
|
51478
|
+
const rotation = [pose[3], pose[4], pose[5], pose[6]];
|
|
51479
|
+
const lever2 = rotateBy(rotation, [extent.centre[0] - chassisMass.centre[0], extent.centre[1] - chassisMass.centre[1], extent.centre[2] - chassisMass.centre[2]]);
|
|
51480
|
+
const around = [speed[3], speed[4], speed[5]];
|
|
51481
|
+
const linear = [speed[0] + around[1] * lever2[2] - around[2] * lever2[1], speed[1] + around[2] * lever2[0] - around[0] * lever2[2], speed[2] + around[0] * lever2[1] - around[1] * lever2[0]];
|
|
51482
|
+
const origin = rotateBy(rotation, extent.centre);
|
|
51483
|
+
const shape = {
|
|
51484
|
+
kind: "compound",
|
|
51485
|
+
children: hulls.map((points) => ({ shape: { kind: "convex", points: shifted(points, extent.centre) }, position: [0, 0, 0], tag: partIndex }))
|
|
51486
|
+
};
|
|
51487
|
+
const id = world.createBody({
|
|
51488
|
+
shape,
|
|
51489
|
+
motion: "dynamic",
|
|
51490
|
+
mass,
|
|
51491
|
+
inertia: boxInertia(mass, extent.size),
|
|
51492
|
+
centreAtOrigin: true,
|
|
51493
|
+
continuous: true,
|
|
51494
|
+
layer: "debris",
|
|
51495
|
+
user: partIndex,
|
|
51496
|
+
position: [pose[0] + origin[0], pose[1] + origin[1], pose[2] + origin[2]],
|
|
51497
|
+
rotation,
|
|
51498
|
+
linearVelocity: linear,
|
|
51499
|
+
angularVelocity: around
|
|
51500
|
+
});
|
|
51501
|
+
const body = { id, partIndex, shape, extent, followers: [follower(holder, [0, 0, 0])], isIgnoring: true };
|
|
51502
|
+
world.ignorePair(id, chassis, true);
|
|
51503
|
+
pushOutOfTheFixedWorld(body);
|
|
51504
|
+
bodies.set(partIndex, body);
|
|
51505
|
+
return body;
|
|
51506
|
+
};
|
|
51507
|
+
const follow = (body, holder, extent) => {
|
|
51508
|
+
const base = body.extent.centre;
|
|
51509
|
+
body.followers.push(follower(holder, [extent.centre[0] - base[0], extent.centre[1] - base[1], extent.centre[2] - base[2]]));
|
|
51510
|
+
};
|
|
51511
|
+
const place = (body) => {
|
|
51512
|
+
world.readPose(body.id, pose, 0);
|
|
51513
|
+
const rotation = [pose[3], pose[4], pose[5], pose[6]];
|
|
51514
|
+
for (const { holder, offset, turn } of body.followers) {
|
|
51515
|
+
const at = rotateBy(rotation, offset);
|
|
51516
|
+
scratch2.position.set(pose[0] + at[0], pose[1] + at[1], pose[2] + at[2]);
|
|
51517
|
+
const turned = multiplyQuat(rotation, turn);
|
|
51518
|
+
const parent = holder.parent;
|
|
51519
|
+
if (parent) parent.worldToLocal(scratch2.position);
|
|
51520
|
+
holder.position.copy(scratch2.position);
|
|
51521
|
+
scratch2.quaternion.set(turned[0], turned[1], turned[2], turned[3]);
|
|
51522
|
+
if (parent) {
|
|
51523
|
+
parent.getWorldQuaternion(scratch2.parent);
|
|
51524
|
+
scratch2.quaternion.premultiply(scratch2.parent.invert());
|
|
51525
|
+
}
|
|
51526
|
+
holder.quaternion.copy(scratch2.quaternion);
|
|
51527
|
+
holder.updateMatrix();
|
|
51528
|
+
}
|
|
51529
|
+
};
|
|
51530
|
+
const release = (body, chassis) => {
|
|
51531
|
+
world.readPose(body.id, pose, 0);
|
|
51532
|
+
world.overlapShape({ kind: "box", half: [body.extent.size[0] / 2, body.extent.size[1] / 2, body.extent.size[2] / 2] }, [pose[0], pose[1], pose[2]], [pose[3], pose[4], pose[5], pose[6]], clearOut, { layers: ["vehicle"] });
|
|
51533
|
+
if (clearOut.includes(chassis)) return;
|
|
51534
|
+
world.ignorePair(body.id, chassis, false);
|
|
51535
|
+
body.isIgnoring = false;
|
|
51536
|
+
};
|
|
51537
|
+
return {
|
|
51538
|
+
extentOf,
|
|
51539
|
+
create,
|
|
51540
|
+
follow,
|
|
51541
|
+
bodies,
|
|
51542
|
+
pushedOut: () => pushed,
|
|
51543
|
+
step: (chassis) => {
|
|
51544
|
+
steps++;
|
|
51545
|
+
const check = steps % CLEAR_CHECK_STEPS === 0;
|
|
51546
|
+
for (const body of bodies.values()) {
|
|
51547
|
+
place(body);
|
|
51548
|
+
if (check && body.isIgnoring) release(body, chassis);
|
|
51549
|
+
}
|
|
51550
|
+
},
|
|
51551
|
+
dispose: () => {
|
|
51552
|
+
for (const body of bodies.values()) if (world.has(body.id)) world.removeBody(body.id);
|
|
51553
|
+
bodies.clear();
|
|
51554
|
+
}
|
|
51555
|
+
};
|
|
51556
|
+
};
|
|
51557
|
+
var shifted = (points, by) => {
|
|
51558
|
+
const out = new Float32Array(points.length);
|
|
51559
|
+
for (let i = 0; i < out.length; i += 3) {
|
|
51560
|
+
out[i] = points[i] - by[0];
|
|
51561
|
+
out[i + 1] = points[i + 1] - by[1];
|
|
51562
|
+
out[i + 2] = points[i + 2] - by[2];
|
|
51563
|
+
}
|
|
51564
|
+
return out;
|
|
51565
|
+
};
|
|
51566
|
+
|
|
51567
|
+
// src/crash-parts.ts
|
|
51568
|
+
var CONTACT_POINTS = 64;
|
|
51569
|
+
var SETTLE_STEPS = 30;
|
|
51570
|
+
var SETTLED_SPEED = 0.05;
|
|
51571
|
+
var TOUCH_MARGIN = 0.05;
|
|
51572
|
+
var createCrashParts = (options) => {
|
|
51573
|
+
const { THREE, world, vehicle, frame, colliders } = options;
|
|
51574
|
+
const parts = vehicle.model.parts;
|
|
51575
|
+
const partIndexOf = new Map(parts.map((part, index) => [part.id, index]));
|
|
51576
|
+
const chassisHulls = createChassisHulls(colliders, partIndexOf);
|
|
51577
|
+
const bodies = createPartBodies(THREE, world, frame);
|
|
51578
|
+
const pose = new Float64Array(7);
|
|
51579
|
+
const speed = new Float64Array(6);
|
|
51580
|
+
const touches = new Float32Array(CONTACT_READ_STRIDE * CONTACT_POINTS);
|
|
51581
|
+
const strongest = /* @__PURE__ */ new Map();
|
|
51582
|
+
let chassis;
|
|
51583
|
+
let current = options.mass;
|
|
51584
|
+
let calm = 0;
|
|
51585
|
+
let cooldown = 0;
|
|
51586
|
+
let isDirty = false;
|
|
51587
|
+
let released = 0;
|
|
51588
|
+
let settles = 0;
|
|
51589
|
+
let held = 0;
|
|
51590
|
+
let remade = 0;
|
|
51591
|
+
let unplaced = 0;
|
|
51592
|
+
let blows = 0;
|
|
51593
|
+
let events = 0;
|
|
51594
|
+
const hitParts = /* @__PURE__ */ new Set();
|
|
51595
|
+
const numbers = /* @__PURE__ */ new Map();
|
|
51596
|
+
const carried = (partIndex) => bodies.bodies.get(partIndex);
|
|
51597
|
+
const takePart = (part, partIndex, holder) => {
|
|
51598
|
+
const body = carried(partIndex);
|
|
51599
|
+
const extent = bodies.extentOf(holder);
|
|
51600
|
+
if (body) return bodies.follow(body, holder, extent);
|
|
51601
|
+
const hulls = chassisHulls.release(world, chassis, part.id);
|
|
51602
|
+
const solid = hulls.length > 0 ? hulls : [boxPoints(extent.size, extent.centre)];
|
|
51603
|
+
bodies.create({ partIndex, mass: part.mass, hulls: solid, extent, holder, chassis, chassisMass: current });
|
|
51604
|
+
const own = { mass: part.mass, centre: extent.centre, inertia: boxInertia(part.mass, extent.size) };
|
|
51605
|
+
numbers.set(part.id, own);
|
|
51606
|
+
current = withoutPart(current, own);
|
|
51607
|
+
world.setMassProperties(chassis, { mass: current.mass, inertia: current.inertia, centreOfMass: current.centre });
|
|
51608
|
+
released++;
|
|
51609
|
+
options.onPartLost?.(part);
|
|
51610
|
+
};
|
|
51611
|
+
const isTouching = (points) => {
|
|
51612
|
+
if (!chassis) return false;
|
|
51613
|
+
const count2 = world.readContacts(chassis, touches);
|
|
51614
|
+
if (count2 === 0) return false;
|
|
51615
|
+
world.readPose(chassis, pose, 0);
|
|
51616
|
+
let lowX = Infinity, lowY = Infinity, lowZ = Infinity;
|
|
51617
|
+
let highX = -Infinity, highY = -Infinity, highZ = -Infinity;
|
|
51618
|
+
for (let i = 0; i < points.length; i += 3) {
|
|
51619
|
+
const x = points[i], y = points[i + 1], z = points[i + 2];
|
|
51620
|
+
if (x < lowX) lowX = x;
|
|
51621
|
+
if (x > highX) highX = x;
|
|
51622
|
+
if (y < lowY) lowY = y;
|
|
51623
|
+
if (y > highY) highY = y;
|
|
51624
|
+
if (z < lowZ) lowZ = z;
|
|
51625
|
+
if (z > highZ) highZ = z;
|
|
51626
|
+
}
|
|
51627
|
+
const qx = -pose[3], qy = -pose[4], qz = -pose[5], qw = pose[6];
|
|
51628
|
+
for (let c = 0; c < count2; c++) {
|
|
51629
|
+
const at = c * CONTACT_READ_STRIDE;
|
|
51630
|
+
const vx = touches[at] - pose[0], vy = touches[at + 1] - pose[1], vz = touches[at + 2] - pose[2];
|
|
51631
|
+
const tx = 2 * (qy * vz - qz * vy);
|
|
51632
|
+
const ty = 2 * (qz * vx - qx * vz);
|
|
51633
|
+
const tz = 2 * (qx * vy - qy * vx);
|
|
51634
|
+
const x = vx + qw * tx + qy * tz - qz * ty;
|
|
51635
|
+
const y = vy + qw * ty + qz * tx - qx * tz;
|
|
51636
|
+
const z = vz + qw * tz + qx * ty - qy * tx;
|
|
51637
|
+
if (x >= lowX - TOUCH_MARGIN && x <= highX + TOUCH_MARGIN && y >= lowY - TOUCH_MARGIN && y <= highY + TOUCH_MARGIN && z >= lowZ - TOUCH_MARGIN && z <= highZ + TOUCH_MARGIN) return true;
|
|
51638
|
+
}
|
|
51639
|
+
return false;
|
|
51640
|
+
};
|
|
51641
|
+
const feedDamage = () => {
|
|
51642
|
+
const rows = world.contacts;
|
|
51643
|
+
strongest.clear();
|
|
51644
|
+
for (let i = 0; i < rows.count; i++) {
|
|
51645
|
+
const mine = rows.a[i] === chassis ? 0 : rows.b[i] === chassis ? 1 : -1;
|
|
51646
|
+
if (mine < 0) continue;
|
|
51647
|
+
const tag = mine === 0 ? rows.tagA[i] : rows.tagB[i];
|
|
51648
|
+
if (tag < 0 || tag >= parts.length) continue;
|
|
51649
|
+
const at = strongest.get(tag);
|
|
51650
|
+
if (at === void 0 || rows.approach[i] > rows.approach[at]) strongest.set(tag, i);
|
|
51651
|
+
}
|
|
51652
|
+
for (const [tag, i] of strongest) {
|
|
51653
|
+
const mine = rows.a[i] === chassis;
|
|
51654
|
+
const other = mine ? rows.b[i] : rows.a[i];
|
|
51655
|
+
const otherMass = world.has(other) ? world.massOf(other) : 0;
|
|
51656
|
+
const sign2 = mine ? 1 : -1;
|
|
51657
|
+
const part = parts[tag];
|
|
51658
|
+
const result = crashVehicle(vehicle, {
|
|
51659
|
+
point: [rows.point[i * 3], rows.point[i * 3 + 1], rows.point[i * 3 + 2]],
|
|
51660
|
+
direction: [sign2 * rows.normal[i * 3], sign2 * rows.normal[i * 3 + 1], sign2 * rows.normal[i * 3 + 2]],
|
|
51661
|
+
speed: rows.approach[i],
|
|
51662
|
+
massKg: current.mass,
|
|
51663
|
+
otherMassKg: otherMass > 0 ? otherMass : Infinity,
|
|
51664
|
+
contactWidth: Math.max(0.2, part.box.size[2]),
|
|
51665
|
+
source: part.id
|
|
51666
|
+
});
|
|
51667
|
+
blows++;
|
|
51668
|
+
events += result.events.length;
|
|
51669
|
+
hitParts.add(part.id);
|
|
51670
|
+
if (result.events.length > 0) {
|
|
51671
|
+
isDirty = true;
|
|
51672
|
+
cooldown = 0;
|
|
51673
|
+
}
|
|
51674
|
+
}
|
|
51675
|
+
};
|
|
51676
|
+
const settle = () => {
|
|
51677
|
+
world.readVelocity(chassis, speed, 0);
|
|
51678
|
+
const still = Math.hypot(speed[0], speed[1], speed[2]) < SETTLED_SPEED && Math.hypot(speed[3], speed[4], speed[5]) < SETTLED_SPEED;
|
|
51679
|
+
calm = still ? calm + 1 : 0;
|
|
51680
|
+
if (calm < SETTLE_STEPS || !(isDirty || chassisHulls.hasWork())) return;
|
|
51681
|
+
if (cooldown > 0) {
|
|
51682
|
+
cooldown--;
|
|
51683
|
+
return;
|
|
51684
|
+
}
|
|
51685
|
+
const done = chassisHulls.settle(world, chassis, isTouching);
|
|
51686
|
+
settles++;
|
|
51687
|
+
held += done.held;
|
|
51688
|
+
remade += done.remade;
|
|
51689
|
+
unplaced += done.unplaced;
|
|
51690
|
+
isDirty = done.held > 0 || colliders.isHullPending();
|
|
51691
|
+
cooldown = done.held > 0 && !colliders.isHullPending() ? SETTLE_STEPS : 0;
|
|
51692
|
+
};
|
|
51693
|
+
vehicle.setPartSink((part, holder) => {
|
|
51694
|
+
const partIndex = partIndexOf.get(part.id);
|
|
51695
|
+
if (chassis === void 0 || partIndex === void 0) return false;
|
|
51696
|
+
takePart(part, partIndex, holder);
|
|
51697
|
+
return true;
|
|
51698
|
+
});
|
|
51699
|
+
return {
|
|
51700
|
+
shape: () => chassisHulls.shape(),
|
|
51701
|
+
bind: (body) => {
|
|
51702
|
+
chassis = body;
|
|
51703
|
+
world.watchContacts(body, true);
|
|
51704
|
+
world.setMassProperties(body, { mass: current.mass, inertia: current.inertia, centreOfMass: current.centre });
|
|
51705
|
+
},
|
|
51706
|
+
step: () => {
|
|
51707
|
+
if (chassis === void 0) return;
|
|
51708
|
+
feedDamage();
|
|
51709
|
+
bodies.step(chassis);
|
|
51710
|
+
settle();
|
|
51711
|
+
},
|
|
51712
|
+
mass: () => current,
|
|
51713
|
+
partNumbers: () => numbers,
|
|
51714
|
+
partBodies: () => new Map([...bodies.bodies].map(([index, body]) => [parts[index].id, body.id])),
|
|
51715
|
+
stats: () => ({ released, pushedOut: bodies.pushedOut(), settles, remade, held, unplaced, blows, events, hitParts, children: chassisHulls.count() }),
|
|
51716
|
+
dispose: () => {
|
|
51717
|
+
vehicle.setPartSink(null);
|
|
51718
|
+
bodies.dispose();
|
|
51719
|
+
if (chassis !== void 0 && world.has(chassis)) world.watchContacts(chassis, false);
|
|
51720
|
+
}
|
|
51721
|
+
};
|
|
51722
|
+
};
|
|
51723
|
+
var boxPoints = (size, centre) => {
|
|
51724
|
+
const out = new Float32Array(24);
|
|
51725
|
+
for (let k = 0; k < 8; k++) {
|
|
51726
|
+
out[k * 3] = centre[0] + (k & 1 ? size[0] : -size[0]) / 2;
|
|
51727
|
+
out[k * 3 + 1] = centre[1] + (k & 2 ? size[1] : -size[1]) / 2;
|
|
51728
|
+
out[k * 3 + 2] = centre[2] + (k & 4 ? size[2] : -size[2]) / 2;
|
|
51729
|
+
}
|
|
51730
|
+
return out;
|
|
51731
|
+
};
|
|
51732
|
+
|
|
51733
|
+
// src/test-area/physical-car.ts
|
|
51734
|
+
var DEFAULT_HULL_CEILING = 550;
|
|
51735
|
+
var HALF_TURN = Math.SQRT1_2;
|
|
51736
|
+
var wheelChildOf = (size, center) => {
|
|
51737
|
+
const axis = size[0] <= size[1] && size[0] <= size[2] ? 0 : size[2] <= size[1] ? 2 : 1;
|
|
51738
|
+
const radius = Math.max(...size.filter((_, side2) => side2 !== axis)) / 2;
|
|
51739
|
+
const shape = { kind: "cylinder", halfHeight: size[axis] / 2, radius };
|
|
51740
|
+
if (axis === 1) return { shape, position: center };
|
|
51741
|
+
return { shape, position: center, rotation: axis === 0 ? [0, 0, HALF_TURN, HALF_TURN] : [HALF_TURN, 0, 0, HALF_TURN] };
|
|
51742
|
+
};
|
|
51743
|
+
var physicsServicesOf = (host) => host && isPhysicsServices(host.physics) ? host.physics : void 0;
|
|
51744
|
+
var physicalCarColliders = (THREE, vehicle, root, options) => createVehicleColliders(THREE, vehicle, root, {
|
|
51745
|
+
budget: options.budget,
|
|
51746
|
+
hulls: true,
|
|
51747
|
+
maxHulls: options.hullCeilingOf?.(options.fleetKey) ?? DEFAULT_HULL_CEILING,
|
|
51748
|
+
planCache: options.planCache,
|
|
51749
|
+
...options.workers ? { workers: options.workers } : {}
|
|
51750
|
+
});
|
|
51751
|
+
var createPhysicalCar = ({ THREE, services, vehicle, root, colliders }) => {
|
|
51752
|
+
const { world } = services;
|
|
51753
|
+
const pose = new Float64Array(7);
|
|
51754
|
+
const matrix = new THREE.Matrix4();
|
|
51755
|
+
const parentInverse = new THREE.Matrix4();
|
|
51756
|
+
const position = new THREE.Vector3();
|
|
51757
|
+
const rotation = new THREE.Quaternion();
|
|
51758
|
+
const unusedScale = new THREE.Vector3();
|
|
51759
|
+
const wheelHandles = /* @__PURE__ */ new Map();
|
|
51760
|
+
let crash;
|
|
51761
|
+
let chassis;
|
|
51762
|
+
const withWheels = (hulls) => {
|
|
51763
|
+
if (hulls.kind !== "compound") return hulls;
|
|
51764
|
+
const tyres = vehicle.model.parts.filter((part) => part.role === "tyre");
|
|
51765
|
+
tyres.forEach((part, index) => wheelHandles.set(part.id, hulls.children.length + index));
|
|
51766
|
+
const inverse = new THREE.Matrix4().copy(root.matrixWorld).invert();
|
|
51767
|
+
const drawn = new THREE.Box3();
|
|
51768
|
+
const piece = new THREE.Box3();
|
|
51769
|
+
const centre = new THREE.Vector3();
|
|
51770
|
+
const size = new THREE.Vector3();
|
|
51771
|
+
const children = tyres.map((part) => {
|
|
51772
|
+
drawn.makeEmpty();
|
|
51773
|
+
for (const object2 of vehicle.objectsOf(part.id)) drawn.union(piece.setFromObject(object2).applyMatrix4(inverse));
|
|
51774
|
+
if (drawn.isEmpty()) return wheelChildOf(part.box.size, part.box.center);
|
|
51775
|
+
return wheelChildOf(drawn.getSize(size).toArray(), drawn.getCenter(centre).toArray());
|
|
51776
|
+
});
|
|
51777
|
+
return { ...hulls, children: [...hulls.children, ...children] };
|
|
51778
|
+
};
|
|
51779
|
+
const build = () => {
|
|
51780
|
+
if (!root.parent) return;
|
|
51781
|
+
colliders.pieces();
|
|
51782
|
+
if (colliders.isPending()) return;
|
|
51783
|
+
colliders.hulls();
|
|
51784
|
+
if (colliders.isHullPending()) return;
|
|
51785
|
+
root.updateWorldMatrix(true, false);
|
|
51786
|
+
root.matrixWorld.decompose(position, rotation, unusedScale);
|
|
51787
|
+
const mass = bodyMassOf(vehicle.model.parts);
|
|
51788
|
+
crash = createCrashParts({
|
|
51789
|
+
THREE,
|
|
51790
|
+
world,
|
|
51791
|
+
vehicle,
|
|
51792
|
+
frame: root,
|
|
51793
|
+
colliders,
|
|
51794
|
+
mass,
|
|
51795
|
+
onPartLost: (part) => {
|
|
51796
|
+
const handle = wheelHandles.get(part.id);
|
|
51797
|
+
if (handle !== void 0 && chassis !== void 0) world.setChildShape(chassis, handle, null);
|
|
51798
|
+
}
|
|
51799
|
+
});
|
|
51800
|
+
chassis = world.createBody({
|
|
51801
|
+
shape: withWheels(crash.shape()),
|
|
51802
|
+
motion: "dynamic",
|
|
51803
|
+
mass: mass.mass,
|
|
51804
|
+
inertia: mass.inertia,
|
|
51805
|
+
layer: "vehicle",
|
|
51806
|
+
user: 0,
|
|
51807
|
+
position: [position.x, position.y, position.z],
|
|
51808
|
+
rotation: [rotation.x, rotation.y, rotation.z, rotation.w]
|
|
51809
|
+
});
|
|
51810
|
+
crash.bind(chassis);
|
|
51811
|
+
};
|
|
51812
|
+
const follow = () => {
|
|
51813
|
+
world.readPose(chassis, pose, 0);
|
|
51814
|
+
matrix.compose(position.set(pose[0], pose[1], pose[2]), rotation.set(pose[3], pose[4], pose[5], pose[6]), unusedScale.set(1, 1, 1));
|
|
51815
|
+
root.parent.updateWorldMatrix(true, false);
|
|
51816
|
+
matrix.premultiply(parentInverse.copy(root.parent.matrixWorld).invert());
|
|
51817
|
+
matrix.decompose(root.position, root.quaternion, unusedScale);
|
|
51818
|
+
root.updateMatrixWorld(true);
|
|
51819
|
+
crash.step();
|
|
51820
|
+
};
|
|
51821
|
+
const stopPhase = services.loop.add({
|
|
51822
|
+
afterSteps: (_dt, frame) => {
|
|
51823
|
+
if (!chassis) return build();
|
|
51824
|
+
if (frame.steps > 0 && root.parent) follow();
|
|
51825
|
+
}
|
|
51826
|
+
}, "contacts");
|
|
51827
|
+
return {
|
|
51828
|
+
colliders: () => [],
|
|
51829
|
+
isBuilt: () => chassis !== void 0,
|
|
51830
|
+
chassis: () => chassis,
|
|
51831
|
+
parts: () => crash,
|
|
51832
|
+
dispose: () => {
|
|
51833
|
+
stopPhase();
|
|
51834
|
+
crash?.dispose();
|
|
51835
|
+
if (chassis !== void 0 && world.has(chassis)) world.removeBody(chassis);
|
|
51836
|
+
crash = void 0;
|
|
51837
|
+
chassis = void 0;
|
|
51838
|
+
}
|
|
51839
|
+
};
|
|
51840
|
+
};
|
|
51841
|
+
|
|
51176
51842
|
// src/test-area/text.ts
|
|
51177
51843
|
var scenarioIds = [
|
|
51178
51844
|
"vehicles_9mm_windshield",
|
|
@@ -51600,7 +52266,7 @@ var GameVehiclesThree = (() => {
|
|
|
51600
52266
|
var ZONE_COLOURS = { door: 5627221, hood: 14540083, lid: 14522675, bumper: 14505437, glass: 4500223, light: 16777215, wheel: 16742195 };
|
|
51601
52267
|
var BODY_HEIGHT = 1.7;
|
|
51602
52268
|
function createVehiclesTestModule(options = {}) {
|
|
51603
|
-
const fleet = options.fleet ?? { colorFromSeed, fleetDims, installFleet, paintPalettes, paletteOf };
|
|
52269
|
+
const fleet = options.fleet ?? { colorFromSeed, fleetDims, hullCeilingOf: fleetHullCeilingOf, installFleet, paintPalettes, paletteOf };
|
|
51604
52270
|
const locale = options.locale ?? "pt-BR";
|
|
51605
52271
|
const text = TEXT[locale] ?? TEXT["pt-BR"];
|
|
51606
52272
|
const keys = options.vehicles ?? DEFAULT_TEST_VEHICLES;
|
|
@@ -51614,6 +52280,8 @@ var GameVehiclesThree = (() => {
|
|
|
51614
52280
|
const cabins = createCabinSmoke();
|
|
51615
52281
|
const rainCovers = createVehicleRainCovers();
|
|
51616
52282
|
let host = null;
|
|
52283
|
+
const physicalCars = /* @__PURE__ */ new Set();
|
|
52284
|
+
const planCache = createHullPlanCache();
|
|
51617
52285
|
let three = null;
|
|
51618
52286
|
let counter = 0;
|
|
51619
52287
|
let helpersShown = "";
|
|
@@ -51684,9 +52352,25 @@ var GameVehiclesThree = (() => {
|
|
|
51684
52352
|
const kit = r.userData.kit;
|
|
51685
52353
|
const d = createVehicleDestructible(kit, r.userData.vehicle, { id, frame: root, name: text.items[itemKey] ?? key, creaseQueue, puddles: false });
|
|
51686
52354
|
tapEffects(d);
|
|
51687
|
-
const
|
|
51688
|
-
|
|
51689
|
-
|
|
52355
|
+
const services = physicsServicesOf(host);
|
|
52356
|
+
if (services) {
|
|
52357
|
+
const colliders = physicalCarColliders(kit.THREE, d, root, { budget: COLLIDER_BUDGET, fleetKey: key, hullCeilingOf: fleet.hullCeilingOf, planCache, workers: host?.workers });
|
|
52358
|
+
const car = createPhysicalCar({ THREE: kit.THREE, services, vehicle: d, root, colliders });
|
|
52359
|
+
const disposeVehicle = d.dispose?.bind(d);
|
|
52360
|
+
d.dispose = () => {
|
|
52361
|
+
physicalCars.delete(car);
|
|
52362
|
+
car.dispose();
|
|
52363
|
+
disposeVehicle?.();
|
|
52364
|
+
};
|
|
52365
|
+
physicalCars.add(car);
|
|
52366
|
+
r.userData.physicalCar = car;
|
|
52367
|
+
d.colliders = car.colliders;
|
|
52368
|
+
d.collidersPending = () => false;
|
|
52369
|
+
} else {
|
|
52370
|
+
const colliders = createVehicleColliders(kit.THREE, d, root, { budget: COLLIDER_BUDGET });
|
|
52371
|
+
d.colliders = colliders.pieces;
|
|
52372
|
+
d.collidersPending = colliders.isPending;
|
|
52373
|
+
}
|
|
51690
52374
|
const setPartPose = d.setPartPose?.bind(d);
|
|
51691
52375
|
{
|
|
51692
52376
|
const rests = new Map(d.describe().parts.map((part) => [part.id, part.rotation ?? [0, 0, 0]]));
|
|
@@ -52131,6 +52815,8 @@ var GameVehiclesThree = (() => {
|
|
|
52131
52815
|
stopBlocker?.();
|
|
52132
52816
|
stopCrease?.();
|
|
52133
52817
|
stopLodBatch?.();
|
|
52818
|
+
for (const car of physicalCars) car.dispose();
|
|
52819
|
+
physicalCars.clear();
|
|
52134
52820
|
cabins.clear(effects());
|
|
52135
52821
|
rainCovers.clear();
|
|
52136
52822
|
clearHelpers();
|
|
@@ -52870,11 +53556,13 @@ var GameVehiclesThree = (() => {
|
|
|
52870
53556
|
[9, 6],
|
|
52871
53557
|
[10, 4.2]
|
|
52872
53558
|
],
|
|
53559
|
+
accelerationSpanByType: { bicycle: [36, 120] },
|
|
52873
53560
|
accelerationSpread: 0.35,
|
|
52874
53561
|
topSpeedSpread: 0.1,
|
|
52875
53562
|
dryBrake: { default: [6.5, 11], heavy: [4.5, 8.5], agricultural: [3.5, 7.5], military: [4.5, 9] },
|
|
52876
53563
|
wetBrake: { default: [3.5, 8.5], heavy: [2.5, 7], agricultural: [2, 6], military: [2.5, 7] },
|
|
52877
|
-
|
|
53564
|
+
// a tracked vehicle pivots on the spot (one track forward, the other back: "neutral steering", https://en.wikipedia.org/wiki/Tank_steering_systems), so its circle can be a point: the band starts at 0
|
|
53565
|
+
turnCircle: { default: [7, 13.5], motorcycles: [3, 9], suvs: [9, 15], pickups: [9, 16], vans: [9, 15], heavy: [10, 26], military: [9, 24], agricultural: [6, 16], tracked: [0, 24] },
|
|
52878
53566
|
mudFourWheelDrive: 10
|
|
52879
53567
|
};
|
|
52880
53568
|
var byClass = (table2, category) => table2[category] ?? table2.default;
|
|
@@ -52883,6 +53571,8 @@ var GameVehiclesThree = (() => {
|
|
|
52883
53571
|
return base * (target / 100);
|
|
52884
53572
|
};
|
|
52885
53573
|
var accelerationRange = (table2, subject, target) => {
|
|
53574
|
+
const span = subject.body.type ? table2.accelerationSpanByType?.[subject.body.type] : void 0;
|
|
53575
|
+
if (span) return { min: round(span[0] * target / 100), max: round(span[1] * target / 100) };
|
|
52886
53576
|
const t = expectedAcceleration(table2, subject, target);
|
|
52887
53577
|
return { min: round(t * (1 - table2.accelerationSpread)), max: round(t * (1 + table2.accelerationSpread)) };
|
|
52888
53578
|
};
|
|
@@ -52897,7 +53587,7 @@ var GameVehiclesThree = (() => {
|
|
|
52897
53587
|
var dryBrakeRange = (table2, subject, kmh2) => brakeRange(byClass(table2.dryBrake, subject.category), kmh2);
|
|
52898
53588
|
var wetBrakeRange = (table2, subject, kmh2) => brakeRange(byClass(table2.wetBrake, subject.category), kmh2);
|
|
52899
53589
|
var turnCircleRange = (table2, subject) => {
|
|
52900
|
-
const [min, max] = byClass(table2.turnCircle, subject.category);
|
|
53590
|
+
const [min, max] = byClass(table2.turnCircle, subject.body.type === "tracked" ? "tracked" : subject.category);
|
|
52901
53591
|
return { min, max };
|
|
52902
53592
|
};
|
|
52903
53593
|
var inRange = (value, range2) => (range2.min == null || value >= range2.min) && (range2.max == null || value <= range2.max);
|
|
@@ -55157,482 +55847,6 @@ var GameVehiclesThree = (() => {
|
|
|
55157
55847
|
function loadProvingModule(room, options) {
|
|
55158
55848
|
return room.loadModule(createProvingModule(options));
|
|
55159
55849
|
}
|
|
55160
|
-
|
|
55161
|
-
// ../game-physics/dist/index.js
|
|
55162
|
-
var CONTACT_READ_STRIDE = 7;
|
|
55163
|
-
var KIT_WORLD = {
|
|
55164
|
-
fixedStep: 1 / 120,
|
|
55165
|
-
velocityIterations: 32,
|
|
55166
|
-
positionIterations: 2,
|
|
55167
|
-
sleepAfter: 0.5,
|
|
55168
|
-
sleepSpeed: 0.08,
|
|
55169
|
-
penetrationSlop: 2e-3,
|
|
55170
|
-
maxPushOut: 2e-3,
|
|
55171
|
-
slipSpeed: 0.02,
|
|
55172
|
-
contactReportSpeed: 0.5,
|
|
55173
|
-
maxContacts: 4096,
|
|
55174
|
-
maxBodies: 8192
|
|
55175
|
-
};
|
|
55176
|
-
var POSE = new Float64Array(7);
|
|
55177
|
-
var VELOCITY = new Float64Array(6);
|
|
55178
|
-
var POSE2 = new Float64Array(7);
|
|
55179
|
-
var GOLDEN_ANGLE = Math.PI * (1 + Math.sqrt(5));
|
|
55180
|
-
|
|
55181
|
-
// src/crash-parts-clamp.ts
|
|
55182
|
-
var PASSES = 8;
|
|
55183
|
-
var holdWithin = (old, next, slop) => {
|
|
55184
|
-
const faces = convexFaces(old);
|
|
55185
|
-
if (!faces) return next;
|
|
55186
|
-
const middle = [0, 1, 2].map((k) => {
|
|
55187
|
-
let sum = 0;
|
|
55188
|
-
for (let i = k; i < old.length; i += 3) sum += old[i];
|
|
55189
|
-
return sum / (old.length / 3);
|
|
55190
|
-
});
|
|
55191
|
-
const planes = faces.map(([a, b, c]) => {
|
|
55192
|
-
const ux = old[b * 3] - old[a * 3], uy = old[b * 3 + 1] - old[a * 3 + 1], uz = old[b * 3 + 2] - old[a * 3 + 2];
|
|
55193
|
-
const wx = old[c * 3] - old[a * 3], wy = old[c * 3 + 1] - old[a * 3 + 1], wz = old[c * 3 + 2] - old[a * 3 + 2];
|
|
55194
|
-
const nx = uy * wz - uz * wy, ny = uz * wx - ux * wz, nz = ux * wy - uy * wx;
|
|
55195
|
-
const length = Math.hypot(nx, ny, nz) || 1;
|
|
55196
|
-
const towardMiddle = nx * (middle[0] - old[a * 3]) + ny * (middle[1] - old[a * 3 + 1]) + nz * (middle[2] - old[a * 3 + 2]);
|
|
55197
|
-
const sign2 = (towardMiddle > 0 ? -1 : 1) / length;
|
|
55198
|
-
const normal = [nx * sign2, ny * sign2, nz * sign2];
|
|
55199
|
-
return { normal, offset: normal[0] * old[a * 3] + normal[1] * old[a * 3 + 1] + normal[2] * old[a * 3 + 2] + slop };
|
|
55200
|
-
});
|
|
55201
|
-
let out;
|
|
55202
|
-
for (let i = 0; i < next.length; i += 3) {
|
|
55203
|
-
const p = [next[i], next[i + 1], next[i + 2]];
|
|
55204
|
-
let moved = false;
|
|
55205
|
-
for (let pass = 0; pass < PASSES; pass++) {
|
|
55206
|
-
let clean = true;
|
|
55207
|
-
for (const { normal, offset } of planes) {
|
|
55208
|
-
const past = normal[0] * p[0] + normal[1] * p[1] + normal[2] * p[2] - offset;
|
|
55209
|
-
if (past <= 0) continue;
|
|
55210
|
-
p[0] = p[0] - normal[0] * past;
|
|
55211
|
-
p[1] = p[1] - normal[1] * past;
|
|
55212
|
-
p[2] = p[2] - normal[2] * past;
|
|
55213
|
-
moved = true;
|
|
55214
|
-
clean = false;
|
|
55215
|
-
}
|
|
55216
|
-
if (clean) break;
|
|
55217
|
-
}
|
|
55218
|
-
if (!moved) continue;
|
|
55219
|
-
out ?? (out = Float32Array.from(next));
|
|
55220
|
-
out[i] = p[0];
|
|
55221
|
-
out[i + 1] = p[1];
|
|
55222
|
-
out[i + 2] = p[2];
|
|
55223
|
-
}
|
|
55224
|
-
return out ?? next;
|
|
55225
|
-
};
|
|
55226
|
-
|
|
55227
|
-
// src/crash-parts-chassis.ts
|
|
55228
|
-
var HULL_SLOP = 2e-3;
|
|
55229
|
-
var convexOf = (points) => ({ kind: "convex", points });
|
|
55230
|
-
var createChassisHulls = (colliders, partIndexOf) => {
|
|
55231
|
-
let children = [];
|
|
55232
|
-
const shape = () => {
|
|
55233
|
-
const hulls = colliders.hulls();
|
|
55234
|
-
if (hulls.length === 0) throw new Error("crash parts: the car has no hulls yet (its plan is still in the worker: wait for `isHullPending()`)");
|
|
55235
|
-
children = hulls.map((hull, handle) => ({ handle, key: hull.key, partId: hull.id, partIndex: partIndexOf.get(hull.id) ?? -1, applied: hull.points, wanted: hull, isHeld: false }));
|
|
55236
|
-
return { kind: "compound", mutable: true, children: children.map((child) => ({ shape: convexOf(child.applied), position: [0, 0, 0], tag: child.partIndex })) };
|
|
55237
|
-
};
|
|
55238
|
-
const release = (world, chassis, partId) => {
|
|
55239
|
-
const mine = children.filter((child) => child.partId === partId);
|
|
55240
|
-
for (const child of mine) world.setChildShape(chassis, child.handle, null);
|
|
55241
|
-
children = children.filter((child) => child.partId !== partId);
|
|
55242
|
-
return mine.map((child) => child.applied);
|
|
55243
|
-
};
|
|
55244
|
-
const settle = (world, chassis, isTouching) => {
|
|
55245
|
-
const now = new Map(colliders.hulls().map((hull) => [hull.key, hull]));
|
|
55246
|
-
let remade = 0;
|
|
55247
|
-
let held = 0;
|
|
55248
|
-
const next = [];
|
|
55249
|
-
for (const child of children) {
|
|
55250
|
-
const hull = now.get(child.key);
|
|
55251
|
-
now.delete(child.key);
|
|
55252
|
-
if (!hull) {
|
|
55253
|
-
world.setChildShape(chassis, child.handle, null);
|
|
55254
|
-
continue;
|
|
55255
|
-
}
|
|
55256
|
-
next.push(child);
|
|
55257
|
-
if (hull === child.wanted && !child.isHeld) continue;
|
|
55258
|
-
const points = isTouching(child.applied) ? holdWithin(child.applied, hull.points, HULL_SLOP) : hull.points;
|
|
55259
|
-
child.wanted = hull;
|
|
55260
|
-
child.isHeld = points !== hull.points;
|
|
55261
|
-
if (child.isHeld) held++;
|
|
55262
|
-
if (points === child.applied) continue;
|
|
55263
|
-
world.setChildShape(chassis, child.handle, convexOf(points));
|
|
55264
|
-
child.applied = points;
|
|
55265
|
-
remade++;
|
|
55266
|
-
}
|
|
55267
|
-
children = next;
|
|
55268
|
-
return { remade, held, unplaced: now.size };
|
|
55269
|
-
};
|
|
55270
|
-
return { shape, release, settle, count: () => children.length, hasWork: () => colliders.isHullPending() || children.some((child) => child.isHeld) };
|
|
55271
|
-
};
|
|
55272
|
-
|
|
55273
|
-
// src/crash-parts-math.ts
|
|
55274
|
-
var MIN_INERTIA_PER_MASS = 1e-3;
|
|
55275
|
-
var rotateBy = (q, v) => {
|
|
55276
|
-
const [x, y, z, w] = q;
|
|
55277
|
-
const tx = 2 * (y * v[2] - z * v[1]);
|
|
55278
|
-
const ty = 2 * (z * v[0] - x * v[2]);
|
|
55279
|
-
const tz = 2 * (x * v[1] - y * v[0]);
|
|
55280
|
-
return [v[0] + w * tx + y * tz - z * ty, v[1] + w * ty + z * tx - x * tz, v[2] + w * tz + x * ty - y * tx];
|
|
55281
|
-
};
|
|
55282
|
-
var multiplyQuat = (a, b) => [
|
|
55283
|
-
a[3] * b[0] + a[0] * b[3] + a[1] * b[2] - a[2] * b[1],
|
|
55284
|
-
a[3] * b[1] - a[0] * b[2] + a[1] * b[3] + a[2] * b[0],
|
|
55285
|
-
a[3] * b[2] + a[0] * b[1] - a[1] * b[0] + a[2] * b[3],
|
|
55286
|
-
a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2]
|
|
55287
|
-
];
|
|
55288
|
-
var boxInertia = (mass, size) => [
|
|
55289
|
-
mass / 12 * (size[1] * size[1] + size[2] * size[2]),
|
|
55290
|
-
mass / 12 * (size[0] * size[0] + size[2] * size[2]),
|
|
55291
|
-
mass / 12 * (size[0] * size[0] + size[1] * size[1])
|
|
55292
|
-
];
|
|
55293
|
-
var lever = (mass, d, k) => mass * (d[0] * d[0] + d[1] * d[1] + d[2] * d[2] - d[k] * d[k]);
|
|
55294
|
-
var withoutPart = (total, part) => {
|
|
55295
|
-
const mass = total.mass - part.mass;
|
|
55296
|
-
if (!(mass > 0)) throw new Error(`crash parts: a part of ${part.mass} kg cannot leave a body of ${total.mass} kg`);
|
|
55297
|
-
const centre = [0, 1, 2].map((k) => (total.mass * total.centre[k] - part.mass * part.centre[k]) / mass);
|
|
55298
|
-
const partOffset = [part.centre[0] - total.centre[0], part.centre[1] - total.centre[1], part.centre[2] - total.centre[2]];
|
|
55299
|
-
const shift = [centre[0] - total.centre[0], centre[1] - total.centre[1], centre[2] - total.centre[2]];
|
|
55300
|
-
const floor = mass * MIN_INERTIA_PER_MASS;
|
|
55301
|
-
const inertia = [0, 1, 2].map((k) => Math.max(floor, total.inertia[k] - (part.inertia[k] + lever(part.mass, partOffset, k)) - lever(mass, shift, k)));
|
|
55302
|
-
return { mass, centre, inertia };
|
|
55303
|
-
};
|
|
55304
|
-
|
|
55305
|
-
// src/crash-parts-bodies.ts
|
|
55306
|
-
var CLEAR_CHECK_STEPS = 30;
|
|
55307
|
-
var PUSH_OUT_PASSES = 3;
|
|
55308
|
-
var createPartBodies = (THREE, world, frame) => {
|
|
55309
|
-
const bodies = /* @__PURE__ */ new Map();
|
|
55310
|
-
const pose = new Float64Array(7);
|
|
55311
|
-
const speed = new Float64Array(6);
|
|
55312
|
-
const clearOut = [];
|
|
55313
|
-
const push = new Float64Array(3);
|
|
55314
|
-
const scratch2 = { box: new THREE.Box3(), corner: new THREE.Vector3(), position: new THREE.Vector3(), quaternion: new THREE.Quaternion(), parent: new THREE.Quaternion() };
|
|
55315
|
-
let steps = 0;
|
|
55316
|
-
let pushed = 0;
|
|
55317
|
-
const extentOf = (holder) => {
|
|
55318
|
-
holder.updateWorldMatrix(true, true);
|
|
55319
|
-
frame.updateWorldMatrix(true, false);
|
|
55320
|
-
const { box: box2, corner } = scratch2;
|
|
55321
|
-
box2.setFromObject(holder);
|
|
55322
|
-
const low = [Infinity, Infinity, Infinity];
|
|
55323
|
-
const high = [-Infinity, -Infinity, -Infinity];
|
|
55324
|
-
for (let k = 0; k < 8; k++) {
|
|
55325
|
-
corner.set(k & 1 ? box2.max.x : box2.min.x, k & 2 ? box2.max.y : box2.min.y, k & 4 ? box2.max.z : box2.min.z);
|
|
55326
|
-
frame.worldToLocal(corner);
|
|
55327
|
-
low[0] = Math.min(low[0], corner.x);
|
|
55328
|
-
low[1] = Math.min(low[1], corner.y);
|
|
55329
|
-
low[2] = Math.min(low[2], corner.z);
|
|
55330
|
-
high[0] = Math.max(high[0], corner.x);
|
|
55331
|
-
high[1] = Math.max(high[1], corner.y);
|
|
55332
|
-
high[2] = Math.max(high[2], corner.z);
|
|
55333
|
-
}
|
|
55334
|
-
return { centre: [(low[0] + high[0]) / 2, (low[1] + high[1]) / 2, (low[2] + high[2]) / 2], size: [high[0] - low[0], high[1] - low[1], high[2] - low[2]] };
|
|
55335
|
-
};
|
|
55336
|
-
const holderTurn = (holder) => {
|
|
55337
|
-
holder.getWorldQuaternion(scratch2.quaternion);
|
|
55338
|
-
frame.getWorldQuaternion(scratch2.parent);
|
|
55339
|
-
const turn = scratch2.parent.clone().invert().multiply(scratch2.quaternion);
|
|
55340
|
-
return [turn.x, turn.y, turn.z, turn.w];
|
|
55341
|
-
};
|
|
55342
|
-
const follower = (holder, offset) => ({ holder, offset, turn: holderTurn(holder) });
|
|
55343
|
-
const pushOutOfTheFixedWorld = (body) => {
|
|
55344
|
-
for (let pass = 0; pass < PUSH_OUT_PASSES; pass++) {
|
|
55345
|
-
const depth = world.penetration(body.id, push);
|
|
55346
|
-
if (depth <= 0) return;
|
|
55347
|
-
world.readPose(body.id, pose, 0);
|
|
55348
|
-
world.setPose(body.id, [pose[0] + push[0] * depth, pose[1] + push[1] * depth, pose[2] + push[2] * depth], [pose[3], pose[4], pose[5], pose[6]], true);
|
|
55349
|
-
pushed++;
|
|
55350
|
-
}
|
|
55351
|
-
};
|
|
55352
|
-
const create = ({ partIndex, mass, hulls, extent, holder, chassis, chassisMass }) => {
|
|
55353
|
-
world.readPose(chassis, pose, 0);
|
|
55354
|
-
world.readVelocity(chassis, speed, 0);
|
|
55355
|
-
const rotation = [pose[3], pose[4], pose[5], pose[6]];
|
|
55356
|
-
const lever2 = rotateBy(rotation, [extent.centre[0] - chassisMass.centre[0], extent.centre[1] - chassisMass.centre[1], extent.centre[2] - chassisMass.centre[2]]);
|
|
55357
|
-
const around = [speed[3], speed[4], speed[5]];
|
|
55358
|
-
const linear = [speed[0] + around[1] * lever2[2] - around[2] * lever2[1], speed[1] + around[2] * lever2[0] - around[0] * lever2[2], speed[2] + around[0] * lever2[1] - around[1] * lever2[0]];
|
|
55359
|
-
const origin = rotateBy(rotation, extent.centre);
|
|
55360
|
-
const shape = {
|
|
55361
|
-
kind: "compound",
|
|
55362
|
-
children: hulls.map((points) => ({ shape: { kind: "convex", points: shifted(points, extent.centre) }, position: [0, 0, 0], tag: partIndex }))
|
|
55363
|
-
};
|
|
55364
|
-
const id = world.createBody({
|
|
55365
|
-
shape,
|
|
55366
|
-
motion: "dynamic",
|
|
55367
|
-
mass,
|
|
55368
|
-
inertia: boxInertia(mass, extent.size),
|
|
55369
|
-
centreAtOrigin: true,
|
|
55370
|
-
continuous: true,
|
|
55371
|
-
layer: "debris",
|
|
55372
|
-
user: partIndex,
|
|
55373
|
-
position: [pose[0] + origin[0], pose[1] + origin[1], pose[2] + origin[2]],
|
|
55374
|
-
rotation,
|
|
55375
|
-
linearVelocity: linear,
|
|
55376
|
-
angularVelocity: around
|
|
55377
|
-
});
|
|
55378
|
-
const body = { id, partIndex, shape, extent, followers: [follower(holder, [0, 0, 0])], isIgnoring: true };
|
|
55379
|
-
world.ignorePair(id, chassis, true);
|
|
55380
|
-
pushOutOfTheFixedWorld(body);
|
|
55381
|
-
bodies.set(partIndex, body);
|
|
55382
|
-
return body;
|
|
55383
|
-
};
|
|
55384
|
-
const follow = (body, holder, extent) => {
|
|
55385
|
-
const base = body.extent.centre;
|
|
55386
|
-
body.followers.push(follower(holder, [extent.centre[0] - base[0], extent.centre[1] - base[1], extent.centre[2] - base[2]]));
|
|
55387
|
-
};
|
|
55388
|
-
const place = (body) => {
|
|
55389
|
-
world.readPose(body.id, pose, 0);
|
|
55390
|
-
const rotation = [pose[3], pose[4], pose[5], pose[6]];
|
|
55391
|
-
for (const { holder, offset, turn } of body.followers) {
|
|
55392
|
-
const at = rotateBy(rotation, offset);
|
|
55393
|
-
scratch2.position.set(pose[0] + at[0], pose[1] + at[1], pose[2] + at[2]);
|
|
55394
|
-
const turned = multiplyQuat(rotation, turn);
|
|
55395
|
-
const parent = holder.parent;
|
|
55396
|
-
if (parent) parent.worldToLocal(scratch2.position);
|
|
55397
|
-
holder.position.copy(scratch2.position);
|
|
55398
|
-
scratch2.quaternion.set(turned[0], turned[1], turned[2], turned[3]);
|
|
55399
|
-
if (parent) {
|
|
55400
|
-
parent.getWorldQuaternion(scratch2.parent);
|
|
55401
|
-
scratch2.quaternion.premultiply(scratch2.parent.invert());
|
|
55402
|
-
}
|
|
55403
|
-
holder.quaternion.copy(scratch2.quaternion);
|
|
55404
|
-
holder.updateMatrix();
|
|
55405
|
-
}
|
|
55406
|
-
};
|
|
55407
|
-
const release = (body, chassis) => {
|
|
55408
|
-
world.readPose(body.id, pose, 0);
|
|
55409
|
-
world.overlapShape({ kind: "box", half: [body.extent.size[0] / 2, body.extent.size[1] / 2, body.extent.size[2] / 2] }, [pose[0], pose[1], pose[2]], [pose[3], pose[4], pose[5], pose[6]], clearOut, { layers: ["vehicle"] });
|
|
55410
|
-
if (clearOut.includes(chassis)) return;
|
|
55411
|
-
world.ignorePair(body.id, chassis, false);
|
|
55412
|
-
body.isIgnoring = false;
|
|
55413
|
-
};
|
|
55414
|
-
return {
|
|
55415
|
-
extentOf,
|
|
55416
|
-
create,
|
|
55417
|
-
follow,
|
|
55418
|
-
bodies,
|
|
55419
|
-
pushedOut: () => pushed,
|
|
55420
|
-
step: (chassis) => {
|
|
55421
|
-
steps++;
|
|
55422
|
-
const check = steps % CLEAR_CHECK_STEPS === 0;
|
|
55423
|
-
for (const body of bodies.values()) {
|
|
55424
|
-
place(body);
|
|
55425
|
-
if (check && body.isIgnoring) release(body, chassis);
|
|
55426
|
-
}
|
|
55427
|
-
},
|
|
55428
|
-
dispose: () => {
|
|
55429
|
-
for (const body of bodies.values()) if (world.has(body.id)) world.removeBody(body.id);
|
|
55430
|
-
bodies.clear();
|
|
55431
|
-
}
|
|
55432
|
-
};
|
|
55433
|
-
};
|
|
55434
|
-
var shifted = (points, by) => {
|
|
55435
|
-
const out = new Float32Array(points.length);
|
|
55436
|
-
for (let i = 0; i < out.length; i += 3) {
|
|
55437
|
-
out[i] = points[i] - by[0];
|
|
55438
|
-
out[i + 1] = points[i + 1] - by[1];
|
|
55439
|
-
out[i + 2] = points[i + 2] - by[2];
|
|
55440
|
-
}
|
|
55441
|
-
return out;
|
|
55442
|
-
};
|
|
55443
|
-
|
|
55444
|
-
// src/crash-parts.ts
|
|
55445
|
-
var CONTACT_POINTS = 64;
|
|
55446
|
-
var SETTLE_STEPS = 30;
|
|
55447
|
-
var SETTLED_SPEED = 0.05;
|
|
55448
|
-
var TOUCH_MARGIN = 0.05;
|
|
55449
|
-
var createCrashParts = (options) => {
|
|
55450
|
-
const { THREE, world, vehicle, frame, colliders } = options;
|
|
55451
|
-
const parts = vehicle.model.parts;
|
|
55452
|
-
const partIndexOf = new Map(parts.map((part, index) => [part.id, index]));
|
|
55453
|
-
const chassisHulls = createChassisHulls(colliders, partIndexOf);
|
|
55454
|
-
const bodies = createPartBodies(THREE, world, frame);
|
|
55455
|
-
const pose = new Float64Array(7);
|
|
55456
|
-
const speed = new Float64Array(6);
|
|
55457
|
-
const touches = new Float32Array(CONTACT_READ_STRIDE * CONTACT_POINTS);
|
|
55458
|
-
const strongest = /* @__PURE__ */ new Map();
|
|
55459
|
-
let chassis;
|
|
55460
|
-
let current = options.mass;
|
|
55461
|
-
let calm = 0;
|
|
55462
|
-
let cooldown = 0;
|
|
55463
|
-
let isDirty = false;
|
|
55464
|
-
let released = 0;
|
|
55465
|
-
let settles = 0;
|
|
55466
|
-
let held = 0;
|
|
55467
|
-
let remade = 0;
|
|
55468
|
-
let unplaced = 0;
|
|
55469
|
-
let blows = 0;
|
|
55470
|
-
let events = 0;
|
|
55471
|
-
const hitParts = /* @__PURE__ */ new Set();
|
|
55472
|
-
const numbers = /* @__PURE__ */ new Map();
|
|
55473
|
-
const carried = (partIndex) => bodies.bodies.get(partIndex);
|
|
55474
|
-
const takePart = (part, partIndex, holder) => {
|
|
55475
|
-
const body = carried(partIndex);
|
|
55476
|
-
const extent = bodies.extentOf(holder);
|
|
55477
|
-
if (body) return bodies.follow(body, holder, extent);
|
|
55478
|
-
const hulls = chassisHulls.release(world, chassis, part.id);
|
|
55479
|
-
const solid = hulls.length > 0 ? hulls : [boxPoints(extent.size, extent.centre)];
|
|
55480
|
-
bodies.create({ partIndex, mass: part.mass, hulls: solid, extent, holder, chassis, chassisMass: current });
|
|
55481
|
-
const own = { mass: part.mass, centre: extent.centre, inertia: boxInertia(part.mass, extent.size) };
|
|
55482
|
-
numbers.set(part.id, own);
|
|
55483
|
-
current = withoutPart(current, own);
|
|
55484
|
-
world.setMassProperties(chassis, { mass: current.mass, inertia: current.inertia, centreOfMass: current.centre });
|
|
55485
|
-
released++;
|
|
55486
|
-
options.onPartLost?.(part);
|
|
55487
|
-
};
|
|
55488
|
-
const isTouching = (points) => {
|
|
55489
|
-
if (!chassis) return false;
|
|
55490
|
-
const count2 = world.readContacts(chassis, touches);
|
|
55491
|
-
if (count2 === 0) return false;
|
|
55492
|
-
world.readPose(chassis, pose, 0);
|
|
55493
|
-
let lowX = Infinity, lowY = Infinity, lowZ = Infinity;
|
|
55494
|
-
let highX = -Infinity, highY = -Infinity, highZ = -Infinity;
|
|
55495
|
-
for (let i = 0; i < points.length; i += 3) {
|
|
55496
|
-
const x = points[i], y = points[i + 1], z = points[i + 2];
|
|
55497
|
-
if (x < lowX) lowX = x;
|
|
55498
|
-
if (x > highX) highX = x;
|
|
55499
|
-
if (y < lowY) lowY = y;
|
|
55500
|
-
if (y > highY) highY = y;
|
|
55501
|
-
if (z < lowZ) lowZ = z;
|
|
55502
|
-
if (z > highZ) highZ = z;
|
|
55503
|
-
}
|
|
55504
|
-
const qx = -pose[3], qy = -pose[4], qz = -pose[5], qw = pose[6];
|
|
55505
|
-
for (let c = 0; c < count2; c++) {
|
|
55506
|
-
const at = c * CONTACT_READ_STRIDE;
|
|
55507
|
-
const vx = touches[at] - pose[0], vy = touches[at + 1] - pose[1], vz = touches[at + 2] - pose[2];
|
|
55508
|
-
const tx = 2 * (qy * vz - qz * vy);
|
|
55509
|
-
const ty = 2 * (qz * vx - qx * vz);
|
|
55510
|
-
const tz = 2 * (qx * vy - qy * vx);
|
|
55511
|
-
const x = vx + qw * tx + qy * tz - qz * ty;
|
|
55512
|
-
const y = vy + qw * ty + qz * tx - qx * tz;
|
|
55513
|
-
const z = vz + qw * tz + qx * ty - qy * tx;
|
|
55514
|
-
if (x >= lowX - TOUCH_MARGIN && x <= highX + TOUCH_MARGIN && y >= lowY - TOUCH_MARGIN && y <= highY + TOUCH_MARGIN && z >= lowZ - TOUCH_MARGIN && z <= highZ + TOUCH_MARGIN) return true;
|
|
55515
|
-
}
|
|
55516
|
-
return false;
|
|
55517
|
-
};
|
|
55518
|
-
const feedDamage = () => {
|
|
55519
|
-
const rows = world.contacts;
|
|
55520
|
-
strongest.clear();
|
|
55521
|
-
for (let i = 0; i < rows.count; i++) {
|
|
55522
|
-
const mine = rows.a[i] === chassis ? 0 : rows.b[i] === chassis ? 1 : -1;
|
|
55523
|
-
if (mine < 0) continue;
|
|
55524
|
-
const tag = mine === 0 ? rows.tagA[i] : rows.tagB[i];
|
|
55525
|
-
if (tag < 0 || tag >= parts.length) continue;
|
|
55526
|
-
const at = strongest.get(tag);
|
|
55527
|
-
if (at === void 0 || rows.approach[i] > rows.approach[at]) strongest.set(tag, i);
|
|
55528
|
-
}
|
|
55529
|
-
for (const [tag, i] of strongest) {
|
|
55530
|
-
const mine = rows.a[i] === chassis;
|
|
55531
|
-
const other = mine ? rows.b[i] : rows.a[i];
|
|
55532
|
-
const otherMass = world.has(other) ? world.massOf(other) : 0;
|
|
55533
|
-
const sign2 = mine ? 1 : -1;
|
|
55534
|
-
const part = parts[tag];
|
|
55535
|
-
const result = crashVehicle(vehicle, {
|
|
55536
|
-
point: [rows.point[i * 3], rows.point[i * 3 + 1], rows.point[i * 3 + 2]],
|
|
55537
|
-
direction: [sign2 * rows.normal[i * 3], sign2 * rows.normal[i * 3 + 1], sign2 * rows.normal[i * 3 + 2]],
|
|
55538
|
-
speed: rows.approach[i],
|
|
55539
|
-
massKg: current.mass,
|
|
55540
|
-
otherMassKg: otherMass > 0 ? otherMass : Infinity,
|
|
55541
|
-
contactWidth: Math.max(0.2, part.box.size[2]),
|
|
55542
|
-
source: part.id
|
|
55543
|
-
});
|
|
55544
|
-
blows++;
|
|
55545
|
-
events += result.events.length;
|
|
55546
|
-
hitParts.add(part.id);
|
|
55547
|
-
if (result.events.length > 0) {
|
|
55548
|
-
isDirty = true;
|
|
55549
|
-
cooldown = 0;
|
|
55550
|
-
}
|
|
55551
|
-
}
|
|
55552
|
-
};
|
|
55553
|
-
const settle = () => {
|
|
55554
|
-
world.readVelocity(chassis, speed, 0);
|
|
55555
|
-
const still = Math.hypot(speed[0], speed[1], speed[2]) < SETTLED_SPEED && Math.hypot(speed[3], speed[4], speed[5]) < SETTLED_SPEED;
|
|
55556
|
-
calm = still ? calm + 1 : 0;
|
|
55557
|
-
if (calm < SETTLE_STEPS || !(isDirty || chassisHulls.hasWork())) return;
|
|
55558
|
-
if (cooldown > 0) {
|
|
55559
|
-
cooldown--;
|
|
55560
|
-
return;
|
|
55561
|
-
}
|
|
55562
|
-
const done = chassisHulls.settle(world, chassis, isTouching);
|
|
55563
|
-
settles++;
|
|
55564
|
-
held += done.held;
|
|
55565
|
-
remade += done.remade;
|
|
55566
|
-
unplaced += done.unplaced;
|
|
55567
|
-
isDirty = done.held > 0 || colliders.isHullPending();
|
|
55568
|
-
cooldown = done.held > 0 && !colliders.isHullPending() ? SETTLE_STEPS : 0;
|
|
55569
|
-
};
|
|
55570
|
-
vehicle.setPartSink((part, holder) => {
|
|
55571
|
-
const partIndex = partIndexOf.get(part.id);
|
|
55572
|
-
if (chassis === void 0 || partIndex === void 0) return false;
|
|
55573
|
-
takePart(part, partIndex, holder);
|
|
55574
|
-
return true;
|
|
55575
|
-
});
|
|
55576
|
-
return {
|
|
55577
|
-
shape: () => chassisHulls.shape(),
|
|
55578
|
-
bind: (body) => {
|
|
55579
|
-
chassis = body;
|
|
55580
|
-
world.watchContacts(body, true);
|
|
55581
|
-
world.setMassProperties(body, { mass: current.mass, inertia: current.inertia, centreOfMass: current.centre });
|
|
55582
|
-
},
|
|
55583
|
-
step: () => {
|
|
55584
|
-
if (chassis === void 0) return;
|
|
55585
|
-
feedDamage();
|
|
55586
|
-
bodies.step(chassis);
|
|
55587
|
-
settle();
|
|
55588
|
-
},
|
|
55589
|
-
mass: () => current,
|
|
55590
|
-
partNumbers: () => numbers,
|
|
55591
|
-
partBodies: () => new Map([...bodies.bodies].map(([index, body]) => [parts[index].id, body.id])),
|
|
55592
|
-
stats: () => ({ released, pushedOut: bodies.pushedOut(), settles, remade, held, unplaced, blows, events, hitParts, children: chassisHulls.count() }),
|
|
55593
|
-
dispose: () => {
|
|
55594
|
-
vehicle.setPartSink(null);
|
|
55595
|
-
bodies.dispose();
|
|
55596
|
-
if (chassis !== void 0 && world.has(chassis)) world.watchContacts(chassis, false);
|
|
55597
|
-
}
|
|
55598
|
-
};
|
|
55599
|
-
};
|
|
55600
|
-
var boxPoints = (size, centre) => {
|
|
55601
|
-
const out = new Float32Array(24);
|
|
55602
|
-
for (let k = 0; k < 8; k++) {
|
|
55603
|
-
out[k * 3] = centre[0] + (k & 1 ? size[0] : -size[0]) / 2;
|
|
55604
|
-
out[k * 3 + 1] = centre[1] + (k & 2 ? size[1] : -size[1]) / 2;
|
|
55605
|
-
out[k * 3 + 2] = centre[2] + (k & 4 ? size[2] : -size[2]) / 2;
|
|
55606
|
-
}
|
|
55607
|
-
return out;
|
|
55608
|
-
};
|
|
55609
|
-
|
|
55610
|
-
// src/hull-plan-cache.ts
|
|
55611
|
-
var createHullPlanCache = () => {
|
|
55612
|
-
const shared2 = /* @__PURE__ */ new Map();
|
|
55613
|
-
const flights = /* @__PURE__ */ new Map();
|
|
55614
|
-
let planned = 0, reused = 0;
|
|
55615
|
-
let isDisposed = false;
|
|
55616
|
-
return {
|
|
55617
|
-
get: (key) => shared2.get(key),
|
|
55618
|
-
set: (key, value) => {
|
|
55619
|
-
if (!isDisposed && !shared2.has(key)) shared2.set(key, value);
|
|
55620
|
-
},
|
|
55621
|
-
flight: (key) => flights.get(key),
|
|
55622
|
-
setFlight: (key, flight) => void (isDisposed || flights.set(key, flight)),
|
|
55623
|
-
clearFlight: (key) => void flights.delete(key),
|
|
55624
|
-
noteReused: () => void reused++,
|
|
55625
|
-
noteDivided: () => void planned++,
|
|
55626
|
-
stats: () => ({ models: shared2.size, planned, reused }),
|
|
55627
|
-
dispose: () => {
|
|
55628
|
-
isDisposed = true;
|
|
55629
|
-
shared2.clear();
|
|
55630
|
-
flights.clear();
|
|
55631
|
-
planned = 0;
|
|
55632
|
-
reused = 0;
|
|
55633
|
-
}
|
|
55634
|
-
};
|
|
55635
|
-
};
|
|
55636
55850
|
return __toCommonJS(index_exports);
|
|
55637
55851
|
})();
|
|
55638
55852
|
//# sourceMappingURL=index.global.js.map
|