From 797fddb5a2bbaa4fa1f82a7d7c49ada3c143a6eb Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Tue, 4 Aug 2026 21:26:18 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20melhoria=20no=20s?= =?UTF-8?q?nap=20e=20medi=C3=A7=C3=A3o=20AR=20em=2004/08/2026=2021:26:18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lab/QuestCubeLab.tsx | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/lab/QuestCubeLab.tsx b/src/lab/QuestCubeLab.tsx index 0f0a80e..a333908 100644 --- a/src/lab/QuestCubeLab.tsx +++ b/src/lab/QuestCubeLab.tsx @@ -6,6 +6,7 @@ import { Grid, Environment, PerspectiveCamera, + Text } from "@react-three/drei"; import { XR, useXR } from "@react-three/xr"; import { xrStore as store } from "@/stores/useXRStore"; @@ -42,6 +43,35 @@ const CUBE_SIZE = 0.3; type AlignPhase = 'IDLE' | 'WAIT_SURFACE' | 'WAIT_FACE2' | 'WAIT_EDGE'; +// =================================================================== +// COMPONENTE: AR HUD Messages (Mostra avisos flutuantes apenas no óculos) +// =================================================================== +const ARHudMessages = ({ alignPhase }: { alignPhase: AlignPhase }) => { + const session = useXR((s) => s.session); + if (!session) return null; + + let msg = ''; + if (alignPhase === 'IDLE') msg = 'Livre! Clique na face do cubo para iniciar.'; + else if (alignPhase === 'WAIT_SURFACE') msg = 'Face gravada! Clique na mesa para apoiar.'; + else if (alignPhase === 'WAIT_FACE2') msg = 'Apoiado! Clique noutra face do cubo.'; + else if (alignPhase === 'WAIT_EDGE') msg = 'Ultimo passo! Clique na borda da mesa.'; + + return ( + + + {msg} + + + ); +}; + // =================================================================== // COMPONENTE: CuboControlado // =================================================================== @@ -174,10 +204,10 @@ const CubeControlado = ({ allowScale={false} lockedActive={lockedRef.current} onSync={(deltaPos, deltaQuat, deltaScale) => { - // Matriz atual do cubo + // Matriz atual do cubo (IMPORTANTE: mesh default usa ordem XYZ) const mMesh = new THREE.Matrix4().compose( new THREE.Vector3(posRef.current.x, posRef.current.y, posRef.current.z), - new THREE.Quaternion().setFromEuler(new THREE.Euler(rotRef.current.x, rotRef.current.y, rotRef.current.z, 'YXZ')), + new THREE.Quaternion().setFromEuler(new THREE.Euler(rotRef.current.x, rotRef.current.y, rotRef.current.z, 'XYZ')), new THREE.Vector3(scaleRef.current, scaleRef.current, scaleRef.current) ); @@ -193,10 +223,10 @@ const CubeControlado = ({ mCombined.decompose(finalPos, finalQuat, finalScale); posRef.current.x = finalPos.x; - posRef.current.y = Math.max(0.5, finalPos.y); + posRef.current.y = Math.max(0.15, finalPos.y); posRef.current.z = finalPos.z; - const euler = new THREE.Euler().setFromQuaternion(finalQuat, 'YXZ'); + const euler = new THREE.Euler().setFromQuaternion(finalQuat, 'XYZ'); rotRef.current.x = euler.x; rotRef.current.y = euler.y; rotRef.current.z = euler.z; @@ -509,6 +539,8 @@ const QuestCubeLab = () => { onEdgeClick={handleEdgeClick} /> + +