Hello, I want my player to follow the mouse on hold/click/move. The main problem was the hold, which I solved with coding the input into the process function and not in the input function itself.

The code is simple:

if Input.is_action_pressed("Click"):
    moving = true
    destination = get_global_mouse_position()

Now I got the problem that if I have a HUD or a other window open the player would still move since it still get all the inputs.

Does a solution for this exist?

Check the inspector on your HUD, look for Control -> Mouse -> Input. I think the setting Stop will do what you need.

The filter was already on Stop. Pass and ignore does not work either.

Have you tried using _unhandled_input? That way, if an input event is on something like a UI node, it shoudn't be processed anymore (since the UI processed it) and then it should work as expected (if I am understanding the issue correctly).

Yes it does!

I was testing it with the event if it was the Click Event. I don't know why I just haven't tried to test for the Input like I did in the _process function.

This works:

func _unhandled_input(_event):
	if Input.is_action_pressed("Click"):
		moving = true
		destination = get_global_mouse_position()

Thanks :+1:

I did some more testing and found out that it was still not solved. I opened a git-repo for this, maybe then it becomes clear what I mean.

Using it in the _unhandled_input the Player does not move if holding the mouse button down (only if you move it), it stops since no new mouse events happen. This can be solved when putting it in the _process function but then it handles every input.

Can you explain more clearly what you are trying to do? I'm a little confused about the problem.

I want the Player to move infinitely towards the mouse when I press the mouse button until I release it again. (works with the Input in the _process function)

To expand that later I added a Character which should be working like a "UI Element" (which is still a game object). If I click on it something happens or if I click on it and move the mouse the Player wouldn't receive the Input.

I think you want to separate the click from the mouse movement.

func _unhandled_input(_event):
    if Input.is_action_pressed("Click"):
        moving = true
   if Input.is_action_released("Click"):
        moving = false

func _process(delta):
    if moving:
        destination = get_global_mouse_position()

Yes that makes sense! It works =) Now I just have to handle the Character Edit: I added my solution to the git-repo if someone got the same problem.

2 years later