0 votes

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 onareaBareaentered 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 :-).

Godot version 3.3.2 Mono
in Engine by (12 points)

1 Answer

+1 vote

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.

by (7,190 points)

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 :)
Have a nice day.

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 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 webmaster@godotengine.org with your username.