how to get a list of all the visible avatars in the map

Post here your questions about the OpenSpace 1.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
josuedavid
Posts: 7
Joined: 24 Sep 2008, 11:58

how to get a list of all the visible avatars in the map

Post by josuedavid »

Hello to all, we need to change some properties of all the visible avatars in the map, the idea is to get all the visible avatars in the map, you have some idea of how to do that??
thank you in advance..
sstark
Posts: 77
Joined: 21 Nov 2008, 16:06

Post by sstark »

hrm, I can only think of one approach at the moment, and it'd be an experiment.

As I understand it, only the tiles visible (plus a small buffer) are ever displayed... thus, it is possible that listening to the ENTER_TILE and EXIT_TILE events may provide you with enough information to determine if the specific avatar is visible, and track that information in a custom object.

Could be a simpler solution I am missing, and this could easily not work... this is just a guess atm.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

There isn't an easy way to do this, also it really depends on how and when you need to do this. The sstark approach is valid if you need to monitor avatars continuously. Otherwise you may get a reference to each avatar by means of the (undocumented, sorry) OpenSpace.getAvatarMovieClipById(userId) method. In both cases you then need to evaluate if the avatar is visible or not. You may check if its parent tile is in the displaylist for example, or something like that.
Paolo Bax
The SmartFoxServer Team
Post Reply