Skip to main content

High Fidelity API Reference

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


Globals

Methods

NameReturn ValueSummary

print

None

Prints a message to the program log and emits Script.printedMessage. The message logged is the message values separated by spaces.

Alternatively, you can use Script.print or one of the console API methods.


Type Definitions

AttachmentData

AttachmentData

Type: object

Information on an attachment worn by the avatar.

Properties

NameTypeSummary

modelUrl

string

The URL of the glTF, FBX, or OBJ model file. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs respectively).

jointName

string

The name of the joint that the attachment is parented to.

translation

Vec3

The offset from the joint that the attachment is positioned at.

rotation

Vec3

The rotation applied to the model relative to the joint orientation.

scale

number

The scale applied to the attachment model.

soft

boolean

If true and the model has a skeleton, the bones of the attached model's skeleton are rotated to fit the avatar's current pose. If true, the translation, rotation, and scale parameters are ignored.

AvatarData

AvatarData

Type: object

Information about an avatar.

Properties

NameTypeSummary

position

Vec3

The avatar's position.

scale

number

The target scale of the avatar without any restrictions on permissible values imposed by the domain.

handPosition

Vec3

A user-defined hand position, in world coordinates. The position moves with the avatar but is otherwise not used or changed by Interface.

orientation

Quat

The orientation of the avatar's body.

headOrientation

Quat

The orientation of the avatar's head.

headPitch

number

The pitch of the avatar's head relative to the body, in degrees.

headYaw

number

The yaw of the avatar's head relative to the body, in degrees.

headRoll

number

The roll of the avatar's head relative to the body, in degrees.

velocity

Vec3

The linear velocity of the avatar.

sessionUUID

Uuid

The avatar's session ID.

displayName

string

The avatar's display name.

sessionDisplayName

string

The avatar's display name, sanitized and versioned, as defined by the avatar mixer. It is unique among all avatars present in the domain at the time.

attachmentData

Array.<AttachmentData>

Information on the avatar's attachments.

Deprecated: This property is deprecated and will be removed. Use avatar entities instead.

jointNames

Array.<string>

The list of joints in the current avatar model.

Collision

Collision

Type: object

Details of a collision between avatars and entities.

Properties

NameTypeSummary

idA

Uuid

The ID of one of the avatars or entities in the collision.

idB

Uuid

The ID of the other of the avatars or entities in the collision.

penetration

Vec3

The amount of penetration between the two items.

contactPoint

Vec3

The point of contact.

velocityChange

Vec3

The change in relative velocity of the two items, in m/s.

Color

Color

Type: object

A color vector.

Properties

NameTypeSummary

red

number

Red component value. Integer in the range 0 - 255. Synonyms: r, x.

green

number

Green component value. Integer in the range 0 - 255. Synonyms: g, y.

blue

number

Blue component value. Integer in the range 0 - 255. Synonyms: b, z.

Mat4

Mat4

Type: object

A 4 x 4 matrix, typically containing a scale, rotation, and translation transform.

Properties

NameTypeSummary

r0c0

number

Row 0, column 0 value.

r1c0

number

Row 1, column 0 value.

r2c0

number

Row 2, column 0 value.

r3c0

number

Row 3, column 0 value.

r0c1

number

Row 0, column 1 value.

r1c1

number

Row 1, column 1 value.

r2c1

number

Row 2, column 1 value.

r3c1

number

Row 3, column 1 value.

r0c2

number

Row 0, column 2 value.

r1c2

number

Row 1, column 2 value.

r2c2

number

Row 2, column 2 value.

r3c2

number

Row 3, column 2 value.

r0c3

number

Row 0, column 3 value.

r1c3

number

Row 1, column 3 value.

r2c3

number

Row 2, column 3 value.

r3c3

number

Row 3, column 3 value.

PointerEvent

PointerEvent

Type: object

A 2D or 3D mouse or similar pointer event.

Properties

NameTypeSummary

type

string

The type of event: "Press", "DoublePress", "Release", or "Move".

pos2D

Vec2

The 2D position of the event on the intersected object XY plane, where applicable.

pos3D

Vec3

The 3D position of the event on the intersected object, where applicable.

normal

Vec3

The surface normal at the intersection point.

direction

Vec3

The direction of the intersection ray.

button

string

The name of the button pressed: None, Primary, Secondary, or Tertiary.

isPrimaryButton

boolean

true if the button pressed was the primary button, otherwise undefined;

isLeftButton

boolean

true if the button pressed was the primary button, otherwise undefined;

isSecondaryButton

boolean

true if the button pressed was the secondary button, otherwise undefined;

isRightButton

boolean

true if the button pressed was the secondary button, otherwise undefined;

isTertiaryButton

boolean

true if the button pressed was the tertiary button, otherwise undefined;

isMiddleButton

boolean

true if the button pressed was the tertiary button, otherwise undefined;

isPrimaryHeld

boolean

true if the primary button is currently being pressed, otherwise false

isSecondaryHeld

boolean

true if the secondary button is currently being pressed, otherwise false

isTertiaryHeld

boolean

true if the tertiary button is currently being pressed, otherwise false

Quat

Quat

Type: object

A quaternion value.

Properties

NameTypeSummary

x

number

Imaginary component i.

y

number

Imaginary component j.

z

number

Imaginary component k.

w

number

Real component.

Uuid

Uuid

Type: string

UUIDs (Universally Unique IDentifiers) are used to uniquely identify entities, avatars, and the like. They are represented in JavaScript as strings in the format "<nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn>", where the "n"s are hexadecimal digits.

Vec3

Type: object

A 3-dimensional vector.

Properties

NameTypeSummary

x

number

X-coordinate of the vector. Synonyms: r, red.

y

number

Y-coordinate of the vector. Synonyms: g, green.

z

number

Z-coordinate of the vector. Synonyms: b, blue.

WebInputMode

WebInputMode

Type: string

Specifies how a web surface processes events.

ValueDescription

"touch"

Events are processed as touch events.

"mouse"

Events are processed as mouse events.


Method Details

print

print( ...messageopt )

Prints a message to the program log and emits Script.printedMessage. The message logged is the message values separated by spaces.

Alternatively, you can use Script.print or one of the console API methods.

Parameters

NameTypeAttributesDescription

message

*

<optional>
<repeatable>

The message values to print.