Skip to main content
2 of 2
added 111 characters in body
Qusk2
  • 11
  • 3

How to make a collision object within a viewport detect mouse inputs?

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.

Order of nodes within the viewportcontainer

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 is true
  • Disable Input in Gui within the viewport is false
  • Object Picking in the viewport is false
  • The viewport container is not blocked by any other nodes
Qusk2
  • 11
  • 3