+6 votes

I have a TextureRect Control Node which is listening for mouse input via a gui input signal (I found this to be a really nice way to get the mouse position relative to the node via the event.position property) and on top (i.e. lower sibling in the scene tree) of it I have an Area2D node with Collision shape as child listening for the mouse input via input event signal. It is really important that collision shape is circular, that's why I went with Area2D/CircularCollisionShape route.

Now, when there is mouse click on the circular shape I need both of these nodes to fire their input functions. However, since TextureRect is a Control node, it catches the event first, fires its associated function and marks it as handled and it never gets to the input_event of the area2D. I understand this is the expected behaviour.

How do I mark the event that is being handled by Control Node as "unhandled" so that it keeps propagating to other non-control nodes ( unhandledinput functions, collision_shapes, etc.)? The way I'm doing it now works, but its not very elegant.

At the end of Control gui_input function I go:
var oldMouseFilter = $TextureRect.mouse_filter $TextureRect.mouse_filter = 2 get_tree().input_event(event) $TextureRect.mouse_filter = oldMouseFilter

Thanks for your advice!

in Engine by (22 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.