Fix height

This commit is contained in:
Халимов Рустам
2026-01-12 21:26:38 +03:00
parent 531b5dc0b1
commit aaff0d06df

View File

@@ -318,6 +318,9 @@ export const createBinGeometry = (
const lengthRatio = pMax - pMin;
const midRatio = pMin + (lengthRatio / 2);
// FIX: Subtract thickness because partitions sit ON TOP of the floor
const effectiveHeight = Math.max(0.1, p.height - thickness);
// --- PERFORATED LOGIC FOR PARTITIONS ---
// If enabled, use Plate. Else use Extrude Solid.
const usePerf = perforation && perforation.enabled;
@@ -334,7 +337,7 @@ export const createBinGeometry = (
pY = (-innerDepth / 2) + (innerDepth * midRatio); // Center of partition
// Create Plate (Length, Height)
const plate = createPerforatedPlate(pLen, p.height, thickness, perforation!);
const plate = createPerforatedPlate(pLen, effectiveHeight, thickness, perforation!);
plate.translate(-pLen / 2, 0, 0); // Center X
// Rotate to align with Depth (along Z)
@@ -352,7 +355,7 @@ export const createBinGeometry = (
pX = (-innerWidth / 2) + (innerWidth * midRatio);
pY = (-innerDepth / 2) + (innerDepth * p.offset);
const plate = createPerforatedPlate(pLen, p.height, thickness, perforation!);
const plate = createPerforatedPlate(pLen, effectiveHeight, thickness, perforation!);
plate.translate(-pLen / 2, 0, 0); // Center X
// Already aligned with X. Thickness along Z.
@@ -381,7 +384,7 @@ export const createBinGeometry = (
}
const partShape = createRoundedRectShape(pWidth, pDepth, 0.1);
const partGeo = new THREE.ExtrudeGeometry(partShape, { depth: p.height, bevelEnabled: false });
const partGeo = new THREE.ExtrudeGeometry(partShape, { depth: effectiveHeight, bevelEnabled: false });
partGeo.rotateX(-Math.PI / 2);
partGeo.translate(pX, thickness, pY);
geometries.push(partGeo);
@@ -409,8 +412,9 @@ export const createBinGeometry = (
const hEnd = Math.min(p.height, getNeighborHeight(pMax));
const addFillet = (x: number, y: number, rotY: number, h: number) => {
if (h <= 1) return;
const geo = new THREE.ExtrudeGeometry(filletShape, { depth: h, bevelEnabled: false });
const hEff = Math.max(0.1, h - thickness);
if (hEff <= 1) return;
const geo = new THREE.ExtrudeGeometry(filletShape, { depth: hEff, bevelEnabled: false });
geo.rotateX(-Math.PI / 2);
geo.rotateY(rotY);
geo.translate(x, thickness, y);