@adatechnology/game-vehicles-three 0.3.1 → 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 +30 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +15 -0
- 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 = [
|
|
@@ -42838,6 +42854,7 @@ var GameVehiclesThree = (() => {
|
|
|
42838
42854
|
var LANE = { z: 11, from: -12, wall: 13 };
|
|
42839
42855
|
var MATERIAL_COLOURS = { metal: 13421772, glass: 4500223, rubber: 16750848, fuel: 16724736 };
|
|
42840
42856
|
var ZONE_COLOURS = { door: 5627221, hood: 14540083, lid: 14522675, bumper: 14505437, glass: 4500223, light: 16777215, wheel: 16742195 };
|
|
42857
|
+
var BODY_HEIGHT = 1.7;
|
|
42841
42858
|
function createVehiclesTestModule(options = {}) {
|
|
42842
42859
|
const locale = options.locale ?? "pt-BR";
|
|
42843
42860
|
const text = TEXT[locale] ?? TEXT["pt-BR"];
|
|
@@ -42969,6 +42986,7 @@ var GameVehiclesThree = (() => {
|
|
|
42969
42986
|
entry.root.updateMatrixWorld(true);
|
|
42970
42987
|
const inverse = new three.Matrix4().copy(entry.root.matrixWorld).invert();
|
|
42971
42988
|
const bounds = new three.Box3();
|
|
42989
|
+
const low = new three.Box3();
|
|
42972
42990
|
const piece = new three.Box3();
|
|
42973
42991
|
const matrix = new three.Matrix4();
|
|
42974
42992
|
entry.root.traverse((mesh2) => {
|
|
@@ -42978,9 +42996,11 @@ var GameVehiclesThree = (() => {
|
|
|
42978
42996
|
mesh2.geometry.computeBoundingBox();
|
|
42979
42997
|
piece.copy(mesh2.geometry.boundingBox).applyMatrix4(matrix.multiplyMatrices(inverse, mesh2.matrixWorld));
|
|
42980
42998
|
bounds.union(piece);
|
|
42999
|
+
if (piece.min.y < BODY_HEIGHT) low.union(piece);
|
|
42981
43000
|
});
|
|
42982
43001
|
const size = bounds.getSize(new three.Vector3());
|
|
42983
43002
|
entry.size = { length: size.z, width: size.x, height: size.y };
|
|
43003
|
+
if (!low.isEmpty()) entry.footprint = { minX: low.min.x, maxX: low.max.x, minZ: low.min.z, maxZ: low.max.z };
|
|
42984
43004
|
return entry.size;
|
|
42985
43005
|
};
|
|
42986
43006
|
const clearHelpers = () => {
|
|
@@ -43030,6 +43050,14 @@ var GameVehiclesThree = (() => {
|
|
|
43030
43050
|
}
|
|
43031
43051
|
helpersShown = boxKey();
|
|
43032
43052
|
};
|
|
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
|
+
);
|
|
43057
|
+
const blocked = (x, z, radius) => {
|
|
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);
|
|
43060
|
+
};
|
|
43033
43061
|
const clearLane = () => {
|
|
43034
43062
|
stopEngine();
|
|
43035
43063
|
if (!lane) return;
|
|
@@ -43250,10 +43278,12 @@ var GameVehiclesThree = (() => {
|
|
|
43250
43278
|
three = lent.THREE;
|
|
43251
43279
|
const stopChange = lent.bench?.onChange(onChange);
|
|
43252
43280
|
const stopFrame = lent.onFrame(frame);
|
|
43281
|
+
const stopBlocker = lent.addBlocker?.(blocked);
|
|
43253
43282
|
lent.audio?.register?.(LIBRARY_BANK);
|
|
43254
43283
|
return () => {
|
|
43255
43284
|
stopChange?.();
|
|
43256
43285
|
stopFrame();
|
|
43286
|
+
stopBlocker?.();
|
|
43257
43287
|
clearHelpers();
|
|
43258
43288
|
clearLane();
|
|
43259
43289
|
host = null;
|