@adatechnology/game-vehicles-three 0.14.1 → 0.14.3

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.
@@ -326,6 +326,21 @@ var GameVehiclesThree = (() => {
326
326
  return lx > fp.minX - radius && lx < fp.maxX + radius && lz > fp.minZ - radius && lz < fp.maxZ + radius;
327
327
  };
328
328
  }
329
+ function footprintSolid(object2, footprint, height) {
330
+ const o = typeof object2 === "function" ? object2() : object2;
331
+ const fp = typeof footprint === "function" ? footprint() : footprint;
332
+ if (!o || !fp || !o.parent) return [];
333
+ o.updateWorldMatrix?.(true, false);
334
+ const e = o.matrixWorld.elements;
335
+ const sx = Math.hypot(e[0], e[2]) || 1;
336
+ const sz = Math.hypot(e[8], e[10]) || 1;
337
+ const angle = Math.atan2(-e[2], e[0]);
338
+ const cx = (fp.minX + fp.maxX) / 2;
339
+ const cz = (fp.minZ + fp.maxZ) / 2;
340
+ const centreX = e[12] + cx * e[0] + cz * e[8];
341
+ const centreZ = e[14] + cx * e[2] + cz * e[10];
342
+ return [{ center: [centreX, height / 2, centreZ], half: [(fp.maxX - fp.minX) / 2 * sx, height / 2, (fp.maxZ - fp.minZ) / 2 * sz], rotation: [0, Math.sin(angle / 2), 0, Math.cos(angle / 2)] }];
343
+ }
329
344
  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 });
330
345
  var insideTurned = (f, x, z) => {
331
346
  const dx = x - f.x;
@@ -7978,7 +7993,7 @@ var GameVehiclesThree = (() => {
7978
7993
  frameR: 9e-3
7979
7994
  });
7980
7995
  const e = K.grid(1, 0, { z1: 0.1, y0: 0.64, y1: 0.72, du: 0.03, dv: 0.03 }).at(0.5, 0.67);
7981
- kit.emblem(c2, e.p.x + 0.025, 0.67, 0, 0.045);
7996
+ kit.emblem(c2, e.p.x + 0.018, 0.67, 0, 0.045);
7982
7997
  const bg = c2.meta.frontBumper.userData.grid;
7983
7998
  c2.deform.push(K.skin(bg, MT.rubber, { u0: 0.02, u1: 0.98, yb: 0.37, yt: 0.405, off: 0.02, nv: 1 }));
7984
7999
  },
