Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Area2D collision signal being received without having collision layer in mask #47556

Closed
p-brighenti opened this issue Apr 1, 2021 · 2 comments

Comments

@p-brighenti
Copy link

Godot version:
v3.3.rc7.official

OS/device including version:
Windows 10 Home 20H2

Issue description:
Sorry about the title being confusing but I did not find a better way to summarize it in just a few words.

The issue I'm facing is that I have a node A which is a KinematicBody2d and has as a child an Area2D on layer 1 with, let's say, layer 2 and 4 in its mask.

The second node, B, is itself an Area2D which is on layer 3 and has layer 1 on its mask.

Both of these are monitorable and monitored.

Given this configuration I'm expecting that when A and B's areas collide, that B will receive a signal but not A given that it didn't have layer 3 on it's Area2D mask.

Currently A is receiving a body_entered signal when it collides with B's Area2D even though A's mask does not contain the layer B is in.

Is this the expected behaviour and is it up to the user to discard the event in it's callback by inspecting the body's argument collision_layer field?

Steps to reproduce:

  1. Create a KinematicBody2D node with a Area2D as a child spanning over it.
  2. Put the Area2D on layer 1 and no layer on it's mask. Make it both monitorable and monitoring
  3. Attach a script to the KinematicBody2D node.
  4. Connect the on_body_entered signal of Area2D
  5. Create a Area2D node on layer 2 and with layer 1 on it's mask.
  6. Make the KinematicBody2D node collide with the Area2D node
  7. Verify that the signal callback is being called even though the KinematicBody2D's Area2D does not have layer 2 on it's mask

I'll make sure to update the issue with the minimal example tomorrow as I just don't have the time to do it today. My apologies.

@Calinou
Copy link
Member

Calinou commented Apr 1, 2021

Duplicate of #7644 ?

@p-brighenti
Copy link
Author

Duplicate of #7644 ?

Seems like it. If so, it's already being addressed in this PR #42268 .
Please consider it for 4.0, if you aren't considering it yet. I'll try to check if there's a proposal for this yet.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants