Add heuristics for line threshold during ray casting.

This commit is contained in:
kovacsv 2023-10-25 21:37:04 +02:00
parent 0319fd4b32
commit f83d5f02f5

View File

@ -301,7 +301,12 @@ export class ViewerMainModel
} }
let raycaster = new THREE.Raycaster (); let raycaster = new THREE.Raycaster ();
raycaster.params.Line.threshold = 0.1; if (this.hasLines) {
let boundingSphere = this.GetBoundingSphere (() => {
return true;
});
raycaster.params.Line.threshold = boundingSphere.radius / 100.0;
}
let mousePos = new THREE.Vector2 (); let mousePos = new THREE.Vector2 ();
mousePos.x = (mouseCoords.x / width) * 2 - 1; mousePos.x = (mouseCoords.x / width) * 2 - 1;