🚀 Auto-deploy: melhoria no snap e medição AR em 02/06/2026 21:35:17
This commit is contained in:
@@ -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<THREE.Line>(null);
|
||||
const lineGeomRef = useRef<THREE.BufferGeometry>(null);
|
||||
const reticleRef = useRef<THREE.Mesh>(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 */}
|
||||
<line ref={arcLineRef as any} visible={false}>
|
||||
<bufferGeometry ref={lineGeomRef} />
|
||||
<lineBasicMaterial color="#06b6d4" linewidth={3.5} transparent opacity={0.8} />
|
||||
</line>
|
||||
<primitive object={arcLine} />
|
||||
|
||||
{/* Retículo de pouso */}
|
||||
<mesh ref={reticleRef} visible={false} rotation={[-Math.PI / 2, 0, 0]}>
|
||||
|
||||
Reference in New Issue
Block a user