From aca3cede7c827b267db57b77d5f470e4530a9aaf Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Tue, 4 Aug 2026 20:11:57 +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=2020:11:57?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lab/QuestCubeLab.tsx | 73 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/lab/QuestCubeLab.tsx b/src/lab/QuestCubeLab.tsx index c616101..759f2f2 100644 --- a/src/lab/QuestCubeLab.tsx +++ b/src/lab/QuestCubeLab.tsx @@ -7,6 +7,7 @@ import { Environment, PerspectiveCamera, } from "@react-three/drei"; +import { XR, createXRStore } from "@react-three/xr"; import * as THREE from "three"; import { Beaker, @@ -38,6 +39,10 @@ const CUBE_SIZE = 1; type AlignPhase = 'IDLE' | 'WAIT_SURFACE' | 'WAIT_FACE2' | 'WAIT_EDGE'; +const store = createXRStore({ + controller: { left: true, right: true }, +}); + // =================================================================== // COMPONENTE: CuboControlado // =================================================================== @@ -274,16 +279,8 @@ const QuestCubeLab = () => { setAlignPhase('IDLE'); }; - const enterXR = async () => { - try { - const xr = (navigator as Navigator & { xr?: { requestSession: (mode: string) => Promise } })?.xr; - if (!xr) return; - const session = await xr.requestSession("immersive-ar"); - void session; - alert("XR session requisitada."); - } catch (e) { - alert("Falha ao entrar em XR: " + (e as Error).message); - } + const enterXR = () => { + store.enterAR(); }; const handleSurfaceClick = (point: THREE.Vector3, normal: THREE.Vector3) => { @@ -415,34 +412,36 @@ const QuestCubeLab = () => {
- - - - - - - + + + + + + + +
- - - - - - - + + + + + + + +