diff --git a/src/components/three/ControllerLocomotion.tsx b/src/components/three/ControllerLocomotion.tsx index 40e29ff..7855fd1 100644 --- a/src/components/three/ControllerLocomotion.tsx +++ b/src/components/three/ControllerLocomotion.tsx @@ -30,9 +30,19 @@ export function ControllerLocomotion({ rigRef }: Props) { const fwdPushed = useRef(false); const raycaster = useRef(new THREE.Raycaster()); + const [arcLine] = useState(() => { + const geom = new THREE.BufferGeometry(); + const mat = new THREE.LineBasicMaterial({ + color: '#06b6d4', + transparent: true, + opacity: 0.8, + }); + const line = new THREE.Line(geom, mat); + line.visible = false; + return line; + }); + // Refs visuais - const arcLineRef = useRef(null); - const lineGeomRef = useRef(null); const reticleRef = useRef(null); // Estados temporários do teletransporte @@ -42,7 +52,7 @@ export function ControllerLocomotion({ rigRef }: Props) { useFrame((_state, _dt, frame: XRFrame | undefined) => { const rig = rigRef.current; if (!rig || !session || !frame) { - if (arcLineRef.current) arcLineRef.current.visible = false; + arcLine.visible = false; if (reticleRef.current) reticleRef.current.visible = false; return; } @@ -146,12 +156,10 @@ export function ControllerLocomotion({ rigRef }: Props) { lastTeleportHitModel.current = hitModel; // Atualiza a geometria do arco - if (lineGeomRef.current && arcLineRef.current) { - lineGeomRef.current.setFromPoints(points); - lineGeomRef.current.attributes.position.needsUpdate = true; - lineGeomRef.current.computeBoundingSphere(); - arcLineRef.current.visible = true; - } + arcLine.geometry.setFromPoints(points); + arcLine.geometry.attributes.position.needsUpdate = true; + arcLine.geometry.computeBoundingSphere(); + arcLine.visible = true; // Atualiza o retículo if (reticleRef.current) { @@ -200,7 +208,7 @@ export function ControllerLocomotion({ rigRef }: Props) { } // Oculta feixe e retículo - if (arcLineRef.current) arcLineRef.current.visible = false; + arcLine.visible = false; if (reticleRef.current) reticleRef.current.visible = false; } }); @@ -208,10 +216,7 @@ export function ControllerLocomotion({ rigRef }: Props) { return ( <> {/* Arco parabólico premium */} - - - - + {/* Retículo de pouso */}