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 Locally
within the viewport istrue
Disable Input
in Gui within the viewport isfalse
Object Picking
in the viewport isfalse
- The viewport container is not blocked by any other nodes