Topic was automatically imported from the old Question2Answer platform.
Asked By
nwgdusr999
Hi, I’m trying to detect when the user clicks on a node. Works fine by its own, but my game is located in a ViewportContainer → Viewport and this seems to consume the mouse events… Ex; in a NPC node; uses _input_event(...), ex:
This works if the NPC node is ran as a scene or in the main ‘world’ scene. But if it is run inside a ViewportContainer containing a Viewport, then it does not work…
Any idea what could be the issue? I think that the ViewportContainer as a ‘Control’ consumes the mouse event, but I can’t find how to change this behavior…
ViewportContainer has a Mouse->Filter property. Change it to Ignore or Pass.
Tried it and it didn’t make any difference… :\
nwgdusr999 | 2019-07-30 15:56
Do you have other Controls that could be handling mouse events? ‘Filter’ is a property of Control class.
hilfazer | 2019-07-30 16:21
Sorry for delay, did some test with a simple project and as soon as a clickable node with the input_event is within a ViewportContainer and a ViewPort, the event does not work. I tried with different mouse filter values but it did not change anything… Just seems bugged.
Btw object pickable needs to be on for the clickable node, and Viewport has a setting; Physics Object Picking which can be set to on/off, but it does not seem to make any difference. I’ve played with pretty much all GUI VP and VPC params that seemed relevant that I could find, nothing works.
I’ve also meet such problem. Seems except _input_event, other input(_input, _gui_input, _unhandled_input) works well. I’ve also test it in godot4, and this problem doesn’t exist.
It looks like I have to avoid using _input_event in such case with godot3.
You have to enable Viewport property Physics->Object Picking to allow any click/touch event to pass through object inside viewport. Also change Mouse Filter to pass or ignore.