I have an animated mesh and it seems like the animation is messing with the bounding box calculation.
When I create a bounding box using
getHierarchyBoundingVectors’, the output min/max values translates into a much larger box than what
showBoundingBox is showing.
The animated properties are position, rotationQuaternion and visibility. It seems the rotation animation is what messes things up.
I got a workaround going where I create dummy TransformNodes using the min/max as positions and parent them to the animated mesh before the animation gets applied. That way I can get the bounding box by taking the absolute position of these nodes once the animation is applied.
I wonder if there is a proper way do deal with it?
It would be easier to properly explain (and find a better solution) with a Playground.
That said, BVH is an approximation ontop of another approximation. Adding a rotation and then computing an AABB is also an approximation. It’s a tradeoff between fast computation and return on investment of CPU cycles. Splitting a hierarchy can help having smaller volumes but you have more volumes to check. Can you explain your use case here?
I am using the bounding box of a mesh to zoom in on it to the correct extent, using
By the getBoundingInfo documentation:
Note that it returns a shallow bounding of the mesh (i.e. it does not include children).
To get the full bounding of all children, call
So indeed the results of showBoundingBox and getHierarchy can be different if the mesh has children