Skip to main content

High Fidelity API Reference

Tools Used: JavaScript, JSDoc, GitHub Pages, Markdown, HTML, CSS


Agent

The Agent API enables an assignment client to emulate an avatar. Setting isAvatar = true connects the assignment client to the avatar and audio mixers, and enables the MyAvatar API.

Supported Script Types: Assignment Client Scripts


Properties

Name TypeSummary

isAvatar

boolean

true if the assignment client script is emulating an avatar, otherwise false.

sessionUUID

Uuid

The unique ID associated with the agent's current session in the domain. Read-only.


Methods

NameReturn ValueSummary
isAvatar

boolean

Checks whether the script is emulating an avatar.

setIsAvatar

None

Sets whether the script should emulate an avatar.


Method Details

isAvatar

(static) isAvatar( ) → { boolean }

Returns: true if the script is emulating an avatar, otherwise false.

Checks whether the script is emulating an avatar.

Example: Check whether the agent is emulating an avatar
(function () {
print("Agent is avatar: " + Agent.isAvatar());
print("Agent is avatar: " + Agent.isAvatar); // Same result.
}());

setIsAvatar

(static) setIsAvatar( isAvatar )

Sets whether the script should emulate an avatar.

Parameters

NameTypeDescription
isAvatar

boolean

true if the script emulates an avatar, otherwise false.

Example: Make an assignment client script emulate an avatar
(function () {
Agent.setIsAvatar(true);
MyAvatar.displayName = "AC avatar";
print("Position: " + JSON.stringify(MyAvatar.position)); // 0, 0, 0
}());