Detect Connected Meshes

Does anyone know any logic of detecting connected meshes.

What I mean is that if I have a house GLTF model, each wall is its own mesh. How can i detect if one wall is connected to the other wall.

Simple - it’s not, in 100% of cases :sweat_smile: Meshes are always separated. If you’d assume overlapping means being connected - does a chair / table become connected to a wall if it gets close enough?

For walls-kind-of-connections-and-intersections, it’s best to define that in data and render walls based on data - instead of trying to determine wall connections based on 3D world.

2 Likes

If you cannot add metadata about connections in the model, you have to do it by analyzing the meshes - but this is just a last resort.

  • if you are sure that the objects are parallel to global axes ad they are box-shaped, you can use their bounding boxes to check for overlapping; this is fast and easy operation
  • if the objects can be rotated or are not shaped like boxes, you can use physics engine (that can check for collision) or a CSG engine (that can check intersections)

so for the bounding box method, id have to iterate through all the meshes, and for each mesh i will give it the whole model so that it can iterate through all the other meshes to see if the bounding boxes are very close together?

So i figured something out, i think its working.

So for the walls, i iterate through all the walls.
For each wall, i get the boundingBox min and max. so that I can iterate through the other wall geometry poiints and see if there is a point that is close to the min and max points.

If there is, this means that it is connected.