Hi there. I can get information I want from get_overlapping_bodies() in the console with something like this:

var overlaps = get_overlapping_bodies()
if overlaps != []:
    print(str(overlaps))

And in my case, in the situation that I want to return true, the console gives me [[TileMap:1379]], whose name in the tree is $nBlock. What I can't figure out is how do something like this:

if overlaps.has("[TileMap:1379]"):
    #do something

All variations I can think of for phrasing this don't seem to work. What am I doing wrong? Preferably a solution where I can use $nBlock, or better yet check for a group, instead of the numerical ID which I don't think you're supposed to access directly in this way in the first place.

There is another method: bool overlaps_body ( Node body ) const

So, if you you get an overlap, it seems like you could test to see if it was the body you are looking for with that method. The docs recommend using a signal because these methods are only updated once per frame. The array is just an array, so you should be able to use a find type statement for arrays to get it, but I don't think that would be a good idea because that could change as you start adding nodes and things. Not sure about that.

Thanks, that is good to know about. Your answer helped me figure out my original question too. I was really close. You would phrase it something like this:

if get_overlapping_bodies().has(get_parent().get_node("myTileMap")):

But yeah, this type of tree-walking in object oriented programming always feels a little clunky.

a year later