From 99ddbe793a0f454ccfc019d51a26f2e0b7021513 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 20:50:15 +0000 Subject: [PATCH] Changes Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com> --- src/components/three/ModelViewer.tsx | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/components/three/ModelViewer.tsx b/src/components/three/ModelViewer.tsx index e2d08c6..8725376 100644 --- a/src/components/three/ModelViewer.tsx +++ b/src/components/three/ModelViewer.tsx @@ -123,22 +123,33 @@ function GLBModel({ sceneModel, isActive }: { sceneModel: SceneModel; isActive: if (!sceneModel.visible) return null; + // Determine dominant local axis of the model (longest bbox side) for axial roll + const dominantAxis: 'x' | 'y' | 'z' = + modelInfo.size.x >= modelInfo.size.y && modelInfo.size.x >= modelInfo.size.z + ? 'x' + : modelInfo.size.y >= modelInfo.size.z + ? 'y' + : 'z'; + return ( { e.stopPropagation(); setActive(sceneModel.id); }} + userData={{ modelId: sceneModel.id, dominantAxis }} > - - + {/* Translation */} + + {/* Rotation + scale around the geometry center */} + + {/* Shift geometry so its center sits at the parent's origin (pivot = center) */} + + + + );