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}
/>
+
+