@adatechnology/game-vehicles-three 0.14.0 → 0.14.2

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;
@@ -52719,10 +52734,8 @@ var GameVehiclesThree = (() => {
52719
52734
  }
52720
52735
  helpersShown = boxKey();
52721
52736
  };
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
- );
52737
+ const laneFootprint = () => lane ? { minX: -lane.car.width / 2, maxX: lane.car.width / 2, minZ: -lane.car.length / 2, maxZ: lane.car.length / 2 } : null;
52738
+ const laneBlocked = footprintBlocker(() => lane?.group, laneFootprint);
52726
52739
  const blocked = (x, z, radius) => {
52727
52740
  for (const entry of placed.values()) if (entry.footprint && footprintBlocker(entry.root, entry.footprint)(x, z, radius)) return true;
52728
52741
  return laneBlocked(x, z, radius);
@@ -53006,7 +53019,7 @@ var GameVehiclesThree = (() => {
53006
53019
  three = lent.THREE;
53007
53020
  const stopChange = lent.bench?.onChange(onChange);
53008
53021
  const stopFrame = lent.onFrame(frame);
53009
- const stopBlocker = lent.addBlocker?.(blocked);
53022
+ const stopBlocker = lent.addBlocker?.(blocked, () => lane ? footprintSolid(lane.group, laneFootprint, lane.car.height) : []);
53010
53023
  const stopCrease = lent.defer?.(creaseQueue.deferredQueue(), DEFERRED_PRIORITY[DEFERRED_QUEUE_ID.VEHICLE_CREASE]);
53011
53024
  const stopLodBatch = lent.defer?.(lodQueue.deferredQueue(), DEFERRED_PRIORITY[DEFERRED_QUEUE_ID.VEHICLE_LOD_BATCH]);
53012
53025
  if (isRenderPools(lent.pools)) lent.pools.materials.register("vehicles.cracked-glass", () => crackedGlassMaterial(three, new three.DataTexture(new Uint8Array(4), 1, 1)));