#get_overlapping_areas() doesnt run when bullet spawns inside hitbox.

5 messages · Page 1 of 1 (latest)

subtle granite
#

So i have a projectile with a hitbox and a hurtbox enemy which uses get_overlapping_areas() in order to chain towards more enemies by getting all nearby areas and going after one. It works all fine, but the moment i get close to an enemy and shoot, the bullet spawns inside them and i guess it happens so fast that the code which checks the closest area always returns 0,0. I figured is because get_overlapping_areas never detects anything. Is there a way to make sure it updates or runs before doing this check? I tried using signals on entered/exited and updating an array of areas as well as adding it to the physics_process of the bullet. None ever run before it. I could do this with raycasts however using force_raycast_update() how can i do this for areas?

steel steppe
#

The area needs to be present for at least one physics step to get updated

#

If you want immediate detection you can use the shapecast node or intersect_shape