Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -309,6 +309,40 @@ function ToolsTab(p: XRHudInWorldProps) {
|
|||||||
onClick={() => setScaleRatio(preset)} />
|
onClick={() => setScaleRatio(preset)} />
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
|
{/* Grid floor controls */}
|
||||||
|
<GridFloorRow />
|
||||||
|
</group>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GridFloorRow() {
|
||||||
|
const { camera } = useThree();
|
||||||
|
const gridY = useModelStore((s) => s.gridY);
|
||||||
|
const gridAutoFollow = useModelStore((s) => s.gridAutoFollow);
|
||||||
|
const setGridAutoFollow = useModelStore((s) => s.setGridAutoFollow);
|
||||||
|
const setGridY = useModelStore((s) => s.setGridY);
|
||||||
|
const nudgeGridY = useModelStore((s) => s.nudgeGridY);
|
||||||
|
const placeAtFloor = () => {
|
||||||
|
// Headset eye Y minus avg standing eye height (1.6 m)
|
||||||
|
const floor = camera.position.y - 1.6;
|
||||||
|
setGridY(floor);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<group>
|
||||||
|
<Text position={[-0.24, -0.15, 0]} fontSize={0.008} color="#94a3b8" anchorX="left">
|
||||||
|
Grid Y {(gridY * 1000).toFixed(0)}mm {gridAutoFollow ? '(auto)' : '(travado)'}
|
||||||
|
</Text>
|
||||||
|
<XR3DButton position={[-0.16, -0.175, 0]} size={[0.055, 0.022]} label="Auto"
|
||||||
|
active={gridAutoFollow} onClick={() => setGridAutoFollow(true)} />
|
||||||
|
<XR3DButton position={[-0.10, -0.175, 0]} size={[0.055, 0.022]} label="Travar"
|
||||||
|
active={!gridAutoFollow} onClick={() => setGridAutoFollow(false)} />
|
||||||
|
<XR3DButton position={[-0.04, -0.175, 0]} size={[0.04, 0.022]} label="−1cm"
|
||||||
|
onClick={() => nudgeGridY(-0.01)} />
|
||||||
|
<XR3DButton position={[0.005, -0.175, 0]} size={[0.04, 0.022]} label="+1cm"
|
||||||
|
onClick={() => nudgeGridY(0.01)} />
|
||||||
|
<XR3DButton position={[0.07, -0.175, 0]} size={[0.075, 0.022]} label="Pousar chão"
|
||||||
|
onClick={placeAtFloor} />
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user