feat(editor): edit hierarchical map nodes

This commit is contained in:
Tom Boullay
2026-05-27 08:30:54 +02:00
parent ab100c683f
commit c2b16434fb
16 changed files with 740 additions and 64 deletions
+10
View File
@@ -57,6 +57,16 @@ export function useTerrainSnappedPosition(
}, [position, terrainHeight]);
}
export function getObjectBottomOffset(
object: THREE.Object3D,
scale: Vector3Tuple = [1, 1, 1],
): number {
const bounds = new THREE.Box3().setFromObject(object);
if (bounds.isEmpty()) return 0;
return -bounds.min.y * scale[1];
}
export function normalizeMapScale(scale: Vector3Tuple): Vector3Tuple {
const [x, y, z] = scale;
const isUniform = Math.abs(x - y) < 0.001 && Math.abs(x - z) < 0.001;