Changes
Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user