AHUD DrawRect To 3D Volume(Box) And Extend For Selecting Pawns In 3D World

Hello

I want to recreate the GetActorsInSelectionRectangle!
The function is not accurate at all and selects things it doesnt even touch or doesnt select at all if the selection box is too small.
The booleans for refining the selection do nothing!

I thought i can try to recreate it and its been 2 days… im giving up doing it myself!
I even tried using Gemini and it helped a bit but not enough for my dumb brain.

Im using the AHUD DrawRect to draw the rectangle on the screen.
I use the DrawRect to get the 2 corners of the rectangle and then project it to world coordinates.
Then i want to create a rectangle aligned perfectly with the DrawRect and use it for overlapping pawns.

My plan was to create a rectangle right in front of the camera and another one really far away.
Problem is how would create a form for collision detection if it isnt a rectangle, since connecting(creating)those two rectangles would create a trapezoid?
Im clueless…

I tried and failed:
If i draw it in the center of the screen perfectly, no problem.
If i go a little bit to the side everything goes bad, the 2 corners i extend forward to create a flat rectangle at distance always turn into a uneven rectangle making it complety useless.
I also cant get the rectangle rotation to align with DrawRect right.

I would love if somebody can give me step by step or tipps on what im doing wrong.
My knowledge with geomtry and math is limited but im willing to learn.

I also just read about projecting every bounding box to screen space and using that for selection.
Still i want to learn how to do it my way!

Thx

I brainstormed with gemini and found a solution!