Box Extent not correct 5.1.1

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?

Using 5.1.1

If you rotate the object while drawing the debug box ( in construction ), you’ll notice the bounds often don’t conform to the object.

I think the only way, is to do the calculation manually.

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 - makes sense - can you suggest a way to calculate the box coordinates that I could use to spawn from. Struggling to think of a way to do it?

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.

The code (copied exactly)

  • Box is not correct (pink box = debug) purple box is (Bounds Explosions)

if I tweak and use Component bounds instead and rotated to match actor rot

  • Box is correct (but off by 90 degrees - adjusted for) but as soon as the object rotates off axis - box shape is lost

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.

Ok thanks - that worked with a bit of tweaking - this code gets an aligned OBB to scale

As you said I needed to * by the relative scale first - I also found in my case I had to get the world rotation rather than the relative rotation

Thanks for the help -

Code for anyone else who needs it -

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

You just have to rotate the point around the center of the bounding box, so something like (Point - Center).RotateVector(WorldRot) + Center.

1 Like

This is the ‘electronic node’ plugin - it is on the marketplace and well worth the few $ - I love it - really helps me clear the spagetti!

Yes!! - that has solved it. Thankyou for sticking with me on this one. I really appreciate all the help here. Works perfectly now.

This is what that code looks like for anyone else trying to solve this

1 Like


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.