BoundingBox position does not align properly

Hi,
not sure if the following behaviour is a bug or just a footgun. See the linked PG - click the mesh, and move it around using the Move Gizmo. At that moment the bounding box will start being misaligned.

When I enable boundingBoxGizmoEnabled, it follows the mesh properly, so I would assume computing the correct position of BoundingBox should be possible, otherwise even this gizmo would be misaligned.

As close as possible to original playground: https://playground.babylonjs.com/#V9SMM9#1 (bbox lags behind a frame or so)

If you allow some re-organisation: https://playground.babylonjs.com/#V9SMM9#2

thank you

Just a note - the solution in #2 was what I initially started with, but the bounding box does not work as needed with more complex models (see link below), hence the complexity.

Do you mean to switch bboxes around depending on what was clicked (see below)? Or the other way: 1 bbox for all? Then you need a data structure (i.e. pickedMesh belongs to object tree) and calculate the combined bounding boxes. Hm, I could have sworn there is a method like “getCombinedBoundinbBoxes” or so. Could not find it though. Then just iterate over the mesh group, get individual bounding boxes and make a new box from the smallest min and largest max.

Argh, it won’t let me save the playground. Had to make a screenshot:

Hey @Joe_Kerr still looking for help on this ? @RaananW is looking into it to be sure we can save the PG

Sorry for late response, I forgot about this thread.

Hm, I could have sworn there is a method like “getCombinedBoundinbBoxes” or so

That’s most likely getHierarchyBoundingVectors(), right? It’s the first thing I tried, but at that time I didnt know about refreshBoundingInfo() yet. So just these two methods together solve it quite elegantly:

1 Like

No not really, do not worry. Probably just a temporary server hiccup. I should have copy&pasted the code (text) though not a screenshot :face_with_spiral_eyes:

1 Like