Performance using collision detection Area 3D

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

I am currently using area 3D with physics disabled to implement line of sight of units. I am using signals body_entered and body_exited signals. There will be a lot of units, and I am also planning on adding another area 3D to implement range of units (it can be bigger than line of sight or smaller), so I am worried about performance aspect of area 3D. Is collision detection implemented naively or are there some optimization algorithms using octrees or similar structures to make complexity less than O(n^2)?