0 votes

Context:

We are building a drag-and-drop system that's currently using Area2Ds to define the shape of drop areas. We now want to implement dragging things onto GUI elements.

Problem:

When we put Area2Ds inside of a Control node (which also needs to respond to clicks, so its MouseFilter can not be set to "ignore"), there doesn't seem a way to receive input events. The InputEvent tutorial describes that as soon as any Control node reacts to an event, the _input_event method won't be called anymore on areas/physics objects.

Question:

Do you see a way to react to input events in an Area2D, which is on top of a Control node?

Should we change our approach? Define drop areas using control nodes? We love the flexibility to define arbitrary shapes with areas, though.

in Engine by (19 points)

have you tried using CanvasLayer on Area2D?

1 Answer

0 votes
Best answer

We settled on a workaround where a 1x1 px area follows the mouse pointer, and we listen for intersection events with the area we're interested in.

by (19 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories