fix attach items

This commit is contained in:
wass08
2026-01-29 07:17:25 +09:00
parent 2f0e976878
commit 10ef50f186
3 changed files with 84 additions and 21 deletions
@@ -24,14 +24,13 @@ export const ItemSystem = () => {
const mesh = sceneRegistry.nodes.get(id) as THREE.Object3D
if (!mesh) return
if (item.asset.attachTo === 'wall-side') {
// Wall-attached item: offset Z by half the parent wall's thickness
const parentWall = item.parentId ? nodes[item.parentId as AnyNodeId] : undefined
if (parentWall && parentWall.type === 'wall') {
const wallThickness = (parentWall as WallNode).thickness ?? 0.1
const side = item.side === 'front' ? 1 : -1
mesh.position.z = (wallThickness / 2) * side
mesh.position.z = (wallThickness / 2) * side;
}
} else if (!item.asset.attachTo) {
// Floor item: elevate by slab height (using full footprint overlap)
@@ -37,7 +37,6 @@ export const WallSystem = () => {
const levelId = node.parentId
if (!levelId) return
if (!dirtyWallsByLevel.has(levelId)) {
dirtyWallsByLevel.set(levelId, new Set())
}
@@ -117,7 +116,6 @@ function updateWallGeometry(wallId: string, miterData: WallMiterData) {
mesh.geometry.dispose()
mesh.geometry = newGeo
// Update collision mesh
const collisionMesh = mesh.getObjectByName('collision-mesh') as THREE.Mesh
if (collisionMesh) {