Make Area 3D's "on_node_input" work in viewport

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DoubleFelix

I have a 2D scene with a viewport container. Inside this viewport container is a viewport, which is the parent of a MeshInstance set to a model with an orbiting camera setup. I have little nodes on my models (Area 3D with CSGSphere and CollisionShape), and I’d like to make it so I can check if the user clicks on this Area 3D node from the viewport. The camera controls work fine since I pass the event from _unhandled_inputto a function for this camera gimbal, but it doesn’t work for click detection.

Input is passed in via this:

func _unhandled_input(event):

and I do various function calls depending on the type of input it is.

The function that I need to call via signal is this:

func _on_HeadGrabberArea_input_event(camera, event, click_position, click_normal, shape_idx):
	print(camera, event, click_position, click_normal, shape_idx)

Why would this work for the camera gimbal but not the input event signal?

:bust_in_silhouette: Reply From: Togis

Try to attach a script to your viewport and use this code:

extends Viewport

func _input(event):

It’s magic