slab panel

This commit is contained in:
wass08
2026-02-02 11:17:47 +09:00
parent 0613f846ef
commit 72a0e3952a
6 changed files with 200 additions and 19 deletions
@@ -435,7 +435,7 @@ export class SpatialGridManager {
const slabMap = this.slabsByLevel.get(levelId)
if (!slabMap) return 0
let maxElevation = 0
let maxElevation = -Infinity
for (const slab of slabMap.values()) {
if (slab.polygon.length >= 3 && itemOverlapsPolygon(position, dimensions, rotation, slab.polygon, 0.01)) {
const elevation = slab.elevation ?? 0.05
@@ -444,7 +444,7 @@ export class SpatialGridManager {
}
}
}
return maxElevation
return maxElevation === -Infinity ? 0 : maxElevation
}
/**
@@ -151,6 +151,7 @@ export function generateExtrudedWall(
const wallStart: Point2D = { x: wallNode.start[0], y: wallNode.start[1] }
const wallEnd: Point2D = { x: wallNode.end[0], y: wallNode.end[1] }
// Wall height is adjusted by slab elevation (positive reduces, negative increases)
const height = (wallNode.height ?? 2.5) - slabElevation
const thickness = wallNode.thickness ?? 0.1
const halfT = thickness / 2
@@ -244,7 +245,8 @@ export function generateExtrudedWall(
// Rotate so extrusion direction (Z) becomes height direction (Y)
geometry.rotateX(-Math.PI / 2)
if (slabElevation > 0) {
// Translate by slab elevation (works for both positive and negative values)
if (slabElevation !== 0) {
geometry.translate(0, slabElevation, 0)
}
geometry.computeVertexNormals()