Jump to content

getHierarchyBoundBox behaviour (2.13)


photo

Recommended Posts

According to the documentation, Node::getHierarchyBoundBox should return a bounding box taking all children into account. But is it also guaranteed that this is the smallest possible axis aligned bounding box to fit all children, or is it possible the bounding box is in fact larger? We have a .node file that is roughly 40x200 meters in size, but the bounding box returned by this function is 70x400 meters instead. Before debugging into what would cause this I want to make sure this isn't defined behaviour, for example that the BB always extends in both directions (it actually goes from -200 to 200 along the x-axis in our case, while the node itself goes from 0 to 200, so the centre of the BB should be at x=100 in this case but is in fact at x=0).

Edited by Bemined
Link to comment

Bemined

Generally speaking it can be bigger than a minimal (depending on the objects type itself). For example, if you have mesh that moved from the origin point (or rotated) it will be bigger.

We are using simple AABB algorithm (not OBB):

image.png

BoundsBox can only guarantee that object (node) is located inside the calculated bounds. If you need to get a precise calculations you can use Shapes to represent the object's form.

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Actually the node in question is perfectly rectangular so that should not be an issue. In fact it's the reason we use getHierarchyBoundBox since it returns the BB in local space, most objects are axis aligned in local space but can be rotated when placed in the world, so we get the local space AABB and then apply world transform of the root node to make it into an OBB ourselves.

However, for some nodes that are composed of child nodes with relative transform to the root node the hierarchy AABB is wrong. It appears like it does not apply the relative transform of child nodes correctly. Looking at the editor one of the child nodes has a position of (-200, 0, 0) relative to the root node, but this does not seem to be applied to the BB:

HierarchyBoundBox1.jpg.631cc9e0df2005e647f5a89ac1630f93.jpg

As a second test, I moved some of the child nodes to the side, and they actually ended outside the bounding box when I checked in-game, so this seems to confirm the relative offset of child nodes is not applied correctly:

HierarchyBoundBox2.jpg.3cffcd9f7927d5dda58f0346c753b948.jpg

 

Link to comment
×
×
  • Create New...