GreasedLine bounding box

Hi everyone,

I’m trying to detect pointer events on a greased line. I’m expecting the bounding box to cover the whole textured area, but it turns out to actually only cover the median line. Is it by design?

Thank you!

Welcome abroad!
cc @roland

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:

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.


Thank you for your detailed answer.

I see, it’s really a simple line, like the one created with MeshBuilder.CreateLines, only it has custom shaders to render it with a width. It’s not some kind of polygon like I thought.

Since I only need single segments, I will use planes to draw rectangles, instead of GreasedLine, this way the pointer events will be handled as expected.

1 Like