Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-05-21 12:56:38 +00:00
parent 9ac4da7078
commit 4119e45d28
+12 -6
View File
@@ -186,17 +186,23 @@ export function XRControllerMeasure() {
}
});
// Construct the laser Line object once so we can attach via <primitive>
const laserObject = useRef<THREE.Line>();
if (!laserObject.current) {
laserObject.current = new THREE.Line(laserGeom.current, laserMat.current);
laserObject.current.frustumCulled = false;
laserObject.current.renderOrder = 999;
(laserRef as React.MutableRefObject<THREE.Line | null>).current = laserObject.current;
}
return (
<>
{/* eslint-disable-next-line react/no-unknown-property */}
<line ref={laserRef as any} frustumCulled={false}>
<primitive object={laserGeom.current} attach="geometry" />
<primitive object={laserMat.current} attach="material" />
</line>
<mesh ref={tipRef} frustumCulled={false}>
<primitive object={laserObject.current} />
<mesh ref={tipRef} frustumCulled={false} renderOrder={999}>
<sphereGeometry args={[1, 12, 12]} />
<meshBasicMaterial color="#22c55e" depthTest={false} transparent opacity={0.9} />
</mesh>
</>
);
}