AvatarList

Description

Supported Script Types: Server Entity Scripts • Assignment Client Scripts

The AvatarList API provides information about avatars within the current domain.

Warning: An API named "AvatarList" is also provided for Interface, client entity, and avatar scripts, however, it is a synonym for the AvatarManager API.

Methods

Name Return Value Summary
getAvatar ScriptAvatar

Gets information about an avatar.

getAvatarIdentifiers Array.<Uuid>

Gets the IDs of all avatars in the domain.

Warning: If the AC script is acting as an avatar (i.e., Agent.isAvatar == true) the avatar's ID is NOT included in results.

getAvatarsInRange Array.<Uuid>

Gets the IDs of all avatars within a specified distance from a point.

Warning: If the AC script is acting as an avatar (i.e., Agent.isAvatar == true) the avatar's ID is NOT included in results.

isAvatarInRange boolean

Checks whether there is an avatar within a specified distance from a point.

processAvatarDataPacket None

Deprecated: This function is deprecated and will be removed.

processAvatarIdentityPacket None

Deprecated: This function is deprecated and will be removed.

processBulkAvatarTraits None

Deprecated: This function is deprecated and will be removed.

processKillAvatar None

Deprecated: This function is deprecated and will be removed.

sessionUUIDChanged None

Deprecated: This function is deprecated and will be removed.

Signals

Name Summary
avatarAddedEvent

Triggered when an avatar arrives in the domain.

avatarRemovedEvent

Triggered when an avatar leaves the domain.

avatarSessionChangedEvent

Triggered when an avatar's session ID changes.

Method Details

(static) getAvatar( avatarID ) → {ScriptAvatar}
Returns: Information about the avatar.

Gets information about an avatar.

Parameters

Name Type Description
avatarID Uuid

The ID of the avatar.

(static) getAvatarIdentifiers( ) → {Array.<Uuid>}
Returns: The IDs of all avatars in the domain (excluding AC script's avatar).

Gets the IDs of all avatars in the domain.

Warning: If the AC script is acting as an avatar (i.e., Agent.isAvatar == true) the avatar's ID is NOT included in results.

Example

Report the IDS of all avatars within the domain.

var avatars = AvatarList.getAvatarIdentifiers();
print("Avatars in the domain: " + JSON.stringify(avatars));
(static) getAvatarsInRange( position, range ) → {Array.<Uuid>}
Returns: The IDs of all avatars within the search distance from the position (excluding AC script's avatar).

Gets the IDs of all avatars within a specified distance from a point.

Warning: If the AC script is acting as an avatar (i.e., Agent.isAvatar == true) the avatar's ID is NOT included in results.

Parameters

Name Type Description
position Vec3

The point about which the search is performed.

range number

The search radius.

Example

Report the IDs of all avatars within 10m of the origin.

var RANGE = 10;
var avatars = AvatarList.getAvatarsInRange(Vec3.ZERO, RANGE);
print("Avatars near the origin: " + JSON.stringify(avatars));
(static) isAvatarInRange( position, range ) → {boolean}
Returns: true if there's an avatar within the specified distance of the point, false if not.

Checks whether there is an avatar within a specified distance from a point.

Parameters

Name Type Description
position string

The test position.

range string

The test distance.

(static) processAvatarDataPacket( message, sendingNode )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
message object

Message.

sendingNode object

Sending node.

(static) processAvatarIdentityPacket( message, sendingNode )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
message object

Message.

sendingNode object

Sending node.

(static) processBulkAvatarTraits( message, sendingNode )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
message object

Message.

sendingNode object

Sending node.

(static) processKillAvatar( message, sendingNode )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
message object

Message.

sendingNode object

Sending node.

(static) sessionUUIDChanged( sessionUUID, oldSessionUUID )

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Description
sessionUUID Uuid

New session ID.

oldSessionUUID Uuid

Old session ID.

Signal Details

avatarAddedEvent( sessionUUID )
Returns: Signal

Triggered when an avatar arrives in the domain.

Parameters

Name Type Description
sessionUUID Uuid

The ID of the avatar that arrived in the domain.

Example

Report when an avatar arrives in the domain.

AvatarManager.avatarAddedEvent.connect(function (sessionID) {
    print("Avatar arrived: " + sessionID);
});

// Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".
avatarRemovedEvent( sessionUUID )
Returns: Signal

Triggered when an avatar leaves the domain.

Parameters

Name Type Description
sessionUUID Uuid

The ID of the avatar that left the domain.

Example

Report when an avatar leaves the domain.

AvatarManager.avatarRemovedEvent.connect(function (sessionID) {
    print("Avatar left: " + sessionID);
});

// Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".
avatarSessionChangedEvent( newSessionUUID, oldSessionUUID )
Returns: Signal

Triggered when an avatar's session ID changes.

Parameters

Name Type Description
newSessionUUID Uuid

The new session ID.

oldSessionUUID Uuid

The old session ID.

Example

Report when an avatar's session ID changes.

AvatarManager.avatarSessionChangedEvent.connect(function (newSessionID, oldSessionID) {
    print("Avatar session ID changed from " + oldSessionID + " to " + newSessionID);
});

// Note: If using from the AvatarList API, replace "AvatarManager" with "AvatarList".