diff --git a/src/components/three/XRHudInWorld.tsx b/src/components/three/XRHudInWorld.tsx index 4f94c9c..0d8f713 100644 --- a/src/components/three/XRHudInWorld.tsx +++ b/src/components/three/XRHudInWorld.tsx @@ -74,20 +74,32 @@ export function XRHudInWorld(props: XRHudInWorldProps) { const headLockRef = useRef(null); const targetPos = useRef(new THREE.Vector3()); const targetQuat = useRef(new THREE.Quaternion()); - const lastABtn = useRef(false); + const [showQuickMenu, setShowQuickMenu] = useState(true); + const lastXBtn = useRef(false); + const lastYBtn = useRef(false); /** Cached offset from controller to panel at drag start. */ const dragOffsetPos = useRef(new THREE.Vector3()); const dragOffsetQuat = useRef(new THREE.Quaternion()); const dragInitialized = useRef(false); useFrame(() => { - // Toggle via left A button (Quest Touch buttons[4]) const gp = leftCtrl?.inputSource?.gamepad; if (gp) { - const aBtn = gp.buttons[4]; - const pressed = !!aBtn?.pressed; - if (pressed && !lastABtn.current) setOpen(!open); - lastABtn.current = pressed; + // Toggle quick menu via left X button (Quest Touch buttons[4] on left controller) + const xBtn = gp.buttons[4]; + const pressedX = !!xBtn?.pressed; + if (pressedX && !lastXBtn.current) { + setShowQuickMenu((prev) => !prev); + } + lastXBtn.current = pressedX; + + // Toggle main HUD via left Y button (Quest Touch buttons[5] on left controller) + const yBtn = gp.buttons[5]; + const pressedY = !!yBtn?.pressed; + if (pressedY && !lastYBtn.current) { + setOpen(!open); + } + lastYBtn.current = pressedY; } // Floating panel: @@ -171,7 +183,7 @@ export function XRHudInWorld(props: XRHudInWorldProps) { <> setOpen(!open)} /> {/* Head-locked fallback: always-visible quick controls in lower-right of FOV */} - + { setOpen(!open); reanchorRequested.current = true; }}