Weird Results with Box Traces

Hello! I’m currently trying to reproduce the RTS mechanic of selecting multiple units with a draggable rectangle. To accomplish this I want to use Multi Box Trace by Channel. To get the half-size / center coordinates of the box I am getting a vector at the beginning and end of my drag using get hit result under cursor and taking the location of the hit. I have a macro that turns these into the center position of the box. Here’s the macro. Basically gets the center of the box by getting the median x/y and adding those values onto the start vector to get where the center should be. The half-size is the same without adding them onto the original vector.

And I use these in my controller to create the trace box on the release of the mouse button. (The end is just a point right next to the original start point to keep the box shape)

This only works when going from the bottom of the screen to the top. I have absolutely no idea why. The box is drawn correctly no matter which direction I drag from but I only get hit results when I drag from the bottom to the top. Here’s an illustration.

When I rotate my camera to view from the opposite angle, I weirdly can only select from right to left. I do not understand this behavior at all. I think it’s probably something with my math but since it’s drawing the boxes correctly and the characters are in the boxes in all of the directions I don’t understand why it’s not seeing them as hits. My characters are set to block visible channel.

Any ideas would be greatly appreciated!

Well… as I suspected my math was wrong. In the get box extents macro if I have an end point with smaller x or y I end up with a negative size…

Apparently with a negative size the box will still draw correctly for debug drawing even though the trace will not work with negative sizes. I think this should probably be changed to either not drawing the box so it’s easy to tell that something is wrong or by taking the absolute value of the inputs for calculating the trace since it’s already doing it for drawing the debug box anyways.

I just wanted to say thanks for taking the time following up on this and making this searchable - you saved me big time