godotengine / godotengine/godot

`get_overlapping_areas()` detects areas with `monitorable == false`

Open
#93,532 4 comments 4 reactions 0 assignees View on GitHub
bug needs testing topic:2d topic:physics
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in: 3.5.3.stable

### System information

Windows 11 - Godot v3.5.3.stable

### Issue description

When polling for any overlapping areas within a specific layer using `get_overlapping_areas()`, areas are found to be overlapping even when their `monitorable` values are false.
This happened consistently in my game project, where I worked around it by removing and re-adding the target node from their collision layer, which worked out ok, but upon creating an MRP I got the error inconsistently.

Here's a video of it happening on some runs but not others:

https://github.com/godotengine/godot/assets/3142110/fd9297e7-6558-4a95-a76a-49027106d717

### Steps to reproduce

have an area 2d node `target` with a collision layer = n and `monitorable` value equal to `true`
have an area 2d node `monitor` with a collision mask = n and `monitoring` value equal to `true`
put both nodes within a scene and make sure their areas overlap.
on the scene's `_process(_delta)` method, call `monitor.get_overlapping_areas()` and observe `target` area is found to be overlapping. call `$Target.set_deferred("monitorable", false)`, and notice it sometimes is found to be overlapping even when it's `monitorable` value equals `false`.

### Minimal reproduction project (MRP)

[bug_report_MRP.zip](https://github.com/user-attachments/files/15949581/bug_report_MRP.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the attached minimal reproduction project on Godot 3.5.3 and tracing Area2D's get_overlapping_areas() behavior after Target.set_deferred("monitorable", false). Inspect the implementation entry points for get_overlapping_areas and monitorable handling. Done means the target is not reported after monitorable becomes false, consistently across reproductions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.