I am making the settings menu for a game in Godot 3.5 which has a progress bar node for the volume.
I want players to drag their mouse to adjust the volume, like so:

The problem is that I don't know how to detect where and how much the mouse is moving to change the value of the progress bar accordingly. I was wondering if there was a way to detect and measure mouse movement when it enters a node.
I tried to use get_global_mouse_position(), stored it in a variable, used a timer for a delay and then again checked it, then subtracting both, I thought I would get the mouse movement but it didn't work and the progress bar remained the same.
Although, even if it had worked, it would not have been smooth or changing realtime...
I hope you'd like to help, THANKS!
I recommend using
HSliderfor volume settings.Since you want to use a
ProgressBar...A way to do this would be with
_gui_inputin an script attached to theProgressBar:Here the
positionyou get would be in local space of theProgressBar.We could compute the value from the
x(position.x) and thewidth(rect_size.x):Note: Be aware that the above computation does not take borders into account.
Addendum: I notice you explicitly ask "how much the mouse is moving". Well, if the
eventis anInputEventMouseMotion, it has arelativeproperty that will tell you how much it moved since last event.