draggable nodes overlapping

Godot Version

4.6

Question

in my 2d godot game, there are multiple objects that you can drag, but you can just pick them all up and they all go to the same position(the mouse), making the game impossible. and the game does require them to touch becuase im making a gear like system. is there any way to prevent this?

global_position = get_global_mouse_position()

Have a global is_draggable variable, so that you can only drag and drop one item at a time.

If you are using Area2D or any other physics object then you’ll need to enable Viewport.physics_object_picking_sort and maybe Viewport.physics_object_picking_first_only if you only want the first one.