🚀 Auto-deploy: melhoria no snap e medição AR em 22/05/2026 20:41:05
This commit is contained in:
@@ -16,6 +16,15 @@ const TRIG_OFF = 0.3;
|
|||||||
const BTN_ON = 0.6;
|
const BTN_ON = 0.6;
|
||||||
const MAX_RAY = 10; // meters
|
const MAX_RAY = 10; // meters
|
||||||
|
|
||||||
|
function isPickableModelMesh(o: THREE.Object3D): boolean {
|
||||||
|
let cur: THREE.Object3D | null = o;
|
||||||
|
while (cur) {
|
||||||
|
if (cur.userData?.modelId) return true;
|
||||||
|
cur = cur.parent;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Right-controller trigger driven measurement for AR.
|
* Right-controller trigger driven measurement for AR.
|
||||||
*
|
*
|
||||||
@@ -119,7 +128,7 @@ export function XRControllerMeasure() {
|
|||||||
const hits = raycaster.current.intersectObjects(scene.children, true);
|
const hits = raycaster.current.intersectObjects(scene.children, true);
|
||||||
const hit = hits.find((h) => {
|
const hit = hits.find((h) => {
|
||||||
const o = h.object;
|
const o = h.object;
|
||||||
if (!(o instanceof THREE.Mesh)) return false;
|
if (!isPickableModelMesh(o)) return false;
|
||||||
if (o.userData.__edgeLine) return false;
|
if (o.userData.__edgeLine) return false;
|
||||||
if (o.geometry instanceof THREE.SphereGeometry) return false;
|
if (o.geometry instanceof THREE.SphereGeometry) return false;
|
||||||
if (o.geometry instanceof THREE.RingGeometry) return false;
|
if (o.geometry instanceof THREE.RingGeometry) return false;
|
||||||
@@ -235,6 +244,8 @@ export function XRControllerMeasure() {
|
|||||||
const factor = strongSnap ? 0.030 : 0.012;
|
const factor = strongSnap ? 0.030 : 0.012;
|
||||||
const s = Math.max(strongSnap ? 0.010 : 0.004, dist * factor);
|
const s = Math.max(strongSnap ? 0.010 : 0.004, dist * factor);
|
||||||
tipRef.current.scale.setScalar(s);
|
tipRef.current.scale.setScalar(s);
|
||||||
|
} else {
|
||||||
|
tipRef.current.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user