get number of bodies in an Areabody using getoverlappingbodies()

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

Making a 3d game and i have an areabody with objects inside i want to print the number of objects inside using the get_overlapping_bodies()

:bust_in_silhouette: Reply From: jgodfrey

I’ve never used it, but looking at the docs here:

It’s documented to return an Array. Looking at the Array docs here:

An Array has a size() method, that returns the number of elements in the array. Using that, I’d expect this to give you what you want…

var bodies = area.get_overlapping_bodies()
print(bodies.size());
1 Like