diff --git a/src/pages/XRSession.tsx b/src/pages/XRSession.tsx index 85615f6..0803f8e 100644 --- a/src/pages/XRSession.tsx +++ b/src/pages/XRSession.tsx @@ -29,19 +29,37 @@ if (navigator.xr) { }); } +// Lê flags de feature WebXR do localStorage (default: todas ON). +// O usuário liga/desliga pelo HUD AR (aba WebXR) para diagnosticar qual +// feature ativa o grid de segurança do Quest. Mudanças exigem sair e re-entrar do AR. +function loadXRFeatures() { + const defaults = { + handTracking: true, planeDetection: true, hitTest: true, domOverlay: true, + anchors: true, meshDetection: true, depthSensing: true, layers: true, + bodyTracking: true, lightEstimation: true, + }; + try { + const raw = localStorage.getItem('xrFeatures'); + if (raw) return { ...defaults, ...JSON.parse(raw) }; + } catch {} + return defaults; +} +const _xrf = loadXRFeatures(); +console.log('[XR] Features:', _xrf); + const store = createXRStore({ hand: { left: true, right: true }, controller: { left: true, right: true }, - // Audit de features WebXR — pedimos só o que o app usa, para reduzir - // gatilhos do Space Sense / Guardian do Quest (grid vermelho/azul perto - // de paredes e objetos). Mantemos hit-test, plane-detection e hand-tracking; - // desligamos anchors, mesh-detection, depth-sensing e layers que não usamos. - anchors: false, - meshDetection: false, - depthSensing: false, - layers: false, - bodyTracking: false, - // handTracking, planeDetection, hitTest, domOverlay ficam no default (true) + handTracking: _xrf.handTracking, + planeDetection: _xrf.planeDetection, + hitTest: _xrf.hitTest, + domOverlay: _xrf.domOverlay, + anchors: _xrf.anchors, + meshDetection: _xrf.meshDetection, + depthSensing: _xrf.depthSensing, + layers: _xrf.layers, + bodyTracking: _xrf.bodyTracking, + lightEstimation: _xrf.lightEstimation, }); // ─── XRModel ───────────────────────────────────────────