showBoundingBox not actually representative of the bounding box

A bounding box should be aligned with the axes of the world, but the “showBoundingBox” property is showing a rotated wireframe on this example:

I marked with spheres where the actual bounding box corners are, and the wireframe doesn’t match this.

I might be wrong in my understanding of showBoundingBox, but the current implementation isn’t helpful I don’t think.

The bounding box is aligned with the axes of the local space of the mesh.

If you update your mesh (change position / scale / rotation), the bounding box will be updated accordingly when displayed.

Why wouldn’t the bounding box match the result of baseMesh.getBoundingInfo() though? As far as I know there’s no such thing as a local getBoundingInfo that would go along with the local bounding box.

What doesn’t match?
Which values are you comparing?
Maybe you just need to use mesh.refreshBoundingInfo(); first
:slight_smile:

1 Like

https://playground.babylonjs.com/#V7LEAQ#1

I tried what you suggested, and it’s not showing a box with spheres at the corners.
I would expect the bounding box to be a world-oriented box the size of the two spheres placed in the world. Right now the the showBoundingBox property doesn’t match getBoundingInfo() returns.

It actually matches, the BB is by default local to the mesh and you display the min and max of world coordinates which is AABB in world space.