What is the reason for larger box in the setFromObject method?

There is some strange thing in the way how the setFromObject method works. What is a reason to not have the strict box size here?
From documentation:

Computes the world-axis-aligned bounding box of an Object3D (including its children), accounting for the object’s, and children’s, world transforms. The function may result in a larger box than strictly necessary.

The function may result in a larger box than strictly necessary. - Really? May result and may not result as we wish… Is it depend on the weather outside?

image

Ok. If you came here to find the answer to a similar question, here it is:

Instead of recomputing the bounding box every time, we now use the
cached bounding box from the object, and transform it by the world
transform.

Note that this results in slightly less accurate bounding box compared
to the previous implementation. This seems like a fair tradeoff -
it’s possible to get the precise box by using Box3.setFromBufferAttribute
if desired.

In addition to making the box more precise, this honors morph target
data and supports arbitrary future improvements to object bounding box
computation automatically.

1 Like