@adatechnology/game-urban-three 0.5.6 → 0.5.8

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.
@@ -269,7 +269,7 @@ var GameUrbanThree = (() => {
269
269
  }
270
270
  var EFFECT_STEP_SECONDS = 1 / 50;
271
271
 
272
- // ../game-shapes/dist/chunk-E3X7UDDV.js
272
+ // ../game-shapes/dist/chunk-QETSTM6M.js
273
273
  function canonicalJson(value) {
274
274
  if (value === null) return "null";
275
275
  if (typeof value === "number") return Object.is(value, -0) ? "-0" : Number.isFinite(value) ? String(value) : JSON.stringify(String(value));
@@ -12655,7 +12655,7 @@ var GameUrbanThree = (() => {
12655
12655
  frameR: 9e-3
12656
12656
  });
12657
12657
  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);
12658
- kit.emblem(c2, e.p.x + 0.025, 0.67, 0, 0.045);
12658
+ kit.emblem(c2, e.p.x + 0.018, 0.67, 0, 0.045);
12659
12659
  const bg = c2.meta.frontBumper.userData.grid;
12660
12660
  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 }));
12661
12661
  },
@@ -23654,8 +23654,8 @@ var GameUrbanThree = (() => {
23654
23654
  return b;
23655
23655
  }
23656
23656
  function plateMoto(c, x, y, txt) {
23657
- c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 9e-3, y, 0);
23658
- c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 3e-3, y, 0, "-x", {
23657
+ c.roundBox(0.02, 0.15, 0.2, 8e-3, MT.trim, x + 7e-3, y, 0);
23658
+ c.text(txt || kit.config.plate.slice(0, 5), 0.2, 0.135, x - 5e-3, y, 0, "-x", {
23659
23659
  w: 300,
23660
23660
  h: 220,
23661
23661
  bg: "#f2f2ee",
@@ -23769,8 +23769,8 @@ var GameUrbanThree = (() => {
23769
23769
  d.position.z = s * hw * 0.72;
23770
23770
  g.add(d);
23771
23771
  for (let q = 0; q < 12; q++) {
23772
- const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 5e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
23773
- sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.0105));
23772
+ const a2 = q / 12 * PI * 2, sl = new THREE.Mesh(G.roundedBox(rimR * 0.42, 0.016, 6e-3, 2e-3), o.slot || CM("#1c1e21", { metalness: 0.5, roughness: 0.4 }));
23773
+ sl.position.set(Math.cos(a2) * rimR * 0.62, Math.sin(a2) * rimR * 0.62, s * (hw * 0.72 + 0.013));
23774
23774
  sl.rotation.z = a2;
23775
23775
  g.add(sl);
23776
23776
  }
@@ -28740,7 +28740,8 @@ var GameUrbanThree = (() => {
28740
28740
  tailLightY: 2.06,
28741
28741
  noAntenna: true,
28742
28742
  hl: { style: "round", w: 0.2, h: 0.2, y: 2.03, in: 0.12, yaw: 0 },
28743
- grille: { style: "bars", w: 1, h: 0.3, y: 2 },
28743
+ /* 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) */
28744
+ grille: { style: "bars", w: 1, h: 0.3, y: 2, emblemBack: 9e-3 },
28744
28745
  tl: { style: "vertical", w: 0.12, h: 0.28, y: 2.06, in: 0 },
28745
28746
  interior: { rows: 1, col: "#202224", trim: "#141516", front: "bench" },
28746
28747
  hood: { motor: "v8" },
@@ -38057,6 +38058,61 @@ var GameUrbanThree = (() => {
38057
38058
  made[0].position.y += lift;
38058
38059
  };
38059
38060
  };
38061
+ const sinkBottoms = (parts) => {
38062
+ const CELL2 = 4;
38063
+ const cells = /* @__PURE__ */ new Map();
38064
+ const near = (x, z, r, visit) => {
38065
+ for (let i = Math.floor((x - r) / CELL2); i <= Math.floor((x + r) / CELL2); i++) for (let k = Math.floor((z - r) / CELL2); k <= Math.floor((z + r) / CELL2); k++) if (visit(`${i},${k}`)) return true;
38066
+ return false;
38067
+ };
38068
+ return (part, made) => {
38069
+ let height, r, centred;
38070
+ if (part.shape === "box") {
38071
+ if (part.rz) return;
38072
+ height = part.height;
38073
+ r = Math.hypot(part.width, part.depth) / 2;
38074
+ centred = true;
38075
+ } else if (part.shape === "prism") {
38076
+ height = part.height;
38077
+ r = Math.hypot(part.width, part.depth) / 2;
38078
+ centred = false;
38079
+ } else if (part.shape === "cylinder") {
38080
+ height = part.height;
38081
+ r = Math.max(part.radiusTop, part.radiusBottom);
38082
+ centred = true;
38083
+ } else if (part.shape === "cone") {
38084
+ height = part.height;
38085
+ r = part.radius;
38086
+ centred = true;
38087
+ } else return;
38088
+ if (!(height > 0)) return;
38089
+ let x = part.x, y = part.y, z = part.z;
38090
+ for (let parent = part.parent; parent >= 0; parent = parts[parent].parent) {
38091
+ const group = parts[parent];
38092
+ if (group.shape !== "group") return;
38093
+ const c = Math.cos(group.ry || 0), sn = Math.sin(group.ry || 0);
38094
+ const rx = x * c + z * sn, rz = -x * sn + z * c;
38095
+ x = group.x + rx;
38096
+ y = group.y + y;
38097
+ z = group.z + rz;
38098
+ }
38099
+ const bottom = centred ? y - height / 2 : y;
38100
+ let sink = 0;
38101
+ const clash = (key) => (cells.get(key) ?? []).some((other) => Math.abs(other.y - (bottom - sink)) < PLANE_LAYER_GAP / 2 && Math.hypot(other.x - x, other.z - z) < other.r + r);
38102
+ while (near(x, z, r, clash)) sink += PLANE_LAYER_GAP;
38103
+ const entry = { y: bottom - sink, x, z, r };
38104
+ near(x, z, r, (key) => {
38105
+ const list2 = cells.get(key);
38106
+ if (list2) list2.push(entry);
38107
+ else cells.set(key, [entry]);
38108
+ return false;
38109
+ });
38110
+ if (!sink) return;
38111
+ const mesh2 = made[0];
38112
+ mesh2.scale.y *= (height + sink) / height;
38113
+ mesh2.position.y -= centred ? sink / 2 : sink;
38114
+ };
38115
+ };
38060
38116
  function draw(scene, drawOptions = {}) {
38061
38117
  const root = markKitOrigin(drawOptions.root ?? new THREE.Group(), { owner: "game-urban-three", kind: "urban" });
38062
38118
  const animators = [];
@@ -38064,9 +38120,11 @@ var GameUrbanThree = (() => {
38064
38120
  animatedLenses = /* @__PURE__ */ new Set();
38065
38121
  const objects = [];
38066
38122
  const layer = options.standOut === false ? () => void 0 : layerPlanes(scene.parts);
38123
+ const sink = options.standOut === false ? () => void 0 : sinkBottoms(scene.parts);
38067
38124
  for (const part of scene.parts) {
38068
38125
  const made = drawPart(part, animators, lights);
38069
38126
  layer(part, made);
38127
+ sink(part, made);
38070
38128
  objects.push(made);
38071
38129
  const parent = part.parent < 0 ? root : objects[part.parent][0];
38072
38130
  parent.add(...made);