@@ -18977,8 +18992,8 @@ var GameVehiclesThree = (() => {
18977
18992
  return b;
18978
18993
  }
18979
18994
  function plateMoto(c, x, y, txt) {
18980
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
18981
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
18995
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 7e-3, y, 0);
18996
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 5e-3, y, 0, "-x", {
18982
18997
  w: 300,
18983
18998
  h: 220,
18984
18999
  bg: "#f2f2ee",
@@ -19092,8 +19107,8 @@ var GameVehiclesThree = (() => {
19092
19107
  d.position.z = s * hw * 0.72;
19093
19108
  g.add(d);
19094
19109
  for (let q = 0; q < 12; q++) {
19095
- const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G2.roundedBox(rimR * 0.42, 0.016, 6e-3, 5e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
19096
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
19110
+ const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G2.roundedBox(rimR * 0.42, 0.016, 6e-3, 2e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
19111
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.013));
19097
19112
  sl.rotation.z = a2;
19098
19113
  g.add(sl);
19099
19114
  }
@@ -24063,7 +24078,8 @@ var GameVehiclesThree = (() => {
24063
24078
  tailLightY: 2.06,
24064
24079
  noAntenna: true,
24065
24080
  hl: { style: "round", w: 0.2, h: 0.2, y: 2.03, in: 0.12, yaw: 0 },
24066
- grille: { style: "bars", w: 1, h: 0.3, y: 2 },
24081
+ /* the badge is this truck's foremost point: 9 mm back, where it was before its layers grew 7 mm and the grille came 2 mm ahead (the length the team measured) */
24082
+ grille: { style: "bars", w: 1, h: 0.3, y: 2, emblemBack: 9e-3 },
24067
24083
  tl: { style: "vertical", w: 0.12, h: 0.28, y: 2.06, in: 0 },
24068
24084
  interior: { rows: 1, col: "#202224", trim: "#141516", front: "bench" },
24069
24085
  hood: { motor: "v8" },
@@ -29143,7 +29159,7 @@ var GameVehiclesThree = (() => {
29143
29159
  warmup: WARMUP
29144
29160
  });
29145
29161
 
29146
- // ../game-shapes/dist/chunk-E3X7UDDV.js
29162
+ // ../game-shapes/dist/chunk-QETSTM6M.js
29147
29163
  function canonicalJson(value) {
29148
29164
  if (value === null) return "null";
29149
29165
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -33734,6 +33750,7 @@ var GameVehiclesThree = (() => {
33734
33750
  kit.halo = halo;
33735
33751
  function lampKit(g, d, inner, lens, lensMat, refl) {
33736
33752
  refl = refl || MATERIALS.reflector;
33753
+ let nProj = 0;
33737
33754
  return {
33738
33755
  housing: function(w, h, y, z, geoFn) {
33739
33756
  const geo = roundedBoxGeometry(d, h, w, Math.min(0.03, h * 0.4));
@@ -33754,7 +33771,7 @@ var GameVehiclesThree = (() => {
33754
33771
  return m;
33755
33772
  },
33756
33773
  proj: function(y, z, r, mat) {
33757
- const bz = gm(g, new THREE.CylinderGeometry(r * 1.3, r * 1.45, 0.03, 18), refl, d / 2 - 0.03, y, z);
33774
+ const bz = gm(g, new THREE.CylinderGeometry(r * 1.3, r * 1.45, 0.03, 18), refl, d / 2 - 0.03 - nProj++ * 2e-3, y, z);
33758
33775
  bz.rotation.z = -PI / 2;
33759
33776
  if (refl !== MATERIALS.reflector) inner.push(bz);
33760
33777
  const e = gm(g, new THREE.SphereGeometry(r, 14, 10), mat, d / 2 - 0.022, y, z);
@@ -33934,10 +33951,10 @@ var GameVehiclesThree = (() => {
33934
33951
  (parent || c.vehicle).add(g);
33935
33952
  const d1 = gm(g, new THREE.CylinderGeometry(r, r, 0.012, 24), MATERIALS.chrome);
33936
33953
  d1.rotation.z = PI / 2;
33937
- const d2 = gm(g, new THREE.CylinderGeometry(r * 0.78, r * 0.78, 0.014, 24), MATERIALS.trim);
33954
+ const d2 = gm(g, new THREE.CylinderGeometry(r * 0.78, r * 0.78, 0.018, 24), MATERIALS.trim);
33938
33955
  d2.rotation.z = PI / 2;
33939
- gm(g, roundedBoxGeometry(0.016, r * 0.32, r * 1.4, 5e-3), MATERIALS.chrome);
33940
- gm(g, roundedBoxGeometry(0.016, r * 1, r * 0.22, 5e-3), MATERIALS.chrome, 0, 0, r * 0.25).rotation.x = 0.5;
33956
+ gm(g, roundedBoxGeometry(0.024, r * 0.32, r * 1.4, 5e-3), MATERIALS.chrome);
33957
+ gm(g, roundedBoxGeometry(0.03, r * 1, r * 0.22, 5e-3), MATERIALS.chrome, 0, 0, r * 0.25).rotation.x = 0.5;
33941
33958
  return g;
33942
33959
  };
33943
33960
  kit.grille = function(c, o) {
@@ -33990,7 +34007,7 @@ var GameVehiclesThree = (() => {
33990
34007
  g.children.forEach(function(m) {
33991
34008
  m.castShadow = true;
33992
34009
  });
33993
- if (o.emblem !== false) kit.emblem(c, 0.05, st === "closed" ? h * 0.12 : 0, 0, Math.min(0.05, h * 0.3), g);
34010
+ if (o.emblem !== false) kit.emblem(c, 0.05 - (o.emblemBack ?? 0), st === "closed" ? h * 0.12 : 0, 0, Math.min(0.05, h * 0.3), g);
33994
34011
  return g;
33995
34012
  };
33996
34013
  const shared2 = { lampGroup, gm, wedgeY, haloTex, glowTexture, haloMats, halo, lampKit };
@@ -34235,7 +34252,7 @@ var GameVehiclesThree = (() => {
34235
34252
  } 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" });
34236
34253
  const trimLen = Math.min(0.8, (o.rowPitch ?? 0.88) - 0.06);
34237
34254
  [-1, 1].forEach(function(s) {
34238
- c.roundBox(trimLen, belt - fl - 0.08, 0.035, 0.015, trim, x + 0.12, (belt + fl) / 2 + 0.02, s * (zi + 0.02));
34255
+ c.roundBox(trimLen, belt - fl - 0.08, 0.035, 0.015, trim, x + 0.12, (belt + fl) / 2 + 0.02, s * (zi + 0.02 + r % 2 * 2e-3));
34239
34256
  c.roundBox(0.3, 0.05, 0.07, 0.02, fab, x + 0.16, fl + seatH + 0.16, s * (zi - 0.015));
34240
34257
  c.roundBox(0.08, 0.025, 0.02, 8e-3, MATERIALS.chrome, x + 0.36, belt - 0.11, s * (zi - 5e-3));
34241
34258
  });
@@ -34656,15 +34673,15 @@ var GameVehiclesThree = (() => {
34656
34673
  const cx = (x0 + x1) / 2;
34657
34674
  const paint = c.paint(o.col || c.meta.color || "#666");
34658
34675
  const out = {};
34659
- c.roundBox(L, 0.03, 2 * zw, 0.01, MATERIALS.bay, cx, fl, 0);
34676
+ c.roundBox(L - 0.03, 0.03, 2 * zw, 0.01, MATERIALS.bay, cx + 0.015, fl, 0);
34660
34677
  c.roundBox(0.03, H + 0.04, 2 * zw, 0.01, MATERIALS.bay, x0 + 0.015, fl + H / 2, 0);
34661
34678
  [1, -1].forEach(function(s) {
34662
- c.roundBox(L, H * 0.75, 0.03, 0.01, MATERIALS.bay, cx, fl + H * 0.37, s * zw);
34679
+ c.roundBox(L - 0.034, H * 0.75, 0.03, 0.01, MATERIALS.bay, x0 + 0.03 + (L - 0.034) / 2, fl + H * 0.37, s * zw);
34663
34680
  });
34664
34681
  const rx = x1 - 0.06;
34665
34682
  const rh = H * 0.82;
34666
34683
  const rad = c.roundBox(0.05, rh, zw * 1.5, 0.012, MATERIALS.radiator, rx, fl + rh / 2 + 0.02, 0);
34667
- for (let f = 0; f < 6; f++) c.roundBox(0.054, 6e-3, zw * 1.46, 2e-3, MATERIALS.steel, rx, fl + 0.06 + f * (rh - 0.06) / 6, 0);
34684
+ for (let f = 0; f < 6; f++) c.roundBox(0.062, 6e-3, zw * 1.46, 2e-3, MATERIALS.steel, rx, fl + 0.06 + f * (rh - 0.06) / 6, 0);
34668
34685
  c.roundBox(0.07, 0.04, zw * 1.5, 0.015, MATERIALS.plastic, rx, fl + rh + 0.03, 0);
34669
34686
  out.rad = new V3(rx, fl + rh / 2, 0);
34670
34687
  const fanR = Math.min(rh * 0.42, zw * 0.45);
@@ -34703,8 +34720,9 @@ var GameVehiclesThree = (() => {
34703
34720
  }
34704
34721
  function battery(x, y, z, sc) {
34705
34722
  sc = sc || 1;
34723
+ x = Math.max(x, x0 + 0.034 + 0.1 * sc);
34706
34724
  c.roundBox(0.2 * sc, 0.15 * sc, 0.15 * sc, 0.015, makeMaterial("#1a1b1c", { roughness: 0.5 }), x, y, z);
34707
- c.roundBox(0.2 * sc, 0.012, 0.15 * sc, 5e-3, makeMaterial("#2e3a6a", { roughness: 0.5 }), x, y + 0.04 * sc, z);
34725
+ c.roundBox(0.2 * sc + 8e-3, 0.012, 0.15 * sc + 8e-3, 5e-3, makeMaterial("#2e3a6a", { roughness: 0.5 }), x, y + 0.04 * sc, z);
34708
34726
  c.cylinder(0.016, 0.018, 0.03, MATERIALS.postRed, x + 0.06 * sc, y + 0.09 * sc, z + 0.045 * sc);
34709
34727
  c.cylinder(0.016, 0.018, 0.03, MATERIALS.postBlack, x + 0.06 * sc, y + 0.09 * sc, z - 0.045 * sc);
34710
34728
  c.tube(
@@ -34723,7 +34741,7 @@ var GameVehiclesThree = (() => {
34723
34741
  reservoir(x0 + 0.12, uy - 0.04, -zw * 0.55, 0.07, 0.06, 0.07, MATERIALS.coolant, makeMaterial("#c9b26a", { roughness: 0.3 }), MATERIALS.yellow);
34724
34742
  reservoir(x1 - 0.2, fl + H * 0.45, zw * 0.72, 0.12, 0.13, 0.1, MATERIALS.washer, makeMaterial("#3f8fc0", { roughness: 0.3 }), MATERIALS.capBlue);
34725
34743
  c.roundBox(0.12, 0.07, 0.13, 0.015, MATERIALS.plastic, x0 + 0.18, uy - 0.02, -zw * 0.78);
34726
- c.roundBox(0.12, 6e-3, 0.13, 3e-3, MATERIALS.dark, x0 + 0.18, uy + 0.017, -zw * 0.78);
34744
+ c.roundBox(0.116, 6e-3, 0.126, 3e-3, MATERIALS.dark, x0 + 0.18, uy + 0.017, -zw * 0.78);
34727
34745
  if (mot === "electric") {
34728
34746
  const fx0 = x0 + L * 0.4;
34729
34747
  const fx1 = x1 - 0.14;
@@ -34876,7 +34894,7 @@ var GameVehiclesThree = (() => {
34876
34894
  const afx = x1 - L * 0.32;
34877
34895
  const afy = Math.min(top - 0.07, fl + H * 0.7);
34878
34896
  c.roundBox(0.22, 0.1, 0.26, 0.03, MATERIALS.plastic, afx, afy, zw * 0.5);
34879
- c.roundBox(0.22, 0.012, 0.26, 4e-3, MATERIALS.dark, afx, afy + 0.01, zw * 0.5);
34897
+ c.roundBox(0.224, 0.012, 0.264, 4e-3, MATERIALS.dark, afx, afy + 0.01, zw * 0.5);
34880
34898
  c.tube(
34881
34899
  [
34882
34900
  [afx - 0.11, afy, zw * 0.4],
@@ -35214,7 +35232,7 @@ var GameVehiclesThree = (() => {
35214
35232
  const gr = Object.assign({ style: "bars", w: W * 0.44, h: Math.max(0.08, hy - bumperY - 0.12) }, s.grille || {});
35215
35233
  const gy = gr.y || (bumperY + hy) / 2 + 0.02;
35216
35234
  const gx = I.profX(it, gy, true);
35217
- kit.grille(c, { style: gr.style, x: gx + 0.025, y: gy, w: gr.w, h: gr.h, col: s.col, emblem: gr.emblem });
35235
+ kit.grille(c, { style: gr.style, x: gx + 0.027, y: gy, w: gr.w, h: gr.h, col: s.col, emblem: gr.emblem, emblemBack: gr.emblemBack });
35218
35236
  } else kit.emblem(c, I.profX(it, hy + 0.02, true) + 0.055, hy + 0.02, 0, 0.04);
35219
35237
  const tl = Object.assign({ style: "wrap", w: s.tailW || 0.3, h: s.tailH || 0.14, in: 0.05 }, s.tl || {});
35220
35238
  const ty = tl.y || s.tailLightY || s.tailY - 0.05;
@@ -52719,10 +52737,8 @@ var GameVehiclesThree = (() => {
52719
52737
  }
52720
52738
  helpersShown = boxKey();
52721
52739
  };
52722
- const laneBlocked = footprintBlocker(
52723
- () => lane?.group,
52724
- () => lane ? { minX: -lane.car.width / 2, maxX: lane.car.width / 2, minZ: -lane.car.length / 2, maxZ: lane.car.length / 2 } : null
52725
- );
52740
+ const laneFootprint = () => lane ? { minX: -lane.car.width / 2, maxX: lane.car.width / 2, minZ: -lane.car.length / 2, maxZ: lane.car.length / 2 } : null;
52741
+ const laneBlocked = footprintBlocker(() => lane?.group, laneFootprint);
52726
52742
  const blocked = (x, z, radius) => {
52727
52743
  for (const entry of placed.values()) if (entry.footprint && footprintBlocker(entry.root, entry.footprint)(x, z, radius)) return true;
52728
52744
  return laneBlocked(x, z, radius);
@@ -53006,7 +53022,7 @@ var GameVehiclesThree = (() => {
53006
53022
  three = lent.THREE;
53007
53023
  const stopChange = lent.bench?.onChange(onChange);
53008
53024
  const stopFrame = lent.onFrame(frame);
53009
- const stopBlocker = lent.addBlocker?.(blocked);
53025
+ const stopBlocker = lent.addBlocker?.(blocked, () => lane ? footprintSolid(lane.group, laneFootprint, lane.car.height) : []);
53010
53026
  const stopCrease = lent.defer?.(creaseQueue.deferredQueue(), DEFERRED_PRIORITY[DEFERRED_QUEUE_ID.VEHICLE_CREASE]);
53011
53027
  const stopLodBatch = lent.defer?.(lodQueue.deferredQueue(), DEFERRED_PRIORITY[DEFERRED_QUEUE_ID.VEHICLE_LOD_BATCH]);
53012
53028
  if (isRenderPools(lent.pools)) lent.pools.materials.register("vehicles.cracked-glass", () => crackedGlassMaterial(three, new three.DataTexture(new Uint8Array(4), 1, 1)));