godotengine / godotengine/godot

Updating Area2D collision layer does not emit entered signal of already intersecting Area2Ds

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

Description

### Tested versions

- Reproducible in v4.3.beta.mono.custom_build [e09a3e931] and 4.2.2
- Not reproducible in 3.5.3

### System information

Godot v4.3.beta.mono (e09a3e931) - Ubuntu 22.04.4 LTS 22.04 - Wayland - Vulkan (Forward+) - integrated AMD Unknown (RADV RENOIR) - AMD Ryzen 7 5800H with Radeon Graphics (16 Threads)

### Issue description

I have a scene with two Area2Ds that are overlapping. The collision layers and masks are set to not trigger any collisions.
When I now set one area's collision layer to the collision mask of the other area, no area_entered signal is emitted. This only applies to intersecting areas. If the layer of an intersecting body is updated, the body_entered signal is emitted.

I'm not sure if this is intended behavior or a bug. I found some similar older issues that were fixed by #39894. In Godot 3.5.3, the signals are emitted.

### Steps to reproduce

The MRP contains an Area2D with collision mask '1'. A CharacterBody2D and another Area2D that overlap the first area have collision layer '0'. A script connects the body and area entered signals for which it prints a short message ('Body/Area entered').
It then sets the collision layers of the body and the second area to '1' after 1s delay.
Only the message for the body entered signal is printed.

### Minimal reproduction project (MRP)

[mrp.zip](https://github.com/user-attachments/files/15845063/mrp.zip)

Contributor guide

Open the contributing guide

Research direction

Run the linked MRP with Godot 4.2.2 or the tested 4.3 beta and observe the Area2D and CharacterBody2D entered signals after the collision layers change. Trace the Area2D signal behavior for already-overlapping objects and compare it with the body signal and Godot 3.5.3; done means the intended area-entered behavior is confirmed and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.