roland
January 15, 2024, 11:44am
3
Welcome @NitnerocL !
The vertices are repositioned by the GPU vertex shader according to the width of the line at a given point. Therefore it’s not possible to get the right bounding information of the line.
If you want to know whether the pointer is over the mouse you can use a Ray
and check for intersections:
/**
* Checks whether a ray is intersecting this GreasedLineMesh
* @param ray ray to check the intersection of this mesh with
* @param fastCheck not supported
* @param trianglePredicate not supported
* @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)
* @param worldToUse not supported
* @param skipBoundingInfo a boolean indicating if we should skip the bounding info check
* @returns the picking info
*/
public intersects(
ray: Ray,
fastCheck?: boolean,
trianglePredicate?: TrianglePickingPredicate,
onlyBoundingInfo = false,
worldToUse?: Matrix,
skipBoundingInfo = false
): PickingInfo {
const pickingInfo = new PickingInfo();
const intersections = this.findAllIntersections(ray, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo, true);
if (intersections?.length === 1) {
* Gets all intersections of a ray and the line
* @param ray Ray to check the intersection of this mesh with
* @param _fastCheck not supported
* @param _trianglePredicate not supported
* @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)
* @param _worldToUse not supported
* @param skipBoundingInfo a boolean indicating if we should skip the bounding info check
* @param firstOnly If true, the first and only intersection is immediatelly returned if found
* @returns intersection(s)
*/
public findAllIntersections(
ray: Ray,
_fastCheck?: boolean,
_trianglePredicate?: TrianglePickingPredicate,
onlyBoundingInfo = false,
_worldToUse?: Matrix,
skipBoundingInfo = false,
firstOnly = false
): { distance: number; point: Vector3 }[] | undefined {
if (onlyBoundingInfo && !skipBoundingInfo && ray.intersectsSphere(this._boundingSphere, this.intersectionThreshold) === false) {
return;
Please be aware of the intersectionTreshold
property of the line:
Boundig box with a segmented line (not 100% accurate - width
not taken into account)
Feel free to ask in case you have any further questions.