Why is area_entered signal called on areas which don't have the mask for the collisions please?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nickgenfailed

An illustrative situation:

Area A - mask for B + C
Area B - mask for C
Area C - no mask

Now both A and B have connect to their own area_entered with their own methods (on_area_A_area_entered and on_area_B_area_entered).

Now what happens:
B moves into A, triggers:

  • on_area_A_area_entered
  • on_area_B_area_entered

But on_area_B_area_entered is meant for collision with C which means on_area_B_area_entered has to include something like:
if (area.Owner.Name == "AreaA") return;
and after that is the code for collision with C.

Honestly, I’d expect since the mask was set only on area A that only signal that would get triggered would be the one on A and if both A and B had mask for each other then both A and B would get the trigger but it’s not the case so I’m wondering now.

Is there, please, some way to do it or do I need multiple areas all for different collissions or start all the collision codes with a switch/if statement as above?

I know there’s Monitoring and Monitorable but that’s not going to do it since ale the areas are checking for something or something is checking for them.

Thank you very much I’m a bit confused here :-).

:bust_in_silhouette: Reply From: exuin

Collisions are symmetric, which isn’t really documented in the docs. I agree that it could be stated better. You’ll probably have to use if statements or groups or something in order to check what area the other area has collided with.

Yeah, thanks a lot, I just noticed a proposal on physics rework which I think solves this but if it goes through or not that’s a question for the future :slight_smile:
Have a nice day.

Nickgenfailed | 2021-06-11 14:56