how to keep my mouse position at same place when i click and drag it?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatobanana

hi guys , how to keep my mouse position at same place when i click and drag it?
for example if i drag Node2D with child( texture_rect.size(128,128)), i want my mouse stay at position first it click. for now my mouse either move to (0,0) or center of object. how should i do it?. can give me example.

:bust_in_silhouette: Reply From: Andrew Wilkes

Maybe you can set the child nodes to Pass/Ignore the mouse events in the Mouse->Filter property in the Inspector? Otherwise you would need to set up an input event capture function to reset the position of the main node to that of the mouse.