# GetActorsInSelectionRectangle()

**URL:** <https://forums.unrealengine.com/t/getactorsinselectionrectangle/314189>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 7, 2015, 5:46pm UTC](https://forums.unrealengine.com/t/getactorsinselectionrectangle/314189 "2015-04-07T17:46:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![skaughtee1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@skaughtee1](https://forums.unrealengine.com/u/skaughtee1)\
**Post date:** [July 27, 2022, 8:16pm UTC](https://forums.unrealengine.com/t/getactorsinselectionrectangle/314189/6 "2022-07-27T20:16:38Z")

</div>

I found a solution!!!

Since “Get Actors in Selection Rectangle” is not accurate based on camera position, I found this code you can add after the selection rectangle to make the selection and deselection become accurate to the rect itself instead of the world position.

Just follow this guy’s examples in his pictures and it will fix it.

Basically it gets the actor’s location and converts it to screen location then checks if it is inside the rectangle or not.

This is something I was thinking about doing but I didn’t know how.

> [@HUD - Get Actors in Selection Rectangle - Any way to improve on it ?](https://forums.unrealengine.com/t/hud-get-actors-in-selection-rectangle-any-way-to-improve-on-it/116134):
>
> I have got a dragging, RTS style selection box working using the “Get actors in Selection Rectangle” but the results are really sloppy. I can be almost half a centimetre away from a mesh and it will still recognise and grab it. I understand this is because the node is reading the mesh bounds ? Is there a different, more precise way to do this ? Or a way to improve the node’s results ?

---

_[View the full topic](https://forums.unrealengine.com/t/getactorsinselectionrectangle/314189)._
