"Get all Actors in Selection Rectangle" not working properly

In my camera pawn controller I save my mouses X and Y location in screen space on pressed and released into the 4 variables shown below using the “Get Mouse Position” node, then in a HUD blueprint (The same used for drawing to the HUD, like if you wanted to have marquee selection), I plug those values into a “Get all actors in selection Rectangle” node".

For the most part it works but there are some issues, as seen below:

If anyone had any tips I would be appreciative, I have tried lots of solutions including off setting the mouses pressed and released locations by all sorts of values, dividing the values, multiplying the values, with mixed results but never a full solution to my problem. (I am making a command and Conquer style RTS)

hey bud,

Have you tried spawning a box at location on mouse button release using your current float variables to define the box size and getting all actors colliding with the box, add them to an array then destroy the box?

Hey friend!

I was thinking about doing that but I probably will have air units and that wouldn’t suffice for them, especially since players can adjust camera angle. I really appreciate the response though!

I think I figured out a solution, its kind of weird though! It complicated but its working so far! Involves a lot of Ray Casting.

Hey buddy,

Just specify the z value is greater than the height your units fly at then it won’t be a problem

Also you could use a box trace to do the same thing and it should output an array