So I'm trying to make a way to select multiple objects in my project. I want it basically like Windows, where you can click and drag to create a box that you can use to select items that are in that box. I got it to create the selection box using a Polygon2D
, and making it show up correctly, following the mouse, etc. So then I added an Area2D
and a CollisionPolygon2D
to that Area2D
. I found out that I need to use get_overlapping_areas()
on the area. When I do that though, it returns an empty array, unless I start the selection in an area. I had also tried using the area_entered
signal, but it doesn't work either. I made the box stationary, and moved areas into it, and then it worked correctly. I've also verified the collision shape is correct by enabling show collision shapes.
To update the box, I'm just updating the PoolVector2Array
of points. I'm wondering if maybe changing the shape of the collision object is preventing it from detecting if an area is inside. I was hoping get_overlapping_areas()
would actually do the math to check if an area is inside another, but it appears like it just retrieves the list that is updated everytime an area enters.
Does anyone have any suggestions or clarifications if I'm not understanding correctly?
TL;DR I want to get all areas inside another while I'm changing it's shape, and it's not working.