Drag base point

Godot Version

4.2.1

Question

I’m using force_drag(data: Variant, preview: Control) to do a drag function, and the preview(duplicated from it self) will follow the mouse with its left-top point (0,0) as the base point.

So I was wandering if the base point could be changed, but setting its position is not working.

Any way to achieve that? Or I need to make my own drag function?


( my code just do: if mouse clicked and moved on label “drag ≡”, then call force_drag(data, duplicate(0)) )

Use a Control node as the parent of the actual preview node and position the preview node wherever you want

force_drag() skips the _get_drag_data() virtual call that you could implement instead to do this whole thing.

I tried it first but it didn’t work, after that I tried it again and _get_drag_data() just worked, I don’t know why but it just useable again :gdsweat:

Cool! It works, thx a lot :gdparty:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.