I am using Get componant Bounds node to find the area of a standard/engine cube (which has been stretched to define spawn areas) - However they do not appear to be correct. The extents are seemingly not aligning/in rotation with the cube correctly so returning a much bigger area than they should.
I have used a debug box here plugged into the extents to show the areas. The purple shapes are the scaled cubes
How would I get a more accurate bounds aligned to the actual componant?
The box bounds are always an Axis-Aligned Bounding Box (AABB) so the shape that is drawn is in fact correct and expected.
AABBs are commonly used in game engines for performance reasons, but as the name suggests they are never rotated and always aligned with the world axes so depending on the orientation of the object they can cover a much larger area than the object itself.
What you are probably looking for is an Oriented Bounding Box (OBB) but I don’t think there’s a built-in Blueprint function to retrieve those, you may have to calculate the box yourself.
Thanks - I tried every variation of that code I could think of - got a rotation to match on the extents but I just could not get an accurately shaped box from any of the ‘bounds’ nodes.
Some were close(ish) but as soon as the object rotated off axis it lost its shape/accuracy.
But you are not doing any of the things mentioned in the links? E.g. the first set of nodes in the forum thread where it says OBB-localbounds should display the correct box with DrawDebugBox (haven’t tested it myself but looks right to me).
(Oriented bounding box from GetLocalBounds - #2 by kalmiya)
I have tried that code - it does not work. Tried tweaking it and managed to get it to draw a fairly accurate (but never exact) box extents however it only works in one axis. As soon as the object is rotated off a major axis it loses its shape.
You wrote in your initial post that you use scaled cubes, the first screenshot probably shows the correct OBB for the unscaled cube. You have to multiply Min/Max with that scale before doing any of the other calculations.
One problem I have with this however is you can input a rotation into the bounding box debug node to get it aligned for the debug purposes. I have still not worked out how to get the ‘rotated extants’ for other purposes - Random Point in Bounding Box does not have a rotation input. I guess somewhere I need to rotate a vector but cant work out where.
question aside, what plugin are you using for your blueprint nodes? i tried to find it after seeng them in a video, but i couldn’t find the name. i really like the cleaness of those node lines