The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hello! I'm trying to detect when an Area2D X appears intersecting another Area2D Y . X is not entering or exiting Y, it is hidden and with set_monitorable(false) and suddenly became visible and with set_monitorable(true). It seems that get_overlapping_areas and overlaps_area only detect entering and exiting intersections, so I don't know how to proceed.

Godot version 4.0 alpha 12
in Engine by (12 points)

2 Answers

0 votes

get_overlaping_areas() should return a list of all the areas that share a collision layer and collision mask "match". For what I understand it looks for the areas, only when called, so it wouldnt make sense that whatever happened before, affects it. Have you tried just calling the function after the area appears?

Edit: setting monitoring or monitored to either true or false shouldnt even matter I think (not sure) because it affects the detection of entering and exiting only to fire signals, not for the get_overlaping_areas()

by (450 points)
edited by
0 votes

I don't tnik so, signals may have a problem with that, but not get_overlapping_areas()
Perhaps You are trying to check collision to early after changing monitoring. Just use call_deferred, or wait some arbitrary frames before checking overlap

by (8,188 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 Frequently asked questions and 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 [email protected] with your username.