How do I drag stuff?

Godot Version

4.2

Question

How do I drag stuff? I don’t want a droppable area, just a draggable object.

Turn on, or make sure it already is on, object picking in the project/viewport.

Override the _input_event() function of the collision objects

Save the state of _input_event() with a “picked” variable and use the _unhandled_input() events related to mouse motion to update its own position.

See point 8 in the link below :point_down: about picking.

1 Like