I’ve searched in this forum and on google for any mention of BabylonJS and marquee selection, but there’s nothing I’ve found. I define marquee selection as when you drag with your mouse, and a transparent rectangle appears on the screen. Anything that touches the rectangle gets selected. I realize that BabylonJS doesn’t have any concept of selection, per se, just picking. I’ve got mesh picking working on mouse click like this:
var pickInfo = scene.pick(scene.pointerX, scene.pointerY);
if (pickInfo.hit) {
var currentMesh = pickInfo.pickedMesh;
}
I’m totally lost as to how I would translate that to a marquee selection. I guess I could draw a transparent GUI.Rectangle for the UI indication, but how would I go about picking in that rectangle as a whole? Maybe compare the rectangle to mesh bounding boxes?
Hey and welcome
Yeah I would do something like drawing the rectangle with GUI or HTML then take all meshes, project their bounding box and test intersection between projected rectangle and selection rectangle
Is there a way to cull meshes by what’s currently visible in the view?
This is already the case, you can check scene.getActiveMeshes()
Great, I’ll give that a shot then and post my results here once I get it working.