How to handle Area2D input events inside a viewport

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

I would like to use a Viewport to display a 2D scene inside of a 3D world (similar to the Demo example 2D in 3D). Inside the 2D scene I have Area2D nodes containing a Sprite and a CollisionShape2D. Is there a way to use the input_event signal from the Area2D to handle input?

In my 2D only scenes I use Area2Ds and the input_event signal to handle mouse/touch input. I’m hoping I can do the same thing from within a Viewport embedded in a 3D scene.

Any help on this would be greatly appreciated.

Thanks!

:bust_in_silhouette: Reply From: saletrak

related to: https://gamedev.stackexchange.com/questions/201942/how-to-make-a-collision-object-within-a-viewport-detect-mouse-inputs

(Sub)Viewport > Physics > Object Picking = true was helpful for me.

1 Like

It worked, thanks! :slight_smile: