I am working on a 2D game with a spatial node (a 3d node) inside a viewport. Nodes within the viewport should be able to detect user input from what I can find online, but for some reason it doesn't seem to work for me.
My tree holds the viewport in a viewportcontainer. The node within the viewport handles the effects of detection. In a standalone scene, the node detects mouse inputs without any problems.
The code of the spatial script:
extends Spatial func _on_Area_input_event(camera, event, position, normal, shape_idx): if (event is InputEventMouseButton): print(get_parent().name)
Furthermore, I made sure that:
Handle Input Locallywithin the viewport is
Disable Inputin Gui within the viewport is
Object Pickingin the viewport is
- The viewport container is not blocked by any other nodes