From ee6318859e8cef0752163a97c9ad6883d622df56 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Sun, 24 May 2026 18:16:19 +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=2024/05/2026=2018:16:19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../three/DesktopFirstPersonControls.tsx | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/three/DesktopFirstPersonControls.tsx b/src/components/three/DesktopFirstPersonControls.tsx index ea15f3f..8002a14 100644 --- a/src/components/three/DesktopFirstPersonControls.tsx +++ b/src/components/three/DesktopFirstPersonControls.tsx @@ -130,14 +130,27 @@ export function DesktopFirstPersonControls() { camera.rotation.x = Math.max(-1.4, Math.min(1.4, camera.rotation.x)); } - // Gatilhos para controle de altura (RT sobe, LT desce) + // Suporta tanto o mapeamento de Triggers (RT/LT - botões 7/6) quanto de Grips/Bumpers (RB/LB - botões 5/4) para subir e descer a altura da câmera const triggerLT = gp.buttons[6]; const triggerRT = gp.buttons[7]; - if (triggerRT && triggerRT.value > 0.1) { - camera.position.y += triggerRT.value * speed; + const bumperLB = gp.buttons[4]; + const bumperRB = gp.buttons[5]; + + const valUp = Math.max( + triggerRT ? (triggerRT.value || (triggerRT.pressed ? 1 : 0)) : 0, + bumperRB ? (bumperRB.value || (bumperRB.pressed ? 1 : 0)) : 0 + ); + + const valDown = Math.max( + triggerLT ? (triggerLT.value || (triggerLT.pressed ? 1 : 0)) : 0, + bumperLB ? (bumperLB.value || (bumperLB.pressed ? 1 : 0)) : 0 + ); + + if (valUp > 0.1) { + camera.position.y += valUp * speed; } - if (triggerLT && triggerLT.value > 0.1) { - camera.position.y -= triggerLT.value * speed; + if (valDown > 0.1) { + camera.position.y -= valDown * speed; } }