@adatechnology/game-vehicles-three 0.3.2 → 0.3.4

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/index.js CHANGED
@@ -303,6 +303,7 @@ function markDamageables(c, damageables) {
303
303
  }
304
304
 
305
305
  // src/test-area/module.ts
306
+ import { footprintBlocker } from "@adatechnology/game-contracts";
306
307
  import { buildVehicleItem, createVehicleDestructible, createVehicleKit } from "@adatechnology/game-vehicles";
307
308
  import { createArcadeDriver as createArcadeDriver2, createSemiSimDriver as createSemiSimDriver2, createSurfaces as createSurfaces2, vehicleCorners as vehicleCorners2 } from "@adatechnology/game-vehicles-driving";
308
309
  import { colorFromSeed as colorFromSeed2, fleetDims as fleetDims2, installFleet, paintPalettes as paintPalettes2, paletteOf as paletteOf2 } from "@adatechnology/game-vehicles-fleet";
@@ -924,22 +925,13 @@ function createVehiclesTestModule(options = {}) {
924
925
  }
925
926
  helpersShown = boxKey();
926
927
  };
927
- const local = { m: null, v: null };
928
- const inside = (root, fp, x, z, radius) => {
929
- if (!three) return false;
930
- local.m ?? (local.m = new three.Matrix4());
931
- local.v ?? (local.v = new three.Vector3());
932
- root.updateWorldMatrix(true, false);
933
- const p = local.v.set(x, 0, z).applyMatrix4(local.m.copy(root.matrixWorld).invert());
934
- return p.x > fp.minX - radius && p.x < fp.maxX + radius && p.z > fp.minZ - radius && p.z < fp.maxZ + radius;
935
- };
928
+ const laneBlocked = footprintBlocker(
929
+ () => lane?.group,
930
+ () => lane ? { minX: -lane.car.width / 2, maxX: lane.car.width / 2, minZ: -lane.car.length / 2, maxZ: lane.car.length / 2 } : null
931
+ );
936
932
  const blocked = (x, z, radius) => {
937
- for (const entry of placed.values()) if (entry.root.parent && entry.footprint && inside(entry.root, entry.footprint, x, z, radius)) return true;
938
- if (lane) {
939
- const half = { l: lane.car.length / 2, w: lane.car.width / 2 };
940
- if (inside(lane.group, { minX: -half.w, maxX: half.w, minZ: -half.l, maxZ: half.l }, x, z, radius)) return true;
941
- }
942
- return false;
933
+ for (const entry of placed.values()) if (entry.footprint && footprintBlocker(entry.root, entry.footprint)(x, z, radius)) return true;
934
+ return laneBlocked(x, z, radius);
943
935
  };
944
936
  const clearLane = () => {
945
937
  stopEngine();
@@ -1104,6 +1096,7 @@ function createVehiclesTestModule(options = {}) {
1104
1096
  return {
1105
1097
  id: VEHICLES_AREA_ID,
1106
1098
  name: text.name,
1099
+ ground: { surface: "road" },
1107
1100
  group: text.group,
1108
1101
  get placed() {
1109
1102
  return placed;