diff --git a/src/components/three/XRControllerMeasure.tsx b/src/components/three/XRControllerMeasure.tsx index ade2878..5ca495c 100644 --- a/src/components/three/XRControllerMeasure.tsx +++ b/src/components/three/XRControllerMeasure.tsx @@ -186,17 +186,23 @@ export function XRControllerMeasure() { } }); + // Construct the laser Line object once so we can attach via + const laserObject = useRef(); + if (!laserObject.current) { + laserObject.current = new THREE.Line(laserGeom.current, laserMat.current); + laserObject.current.frustumCulled = false; + laserObject.current.renderOrder = 999; + (laserRef as React.MutableRefObject).current = laserObject.current; + } + return ( <> - {/* eslint-disable-next-line react/no-unknown-property */} - - - - - + + ); } +