3d selection / volume selection on the part of the mesh

Hello everyone!
Is there any way to implement volumetric selection?
e.q. I got a mesh that presents car and I want to put cuboid/box on one od the car mirror’s. So I could match this cuboid to this mirror.

My idea is to make a bounding box “in the air” and just match it with the element that I want to “cover”. Then I can calculate the approximate volume or whatever I want. What do you think about it? Is there any better way to do this?

Hi @Symlis

You can use picking to do the selection. See this documentation for more infos : Raycasts - Babylon.js Documentation

Hello @Cedric,
It wont work in my case cus I got meshes that are randomly created. I mean my object is made out of the e.q. 40 meshes and it’s not like one meshs represents car mirror or car seat.

I need to cover with bounding box area that could be made out of the 3-4 different meshes and not all meshes but only part of it.

My object is being made out of the 200-300 camera photos and some program make 3d model from it.

I’m not sure to follow :smiley:

Do you want to make random volumes and then shrink down those volumes so they fit a mesh?

If I understand you correctly, you want to select a volume of triangles or vertices of some meshes, and then create a bounding box based on this collective volume?

@Raggar correct!

Or to make bounding box first - and count volume of meshes which are in this bounding box

Hmm. You can do it using the vertices this way: Babylon.js Playground

2 Likes

@Raggar this is amazing, just what I needed!

So now I just have to count volume from bounding box right? Or is there any way to count volume from the vertices?

edit
https://www.quora.com/Can-I-calculate-the-volume-of-any-shape-if-we-know-the-XYZ-coordinates-of-its-vertices-If-so-what-is-the-theory-behind-it
I read that having only the xyz points is not enough to calculate the volume. But maybe bayblon implements some tool to count it?

Unfortunately not something I am familiar with, or know how to do.

1 Like

@Raggar, your solution works very well but I occurred one thing that I think is a tricky thing to implement.
Maybe you know if it’s doable to add the same rotation of volumetricPicker (transparent box) to the bounding box that’s being created from vertices.

So the grey box would be in the same position as the transparent one