How to get amount of avatars in radius N


#1

I looked at the wiki, but i cannot find it. Also not see aything under MyAVatar.

I need to know how to get the amount of avatars around the script in a specified radius. But what command is doing that ?

ADD: Just found a command that possible just do what i need.

AvatarList.isAvatarInRange (position: vec3, range: float): bool

So i think my problem is solved. Still interesting to know if there’s another command to get the amount of avatars.

ADD: I thinked and the abve function is not helping me, i really need to know the amount of avatars. not only if there are some. Still no result on the wiki.


#2

its pretty simple.

call getAvatarIdentifiers to get all identifiers. then get the details for each avatar.

use the vec3 lib to get the distance between each avatar position and the position of the center of your ‘radius’.

if the distance is less than the radius… there ya go. thats an identfier you can use. increment a count.

basic logic, easy code, you should be able to do this in 2 min.