How to check what an area 3D colliding with

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By witch_milk

In my game a player has an “aura “ effect, meaning any areas or bodies nearby the player are affected by the aura’s respective effects.

However I don’t know how to make this clean and simple without being able to acquire the area(s) the aura collides with using script.

Some of these auras only emit their effect when certain conditions are made, for example: the aura only works if the enemy that is within the aura happens to have less than 25% health. So I need to be able to check what the aura is colliding with under physics process delta.

Simply using body entered and existed isn’t enough

:bust_in_silhouette: Reply From: jgodfrey

Seems like you could create an Array to track the enemies that are currently in your Area node via the standard entered and exited signals. So, add an enemy to the array when it enters the Area and remove it from the array when it exits the Area.

With that, you could choose when/where to process the contents of the array, including in _physics_process if that’s what you need.