I have a very simple project that I just started. The main scene consists of an instanced scene containing an Area2D and an instanced scene containing a KinematicBody2D. The Area is in Layer 2 and masks Layer 3. The Body is in Layer 3 and masks Layer 1, 2, and 3. Calling get_overlapping_bodies()
on the Area while overlapping the Body, returns an empty array, when I would expect it to return an array containing the Body.
Now here's where it gets extra weird. If I set the Area to mask Layer 1, then the overlap registers. I've tried messing around with different combinations of layers and it seems as though the only determining factor for whether or not the Body appears in that array is if the Area masks Layer 1, even though the Body isn't even in Layer 1. Is this a bug?
I feel like I always run into some confusion when working with collision layers, but I usually am able to get to a solution, but this time its really busting my brain!
(Btw the context for this is that I want to create a system for a top-down rpg where you can walk up to something and press a button to interact with it. The way I thought to do it is that when the user presses the button, the Area will check if there's anything inside it that it could interact with. I'm doing a class check to check if its something that it can interact with, and that works, but theoretically the Area should also only have to check layer 3, because that is the layer I will be putting all of my interactive things on.)