PrimA - XForm (with rotation of 45 deg. on y-axis)
-PrimB - XForm (with translation of 0.5 on y-axis)
–Geometry - XForm (not transformation)
—Mesh - UsdMesh (a Box with size of 1 on all axis (-0.5 to 0.5)
Now I want the Boundingbox of PrimB in local space so I call ComputeLocalBound…
Perhaps I got something wrong, but the expected result should be -0.5 to 0.5 for X- and Z-axis and 0 to 1 on Y-axis.
But the result is:
min: {-0.70710678118654746, 0.0000000000000000, -0.70710678118654746}
max: {0.70710678118654746, 1.0000000000000000, 0.70710678118654746}
So the rotation from PrimA is still used. When removing the rotation on PrimA the result is as expected.
Can anybody explain why this happens and how I can get the bounds of a prim without the transformations from its parents?
My understanding (might be incorrect) is that local bounds still includes all parent transforms minus any translations.
It might be useful though to have a flag on the compute local bounds to exclude any parent transforms at all or a different convenience method to get what you want. I think it would be a good request to file as an issue on the github repo (assuming my understanding is correct)
The UsdGeomBBoxCache has logic in it that may seem unintuitive, but was based on Pixar pipeline experience getting sloppy bounds for years. In this case, what I think you maybe seeing is that all bboxes are placed (and importantly, combined, when computing aggregates) in an ancestor prim’s space. The space that we choose, if available is that of the closest containing “component” model, which gives us a tighter bound for the model as a whole, which is what we most often care about.
If there is no component model ancestor, it defaults to world space. If you fetch the raw range (rather than the alignedRange) from the BBox3d you get back, you’ll find the extent you’re expecting, whereas calling ComputeLocalBounds() and looking at range will still give transformed results.