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) */} + + + + );