Draw Debugger?

Hi, I’m new to Unreal Engine and started not too long ago. I’m trying to draw a rectangle that contains the player actor bounds and another actor’s bounds. The rectangle should change size to only contain the player and the other actor’s bounds. I would also like to see if I can find the center point of that rectangle. I’ll try to draw it out and I apologize if the drawing isn’t good.

I’ve only heard of debug box but I don’t know how to draw a rectangle and how to make that rectangle appear on the screen at all times. So I was wondering if anyone knows how to make a debug rectangle that appears on the screen (kind of like a HUD) and change it’s size to contain the player and other actor’s bounds. I would also like to know if it’s possible to find the center point of that debug rectangle.

Any help would be great thanks!

You can just use the get bounds node of two actors and get their mins/max values.
Though this isn’t the greatest since it only considers what it can do with a 0,0,0 rotation box, it fits what is in your example.

Result:



Side note: you can right click a pin and click split to get all of it’s components if it’s a struct like vector or box


Result of splitting both sides:
image



I’ve gone ahead and made it work with an array of actors rather than just two.
I’ll walk you through the function, but here’s an image of the entire thing at once. I accept a parameter of an array of actors, and return two vectors- one called center and the other extent:


First things first, we iterate through our array of actors, and set our local variable CurrentBounds (of type Box) to the bounds of the actor. The get actor bounds node returns it as center and extent, so we just need to convert it to min max.

We then use that CurrentBounds value to update our other local variable of the same type, FinalBounds. We use a select node to check whether this is our first iteration of the loop. If it is, FinalBounds is a default value that we don’t want to compare against, so we’ll just set it. If it isn’t, we get the minimum and maximum values between the two boxes, and use that as the new box.

After the loop is completed, we’ll convert our final bounds to a center and extent that we can actually use in draw debug box by getting the new center and bounds:



With that, the function itself is done. Onto displaying it, we can just use Draw Debug Box and Draw Debug Point. Make sure the duration is 0 since we’re using it on tick. You’ll probably also want to increase their sizes- especially the debug point.