@adatechnology/game-vehicles-three 0.3.2 → 0.3.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.
- package/dist/index.global.js +22 -15
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +7 -15
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.global.js
CHANGED
|
@@ -118,6 +118,22 @@ var GameVehiclesThree = (() => {
|
|
|
118
118
|
node.userData[KIT_ORIGIN_KEY] = { ...origin };
|
|
119
119
|
return object2;
|
|
120
120
|
}
|
|
121
|
+
function footprintBlocker(object2, footprint) {
|
|
122
|
+
return (x, z, radius) => {
|
|
123
|
+
const o = typeof object2 === "function" ? object2() : object2;
|
|
124
|
+
const fp = typeof footprint === "function" ? footprint() : footprint;
|
|
125
|
+
if (!o || !fp || !o.parent) return false;
|
|
126
|
+
o.updateWorldMatrix?.(true, false);
|
|
127
|
+
const e = o.matrixWorld.elements;
|
|
128
|
+
const dx = x - e[12];
|
|
129
|
+
const dz = z - e[14];
|
|
130
|
+
const ax = e[0] ** 2 + e[1] ** 2 + e[2] ** 2;
|
|
131
|
+
const az = e[8] ** 2 + e[9] ** 2 + e[10] ** 2;
|
|
132
|
+
const lx = (dx * e[0] + dz * e[2]) / (ax || 1);
|
|
133
|
+
const lz = (dx * e[8] + dz * e[10]) / (az || 1);
|
|
134
|
+
return lx > fp.minX - radius && lx < fp.maxX + radius && lz > fp.minZ - radius && lz < fp.maxZ + radius;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
121
137
|
|
|
122
138
|
// ../game-vehicles-fleet/dist/index.js
|
|
123
139
|
var military = [
|
|
@@ -43034,22 +43050,13 @@ var GameVehiclesThree = (() => {
|
|
|
43034
43050
|
}
|
|
43035
43051
|
helpersShown = boxKey();
|
|
43036
43052
|
};
|
|
43037
|
-
const
|
|
43038
|
-
|
|
43039
|
-
|
|
43040
|
-
|
|
43041
|
-
local.v ?? (local.v = new three.Vector3());
|
|
43042
|
-
root.updateWorldMatrix(true, false);
|
|
43043
|
-
const p = local.v.set(x, 0, z).applyMatrix4(local.m.copy(root.matrixWorld).invert());
|
|
43044
|
-
return p.x > fp.minX - radius && p.x < fp.maxX + radius && p.z > fp.minZ - radius && p.z < fp.maxZ + radius;
|
|
43045
|
-
};
|
|
43053
|
+
const laneBlocked = footprintBlocker(
|
|
43054
|
+
() => lane?.group,
|
|
43055
|
+
() => lane ? { minX: -lane.car.width / 2, maxX: lane.car.width / 2, minZ: -lane.car.length / 2, maxZ: lane.car.length / 2 } : null
|
|
43056
|
+
);
|
|
43046
43057
|
const blocked = (x, z, radius) => {
|
|
43047
|
-
for (const entry of placed.values()) if (entry.
|
|
43048
|
-
|
|
43049
|
-
const half = { l: lane.car.length / 2, w: lane.car.width / 2 };
|
|
43050
|
-
if (inside(lane.group, { minX: -half.w, maxX: half.w, minZ: -half.l, maxZ: half.l }, x, z, radius)) return true;
|
|
43051
|
-
}
|
|
43052
|
-
return false;
|
|
43058
|
+
for (const entry of placed.values()) if (entry.footprint && footprintBlocker(entry.root, entry.footprint)(x, z, radius)) return true;
|
|
43059
|
+
return laneBlocked(x, z, radius);
|
|
43053
43060
|
};
|
|
43054
43061
|
const clearLane = () => {
|
|
43055
43062
|
stopEngine();
|