selector in area

Godot Version



I want to select objects on the map, to be able to group them, but I do not want to select them 1 by 1, but when I press the left mouse button I can drag to where I want to select so I can know which objects are selected and add them to a group that I choose. And that the selection area has some effect to highlight.

Thanks, but it’s not what I’m looking for, I think I wasn’t that specific. I will update the post to avoid confusion

this basically just check if the objects’ position are inside the specified rect drawn by drag

It is what I want, but do you have any idea how I can make it so that with the mouse I can drag and select in the area, which nodes I could use?

doing click and drag can be done by any node that’s a Node by _input event function.
to draw it, the rectangle from point of click to until mouse is released, can be creating a child node of panel or TextureRect with beginning size of 0,0 and spawn at clicked position when created and off start clicked. for it to follow mouse position, will need to calculate the first mouse clicked position (or global_position) and the current mouse position subtracted and feed it into the size of this new child panel/textureRect in _process(delta) function. this works if it’s only making rectangle.

There will be problems such as if it drags from top right to bottom left, i think will need to know the direction of the node and flip accordingly. Also above mentioned way is only drawing a rectangle and doesnt blacken the outside area