when using over has_overlapping_bodys if I want a node other than the node that the script is in like an area2d for a hitbox for example should I say $hitbox.has_overlapping_bodys to get that nodes overlapping body, does this not work and or is there a better way?
I need to know how to call has_overlapping_bodies without calling it for the node that the script is in
this is true
Why not do something like this?
@onready var checker_node = $NodeToBeChecked
if checker_node.has_overlapping_bodies():
var bodies: Array[Node2D] = []
bodies = checker_node.get_overlapping_bodies()
for body in bodies:
if body == checker_node:
bodies.erase(body)
continue
else:
continue
This will return all overlapping bodies besides the node performing the check. And then you can do with those bodies what you will, hard to really suggest anything without seeing your code.
Oh gotcha, yea either way I think Area nodes’ entering/entered handling could be better refined, it’s a bit rough even knowing all these factors in comparison to the vast majority of other pre-defined Node-based signals
No just that they are discrete via enter/exit-based signals while not offering any pre-defined continuous options via presence. i.e. entered/exited don’t emit if something was already inside to begin with or if it stays within long-term, but just work discretely as the entrances/exits happen.
That is amazing! I’ve never heard of this node before!
Also OP @gnarlak_bones if you need continuous detection @dragonforge-dev recommendation on ShapeCast may be up your alley, but if you just need discrete on enter/exit signals then yea just checking if there are any overlapping bodies, then getting all bodies sans the body in question.