Skip to main content

High Fidelity API Reference

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


Entities

The Entities API provides facilities to create and interact with entities. Entities are 2D or 3D objects displayed in-world. Depending on their EntityHostType, they may persist in the domain as "domain" entities, travel to different domains with a user as "avatar" entities, or be visible only to an individual user as "local" entities (a.k.a. "overlays").

info

Note: For Interface, avatar, and client entity scripts, the entities available to scripts are those that Interface has displayed and so knows about. For assignment client scripts, the entities available are those that are "seen" by the EntityViewer. For entity server scripts, all entities are available.

Entity Methods

Some of the API's signals correspond to entity methods that are called, if present, in the entity being interacted with. The client or server entity script must expose them as a property. However, unlike Entities.callEntityMethod, server entity scripts do not need to list them in an remotelyCallable property. The entity methods are called with parameters per their corresponding signal.

Method NameCorresponding Signal

clickDownOnEntity

Entities.clickDownOnEntity

clickReleaseOnEntity

Entities.clickReleaseOnEntity

collisionWithEntity

Entities.collisionWithEntity

enterEntity

Entities.enterEntity

leaveEntity

Entities.leaveEntity

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts • Server Entity Scripts • Assignment Client Scripts


Properties

NameTypeSummary
keyboardFocusEntity

Uuid

The Web entity that has keyboard focus. If no Web entity has keyboard focus, returns null; set to null or Uuid.NULL to clear keyboard focus.


Methods

NameReturn ValueSummary

addAction

Uuid

Adds an action to an entity. An action is registered with the physics engine and is applied every physics simulation step.

addEntity

Uuid

Adds a new domain, avatar, or local entity.

appendPoint

boolean

Appends a point to a Line entity.

Deprecated: This function is deprecated and will be removed. Use PolyLine entities instead.

callEntityClientMethod

None

Calls a method in a specific user's client entity script from a server entity script.

callEntityMethod

None

Calls a method in a client entity script from an Interface, avatar, or client entity script, or calls a method in a server entity script from a server entity script.

callEntityServerMethod

None

Calls a method in a server entity script from an Interface, avatar, or client entity script.

canGetAndSetPrivateUserData

boolean

Checks whether or not the script can get and set the privateUserData property of entities.

cloneEntity

Uuid

Creates a clone of an entity.

deleteAction

boolean

Deletes an action from an entity.

deleteEntity

None

Deletes an entity.

editEntity

Uuid

Edits an entity, changing one or more of its property values.

emitScriptEvent

None

Sends a message to a Web entity's HTML page.

findClosestEntity

Uuid

Finds the domain or avatar entity with a position closest to a specified point and within a specified radius.

getActionArguments

Entities.ActionArguments

Gets the arguments of an action.

getActionIDs

Array.<Uuid>

Gets the IDs of the actions that are associated with an entity.

getEntityObject

object

Gets an entity's script object.

getEntityProperties

Entities.EntityProperties

Gets an entity's property values.

getEntityType

Entities.EntityType

Gets an entity's type.

reloadServerScripts

boolean

Reloads an entity's server entity script such that the latest version re-downloaded.

sendClickDownOnEntity

None

Emits a clickDownOnEntity event.

sendClickReleaseOnEntity

None

Emits a clickReleaseOnEntity event.

serversExist

boolean

Checks whether servers exist for the client to send entity packets to, i.e., whether you are connected to a domain and its entity server is working.

setPacketsPerSecond

None

Sets the maximum number of entity packets that the client can send per second.

textSize

Size

Calculates the size of some text in a Text entity. The entity need not be set visible.

updateAction

boolean

Updates an entity action.


Signals

NameSummary

addingEntity

Triggered when an entity is added to Interface's local in-memory tree of entities it knows about. This may occur when entities are loaded upon visiting a domain, when the user rotates their view so that more entities become visible, and when any type of entity is created (e.g., by addEntity).

canGetAndSetPrivateUserDataChanged

Triggered when your ability to get and set private user data changes.

clearingEntities

Triggered when you disconnect from a domain, at which time Interface's local in-memory tree of entities that it knows about is cleared.

clickDownOnEntity

Triggered when a mouse button is clicked while the mouse cursor is on an entity. Note: Not triggered by controllers.

clickReleaseOnEntity

Triggered when a mouse button is released after clicking on an entity, even if the mouse cursor has moved off the entity. Note: Not triggered by controllers.

collisionWithEntity

Triggered on the client that is the physics simulation owner during the collision of two entities. Note: Isn't triggered for a collision with an avatar.

deletingEntity

Triggered when an entity is deleted.

enterEntity

Triggered when an avatar enters an entity, but only if the entity has an entity method exposed for this event.

leaveEntity

Triggered when an avatar leaves an entity, but only if the entity has an entity method exposed for this event.

preload

Triggered when the script starts for a user. See also, Script.entityScriptPreloadFinished.

unload

Triggered when the script terminates for a user.

webEventReceived

Triggered when a script in a Web entity's HTML sends an event over the entity's HTML event bridge.


Type Definitions

ActionArguments

ActionArguments

Type: object

Different entity action types have different arguments: some common to all actions (listed in the table) and some specific to each ActionType (linked to below).

Properties

NameTypeSummary
type

Entities.ActionType

The type of action.

tag

string

A string that a script can use for its own purposes.

Default Value: ""

ttl

number

How long the action should exist, in seconds, before it is automatically deleted. A value of 0 means that the action should not be deleted.

Default Value: 0

isMine

boolean

true if the action was created during the current client session, false if it wasn't. Read-only.

Default Value: true

::no-motion-state

boolean

Is present with a value of true when the entity hasn't been registered with the physics engine yet (e.g., if the action hasn't been properly configured), otherwise the property is undefined. Read-only.

::active

boolean

true when the action is modifying the entity's motion, false otherwise. Is present once the entity has been registered with the physics engine, otherwise the property is undefined. Read-only.

::motion-type

Entities.PhysicsMotionType

How the entity moves with the action. Is present once the entity has been registered with the physics engine, otherwise the property is undefined. Read-only.

ActionArguments-Offset

ActionArguments-Offset

Type: object

The "offset" ActionType moves an entity so that it is a defined distance away from a target point. In addition to properties in ActionArguments, this type has the following properties:

Properties

NameTypeSummary
pointToOffsetFrom

Vec3

The target point to offset the entity from.

Default Value: 0,0,0

linearDistance

number

The distance away from the target point to position the entity.

Default Value: 0

linearTimeScale

number

Controls how long it takes for the entity's position to catch up with the target offset. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action is applied using an exponential decay.

Default Value: 34e+38

ActionArguments-Slider

ActionArguments-Slider

Type: object

The "slider" ActionType lets an entity slide and rotate along an axis, or connects two entities that slide and rotate along a shared axis. In addition to properties in ActionArguments, this type has the following properties:

Properties

NameTypeSummary
point

Vec3

The local position of a point in the entity that slides along the axis.

Default Value: 0,0,0

axis

Vec3

The axis of the entity that slides. Must be a non-zero vector.

Default Value: 1,0,0

linearPosition

number

The current linear offset the entity is from its initial point if the action involves only one entity, otherwise the linear offset between the two entities' action points. Read-only.

Default Value: 0

angularPosition

number

The current angular offset of the entity from its initial rotation if the action involves only one entity, otherwise the angular offset between the two entities. In radians. Read-only.

Default Value: 0

ActionArguments-TravelOriented

ActionArguments-TravelOriented

Type: object

The "travel-oriented" ActionType orients an entity to align with its direction of travel. In addition to properties in ActionArguments, this type has the following properties:

Properties

NameTypeSummary
forward

Vec3

The axis of the entity to align with the entity's direction of travel.

Default Value: 0,0,0

angularTimeScale

number

Controls how long it takes for the entity's orientation to catch up with the direction of travel. The value is the time for the action to catch up to 1/e = 0.368 of the target value, where the action is applied using an exponential decay.

Default Value: 0.1

ActionType

ActionType

Type: string

An entity action may be one of the following types:

Properties

ValueTypeDescriptionArguments

"offset"

Object action

Moves an entity so that it is a defined distance away from a target point.

Entities.ActionArguments-Offset

"travel-oriented"

Object action

Orients an entity to align with its direction of travel.

Entities.ActionArguments-TravelOriented

"slider"

Object constraint

Lets an entity slide and rotate along an axis, or connects two entities that slide and rotate along a shared axis.

ActionArguments-Slider

AmbientLight

AmbientLight

Type: object

Ambient light is defined by its intensity.

Properties

NameTypeSummary
ambientIntensity

number

The intensity of the light.

Default Value: 0.5

EntityHostType

EntityHostType

Type: string

How an entity is hosted and sent to others for display.

Properties

ValueDescription

"domain"

Domain entities are stored on the domain, are visible to everyone, and are sent to everyone by the entity server.

"avatar"

Avatar entities are stored on an Interface client, are visible to everyone, and are sent to everyone by the avatar mixer. They follow the client to each domain visited, displaying at the same domain coordinates unless parented to the client's avatar.

"local"

Local entities are ephemeral — they aren't stored anywhere — and are visible only to the client. They follow the client to each domain visited, displaying at the same domain coordinates unless parented to the client's avatar. Additionally, local entities are always collisionless.

EntityProperties

EntityProperties

Type: object

Every EntityType will have these properties, in addition to those properties specific to the type.

Properties

NameTypeSummary
id

Uuid

The ID of the entity. Read-only.

name

string

A name for the entity. Need not be unique.

Default Value: ""

type

Entities.EntityType

The entity's type. You cannot change the type of an entity after it's created. Read-only.

entityHostType

Entities.EntityHostType

How the entity is hosted and sent to others for display. The value can only be set at entity creation by one of the Entities.addEntity methods. Read-only.

Default Value: "domain"

avatarEntity

boolean

true if the entity is an avatar entity, false if it isn't. The value is per the entityHostType property value, set at entity creation by one of the Entities.addEntity methods. Read-only.

Default Value: false

localEntity

boolean

true if the entity is a local entity, false if it isn't. The value is per the entityHostType property value, set at entity creation by one of the Entities.addEntity methods. Read-only.

Default Value: false

created

string

The UTC date and time that the entity was created, in ISO 8601 format as yyyy-MM-ddTHH:mm:ssZ. Read-only.

age

number

The age of the entity in seconds since it was created. Read-only.

ageAsText

string

The age of the entity since it was created, formatted as h hours m minutes s seconds.

lastEdited

number

When the entity was last edited, expressed as the number of microseconds since 1970-01-01T00:00:00 UTC. Read-only.

lastEditedBy

Uuid

The session ID of the avatar or agent that most recently created or edited the entity.Read-only.

renderLayer

Entities.RenderLayer

The layer that the entity renders in.

Default Value: "world"

position

Vec3

The position of the entity in world coordinates.

Default Value: 0,0,0

rotation

Quat

The orientation of the entity in world coordinates.

Default Value: 0,0,0,1

collisionless

boolean

true if the entity shouldn't collide, false if it collides with items per its collidesWith property.

Default Value: false

collidesWith

string

The types of items the entity should collide with, in text format.

Default Value: "static,dynamic,kinematic,myAvatar,otherAvatar,"

dynamic

boolean

true if the entity's movement is affected by collisions, false if it isn't.

Default Value: false

description

string

A description of the href property value.

Default Value: ""

userData

string

Used to store extra data about the entity in JSON format.

Warning: Other apps may also use this property, so make sure you handle data stored by other apps: edit only your bit and leave the rest of the data intact. You can use JSON.parse() to parse the string into a JavaScript object which you can manipulate the properties of, and use JSON.stringify() to convert the object into a string to put back in the property.

Default Value: ""

script

string

The URL of the client entity script, if any, that is attached to the entity.

Default Value: ""

serverScripts

string

The URL of the server entity script, if any, that is attached to the entity.

Default Value: ""

actionData

string

Base-64 encoded compressed dump of the actions associated with the entity. This property is typically not used in scripts directly; rather, functions that manipulate an entity's actions update it, e.g., Entities.addAction. The size of this property increases with the number of actions. Because this property value has to fit within a High Fidelity datagram packet, there is a limit to the number of actions that an entity can have; edits which would result in overflow are rejected. Read-only.

Default Value: ""

cloneable

boolean

true if the domain or avatar entity can be cloned via Entities.cloneEntity, false if it can't be.

Default Value: false

cloneLimit

number

The total number of clones of this entity that can exist in the domain at any given time.

Default Value: 0

EntityProperties-Light

EntityProperties-Light

Type: object

The "Light" EntityType adds local lighting effects. In addition to properties in EntityProperties, this type has the following properties:

Properties

NameTypeSummary
dimensions

Vec3

The dimensions of the entity. Surfaces outside these dimensions are not lit by the light.

Default Value: 0.1,0.1,0.1

color

Color

The color of the light emitted.

Default Value: 255,255,255

intensity

number

The brightness of the light.

Default Value: 1

falloffRadius

number

The distance from the light's center at which intensity is reduced by 25%.

Default Value: 0.1

isSpotlight

boolean

true if the light is directional, emitting along the entity's local negative z-axis; false if the light is a point light which emanates in all directions.

Default Value: false

Example: Create a spotlight pointing at the ground
Entities.addEntity({
type: "Light",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -4 })),
rotation: Quat.fromPitchYawRollDegrees(-75, 0, 0),
dimensions: { x: 5, y: 5, z: 5 },
intensity: 100,
falloffRadius: 0.3,
isSpotlight: true,
lifetime: 300 // Delete after 5 minutes.
});

EntityProperties-Line

EntityProperties-Line

Type: object

The "Line" EntityType draws thin, straight lines between a sequence of two or more points.

Deprecated: Use PolyLine entities instead.

EntityProperties-Model

EntityProperties-Model

Type: object

The "Model" EntityType displays a glTF, FBX, or OBJ model. It has these properties in addition to those found in EntityProperties.

Properties

NameTypeSummary
dimensions

Vec3

The dimensions of the entity.

Default Value: 0.1,0.1,0.1

modelURL

string

The URL of the glTF, FBX, or OBJ model. glTF models may be in JSON or binary format (".gltf" or ".glb" URLs respectively). Baked models' URLs have ".baked" before the file type. Model files may also be compressed in GZ format, in which case the URL ends in ".gz".

Default Value: ""

modelScale

Vec3

The scale factor applied to the model's dimensions.

Deprecated: This property is deprecated and will be removed.

animation

Entities.AnimationProperties

An animation to play on the model.

EntityProperties-PolyLine

EntityProperties-PolyLine

Type: object

The "PolyLine" EntityType draws textured, straight lines between a sequence of points. In addition to properties in EntityProperties, this type has the following properties:

Properties

NameTypeSummary
linePoints

Array.<Vec3>

The sequence of points to draw lines between. The values are relative to the entity's position. A maximum of 70 points can be specified.

Default Value: []

strokeWidths

Array.<number>

The widths, in m, of the line at the linePoints. Must be specified in order for the entity to render.

Default Value: []

strokeColors

Array.<Vec3>

The base colors of each point, with values in the range 0.0,0.0,0.01.0,1.0,1.0. These colors are multiplied with the color of the texture. If there are more line points than stroke colors, the color property value is used for the remaining points.

Warning: The ordinate values are in the range 0.01.0.

Default Value: []

Example: Draw a textured "V"
var entity = Entities.addEntity({
type: "PolyLine",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
rotation: MyAvatar.orientation,
linePoints: [
{ x: -1, y: 0.5, z: 0 },
{ x: 0, y: 0, z: 0 },
{ x: 1, y: 0.5, z: 0 }
],
strokeWidths: [ 0.1, 0.1, 0.1 ],
lifetime: 300 // Delete after 5 minutes.
});

EntityProperties-Shape

EntityProperties-Shape

Type: object

The "Shape" EntityType displays an entity of a specified shape. In addition to properties in EntityProperties, this type has the following properties:

Properties

NameTypeSummary
shape

Entities.Shape

The shape of the entity.

Default Value: "Sphere"

dimensions

Vec3

The dimensions of the entity.

Default Value: 0.1,0.1,0.1

color

Color

The color of the entity.

Default Value: 255,255,255

alpha

number

The opacity of the entity, range 0.01.0.

Default Value: 1

Example: Create a cylinder
var shape = Entities.addEntity({
type: "Shape",
shape: "Cylinder",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.4, y: 0.6, z: 0.4 },
lifetime: 300 // Delete after 5 minutes.
});

EntityProperties-Text

EntityProperties-Text

Type: object

The "Text" EntityType displays a 2D rectangle of text in the domain. In addition to properties in EntityProperties, this type has the following properties:

Properties

NameTypeSummary
dimensions

Vec3

The dimensions of the entity.

Default Value: 0.1,0.1,0.01

text

string

The text to display on the face of the entity. Text wraps if necessary to fit. New lines can be created using \n. Overflowing lines are not displayed.

Default Value: ""

lineHeight

number

The height of each line of text (thus determining the font size).

Default Value: 0.1

textColor

Color

The color of the text.

Default Value: 255,255,255

backgroundColor

Color

The color of the background rectangle.

Default Value: 0,0,0

leftMargin

number

The left margin, in meters.

Default Value: 0.0

rightMargin

number

The right margin, in meters.

Default Value: 0.0

topMargin

number

The top margin, in meters.

Default Value: 0.0

bottomMargin

number

The bottom margin, in meters.

Default Value: 0.0

font

string

The font to render the text with. It can be one of the following: "Courier","Inconsolata", "Roboto", "Timeless", or a path to a .sdff file.

Default Value: ""

Example: Create a text entity
var text = Entities.addEntity({
type: "Text",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.6, y: 0.3, z: 0.01 },
lineHeight: 0.12,
text: "Hello\nthere!",
lifetime: 300 // Delete after 5 minutes.
});

EntityProperties-Web

EntityProperties-Web

Type: object

The "Web" EntityType displays a browsable web page. Each user views their own copy of the web page: if one user navigates to another page on the entity, other users do not see the change; if a video is being played, users don't see it in sync. In addition to properties in EntityProperties, this type has the following properties:

Properties

NameTypeSummary
dimensions

Vec3

The dimensions of the entity.

Default Value: 0.1,0.1,0.01

sourceUrl

string

The URL of the web page to display. This value does not change as you or others navigate on the Web entity.

Default Value: ""

color

Color

The color of the web surface. This color tints the web page displayed: the pixel colors on the web page are multiplied by the property color. For example, a value of { red: 255, green: 0, blue: 0 } lets only the red channel of pixels' colors through.

Default Value: 255,255,255

dpi

number

The resolution to display the page at, in dots per inch. If you convert this to dots per meter (multiply by 1 / 0.0254 = 39.3701) then multiply dimensions.x and dimensions.y by that value you get the resolution in pixels.

Default Value: 30

scriptURL

string

The URL of a JavaScript file to inject into the web page.

Default Value: ""

maxFPS

number

The maximum update rate for the web content, in frames/second.

Default Value: 10

inputMode

WebInputMode

The user input mode to use.

Default Value: "touch"

Example: Create a Web entity displaying at 1920 x 1080 resolution
var METERS_TO_INCHES = 39.3701;
var entity = Entities.addEntity({
type: "Web",
sourceUrl: "https://highfidelity.com/",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -4 })),
rotation: MyAvatar.orientation,
dimensions: {
x: 3,
y: 3 * 1080 / 1920,
z: 0.01
},
dpi: 1920 / (3 * METERS_TO_INCHES),
lifetime: 300 // Delete after 5 minutes.
});

EntityPropertyInfo

EntityPropertyInfo

Type: object

Information about an entity property.

Properties

NameTypeSummary
propertyEnum

number

The internal number of the property.

minimum

string

The minimum numerical value the property may have, if available, otherwise "".

maximum

string

The maximum numerical value the property may have, if available, otherwise "".

EntityType

EntityType

Type: string

An entity may be one of the following types:

Properties

ValueDescriptionProperties

"Shape"

A basic entity such as a cube.

EntityProperties-Shape

"Model"

A mesh model from a glTF, FBX, or OBJ file.

EntityProperties-Model

"Text"

A pane of text oriented in space.

EntityProperties-Text

"Web"

A browsable web page.

EntityProperties-Web

"Line"

A sequence of one or more simple straight lines.

EntityProperties-Line

"PolyLine"

A sequence of one or more textured straight lines.

EntityProperties-PolyLine

"Light"

A local lighting effect.

EntityProperties-Light

PhysicsMotionType

PhysicsMotionType

Type: string

Properties

ValueDescription

"static"

There is no motion because the entity is locked — its locked property is set to true.

"kinematic"

Motion is applied without physical laws (e.g., damping) because the entity is not locked and has its dynamic property set to false.

"dynamic"

Motion is applied according to physical laws (e.g., damping) because the entity is not locked and has its dynamic property set to true.

RenderInfo

RenderInfo

Type: object

Information on how an entity is rendered. Properties are only filled in for Model entities; other entity types have an empty object, {}.

Properties

NameTypeSummary
verticesCount

number

The number of vertices in the entity.

texturesCount

number

The number of textures in the entity.

texturesSize

number

The total size of the textures in the entity, in bytes.

hasTransparent

boolean

true if any of the textures has transparency, false if none of them do.

drawCalls

number

The number of draw calls required to render the entity.

RenderLayer

RenderLayer

Type: string

A layer in which an entity may be rendered.

Properties

ValueDescription

"world"

The entity is drawn in the world with everything else.

"front"

The entity is drawn on top of the world layer but behind the HUD surface.

"hud"

The entity is drawn on top of other layers and the HUD surface.

Shape

Shape

Type: string

A "Shape" EntityType may display as one of the following geometrical shapes.

Properties

ValueDimensionsNotes

"Circle"

2D

A circle oriented in 3D.

"Cone"

3D

"Cube"

3D

"Cylinder"

3D

"Dodecahedron"

3D

"Hexagon"

3D

A hexagonal prism.

"Icosahedron"

3D

"Octagon"

3D

An octagonal prism.

"Octahedron"

3D

"Quad"

2D

A square oriented in 3D.

"Sphere"

3D

"Tetrahedron"

3D

"Torus"

3D

Not implemented.

"Triangle"

3D

A triangular prism.

TextEffect

TextEffect

Type: string

A Text entity may use one of the following effects:

Properties

ValueDescription

"none"

No effect.

"outline"

An outline effect.

"outlineFill"

An outline effect, with fill.

"shadow"

A shadow effect.


Method Details

addAction

(static) addAction( actionType, entityID, arguments ) → { Uuid }

Returns: The ID of the action if successfully added, otherwise null.

Adds an action to an entity. An action is registered with the physics engine and is applied every physics simulation step. Any entity may have more than one action associated with it, but only as many as will fit in an entity's actionData property.

Parameters

NameTypeDescription

actionType

Entities.ActionType

The type of action.

entityID

Uuid

The ID of the entity to add the action to.

arguments

Entities.ActionArguments

Configures the action.

Example: Constrain a cube to move along a vertical line
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.75, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
dynamic: true,
collisionless: false,
lifetime: 300 // Delete after 5 minutes.
});

var actionID = Entities.addAction("slider", entityID, {
axis: { x: 0, y: 1, z: 0 }
});

addEntity

(static) addEntity( properties, entityHostTypeopt ) → { Uuid }

Returns: The ID of the entity if successfully created, otherwise Uuid.NULL.

Adds a new domain, avatar, or local entity.

Parameters

NameTypeAttributesDefault ValueDescription

properties

Entities.EntityProperties

The properties of the entity to create.

entityHostType

Entities.EntityHostType

<optional>

"domain"

The type of entity to create.

Example: Create a box domain entity in front of your avatar
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
rotation: MyAvatar.orientation,
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
lifetime: 300 // Delete after 5 minutes.
});
print("Entity created: " + entityID);

appendPoint

(static) appendPoint( entityID, point ) → { boolean }

Returns: true if the point was added to the Line entity, otherwise false.

Appends a point to a Line entity.

Deprecated: This function is deprecated and will be removed. Use PolyLine entities instead.

callEntityClientMethod

(static) callEntityClientMethod( clientSessionID, entityID, method, parametersopt )

Calls a method in a specific user's client entity script from a server entity script. The entity script method must be exposed as a property in the target client entity script. Additionally, the client entity script must include the method's name in an exposed property called remotelyCallable that is an array of method names that can be called.

Parameters

NameTypeAttributesDefault ValueDescription

clientSessionID

Uuid

The session ID of the user to call the method in.

entityID

Uuid

The ID of the entity to call the method in.

method

string

The name of the method to call. The method is called with the entity ID as the first parameter and the parameters value as the second parameter.

parameters

Array.<string>

<optional>

[]

The additional parameters to call the specified method with.

Example: Call a method in a client entity script from a server entity script
// Client entity script.
var clientEntityScript = (function () {
this.entityMethod = function (id, params) {
print("Method at client entity : " + id + " ; " + params[0] + ", " + params[1]);
};
this.remotelyCallable = [
"entityMethod"
];
});

// Server entity script.
var serverEntityScript = (function () {
var clientSessionID,
clientEntityID;

function callClientMethod() {
// Server entity script call to client entity script.
Entities.callEntityClientMethod(clientSessionID, clientEntityID, "entityMethod", ["hello", 12]);
}

// Obtain client entity details then call client entity method.
this.entityMethod = function (id, params) {
clientSessionID = params[0];
clientEntityID = params[1];
callClientMethod();
};
this.remotelyCallable = [
"entityMethod"
];
});

// Entity that hosts the client entity script.
var clientEntityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: -1, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
script: "(" + clientEntityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

// Entity that hosts the server entity script.
var serverEntityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 1, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
serverScripts: "(" + serverEntityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

// Interface script call to the server entity script.
Script.setTimeout(function () {
Entities.callEntityServerMethod(serverEntityID, "entityMethod", [MyAvatar.sessionUUID, clientEntityID]);
}, 1000); // Wait for the entities to be created.

callEntityMethod

(static) callEntityMethod( entityID, method, parametersopt )

Calls a method in a client entity script from an Interface, avatar, or client entity script, or calls a method in a server entity script from a server entity script. The entity script method must be exposed as a property in the target entity script. Additionally, if calling a server entity script, the server entity script must include the method's name in an exposed property called remotelyCallable that is an array of method names that can be called.

Parameters

NameTypeAttributesDefault ValueDescription

entityID

Uuid

The ID of the entity to call the method in.

method

string

The name of the method to call. The method is called with the entity ID as the first parameter and the parameters value as the second parameter.

parameters

Array.<string>

<optional>

[]

The additional parameters to call the specified method with.

Example: Call a method in a client entity script from an Interface script
// Client entity script.
var entityScript = (function () {
this.entityMethod = function (id, params) {
print("Method at entity : " + id + " ; " + params[0] + ", " + params[1]);
};
});

// Entity that hosts the client entity script.
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
script: "(" + entityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

// Interface script call to the client entity script.
Script.setTimeout(function () {
Entities.callEntityMethod(entityID, "entityMethod", ["hello", 12]);
}, 1000); // Wait for the entity to be created.

callEntityServerMethod

(static) callEntityServerMethod( entityID, method, parametersopt )

Calls a method in a server entity script from an Interface, avatar, or client entity script. The server entity script method must be exposed as a property in the target server entity script. Additionally, the server entity script must include the method's name in an exposed property called remotelyCallable that is an array of method names that can be called.

Parameters

NameTypeAttributesDefault ValueDescription

entityID

Uuid

The ID of the entity to call the method in.

method

string

The name of the method to call. The method is called with the entity ID as the first parameter and the parameters value as the second parameter.

parameters

Array.<string>

<optional>

[]

The additional parameters to call the specified method with.

Example: Call a method in a server entity script from an Interface script
// Server entity script.
var entityScript = (function () {
this.entityMethod = function (id, params) {
print("Method at entity : " + id + " ; " + params[0] + ", " + params[1]); // In server log.
};
this.remotelyCallable = [
"entityMethod"
];
});

// Entity that hosts the server entity script.
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
serverScripts: "(" + entityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

// Interface script call to the server entity script.
Script.setTimeout(function () {
Entities.callEntityServerMethod(entityID, "entityMethod", ["hello", 12]);
}, 1000); // Wait for the entity to be created.

canGetAndSetPrivateUserData

(static) canGetAndSetPrivateUserData( ) → { boolean }

Returns: true if the domain server will allow the script to get and set the privateUserData property of entities, otherwise false.

Checks whether or not the script can get and set the privateUserData property of entities.

canReplaceContent

(static) canReplaceContent( ) → { boolean }

Returns: true if the domain server will allow the script to replace the domain's content set, otherwise false.

Checks whether or not the script can replace the domain's content set.

canWriteAssets

(static) canWriteAssets( ) → { boolean }

Returns: true if the domain server will allow the script to make changes to the asset server's assets, otherwise false.

Checks whether or not the script can make changes to the asset server's assets.

cloneEntity

(static) cloneEntity( entityID ) → { Uuid }

Returns: The ID of the new entity if successfully cloned, otherwise Uuid.NULL.

Creates a clone of an entity. The clone has the same properties as the original except that: it has a modified name property, clone-related properties are set per the original entity's clone-related properties (e.g., cloneLifetime), and its clone-related properties are set to their defaults.

Domain entities must have their cloneable property value be true in order to be cloned. A domain entity can be cloned by a client that doesn't have rez permissions in the domain.

Avatar entities must have their cloneable and cloneAvatarEntity property values be true in order to be cloned.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to clone.

deleteAction

(static) deleteAction( entityID, actionID ) → { boolean }

Returns: true if the delete was successful, otherwise false.

Deletes an action from an entity.

Parameters

NameTypeDescription

entityID

Uuid

The ID of entity to delete the action from.

actionID

Uuid

The ID of the action to delete.

deleteEntity

(static) deleteEntity( entityID )

Deletes an entity.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to delete.

Example: Delete an entity a few seconds after creating it
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
rotation: MyAvatar.orientation,
dimensions: { x: 0.5, y: 0.5, z: 0.5 }
});

Script.setTimeout(function () {
Entities.deleteEntity(entityID);
}, 3000);

editEntity

(static) editEntity( entityID, properties ) → { Uuid }

Returns: The ID of the entity if the edit was successful, otherwise null or Uuid.NULL.

Edits an entity, changing one or more of its property values.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to edit.

properties

Entities.EntityProperties

The new property values.

Example: Change the color of an entity
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
rotation: MyAvatar.orientation,
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
lifetime: 300 // Delete after 5 minutes.
});
var properties = Entities.getEntityProperties(entityID, ["color"]);
print("Entity color: " + JSON.stringify(properties.color));

Script.setTimeout(function () { // Wait for the entity to be created before editing.
Entities.editEntity(entityID, {
color: { red: 255, green: 0, blue: 0 }
});
properties = Entities.getEntityProperties(entityID, ["color"]);
print("Entity color: " + JSON.stringify(properties.color));
}, 50);

emitScriptEvent

(static) emitScriptEvent( entityID, message )

Sends a message to a Web entity's HTML page. To receive the message, the web page's script must connect to the EventBridge that is automatically provided to the script:

EventBridge.scriptEventReceived.connect(function(message) {
...
});

Use Entities.webEventReceived to receive messages from the Web entity's HTML page. Alternatively, use Entities.getEntityObject to exchange messages over a Web entity's HTML event bridge.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the Web entity to send the message to.

message

string

The message to send.

Example: Exchange messages with a Web entity
// HTML file, name: "webEntity.html".
<!DOCTYPE html>
<html>
<head>
<title>HELLO</title>
</head>
<body>
<h1>HELLO</h1>
<script>
function onScriptEventReceived(message) {
// Message received from the script.
console.log("Message received: " + message);
}

EventBridge.scriptEventReceived.connect(onScriptEventReceived);

setTimeout(function () {
// Send a message to the script.
EventBridge.emitWebEvent("hello");
}, 5000);
</script>
</body>
</html>

// Script file.
var webEntity = Entities.addEntity({
type: "Web",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -3 })),
rotation: MyAvatar.orientation,
sourceUrl: Script.resolvePath("webEntity.html"),
alpha: 1.0,
lifetime: 300 // 5 min
});

function onWebEventReceived(entityID, message) {
if (entityID === webEntity) {
// Message received.
print("Message received: " + message);

// Send a message back.
Entities.emitScriptEvent(webEntity, message + " back");
}
}

Entities.webEventReceived.connect(onWebEventReceived);

findClosestEntity

(static) findClosestEntity( center, radius ) → { Uuid }

Returns: The ID of the entity that is closest to the center and within the radius, if there is one, otherwise null.

Finds the domain or avatar entity with a position closest to a specified point and within a specified radius.

Parameters

NameTypeDescription

center

Vec3

The point about which to search.

radius

number

The radius within which to search.

Example: Find the closest entity within 10m of your avatar
var entityID = Entities.findClosestEntity(MyAvatar.position, 10);
print("Closest entity: " + entityID);

findEntities

(static) findEntities( center, radius ) → { Array.<Uuid> }

Returns: An array of entity IDs that intersect the search sphere. The array is empty if no entities could be found.

Finds all domain and avatar entities that intersect a sphere.

Parameters

NameTypeDescription

center

Vec3

The point about which to search.

radius

number

The radius within which to search.

Example: Report how many entities are within 10m of your avatar
var entityIDs = Entities.findEntities(MyAvatar.position, 10);
print("Number of entities within 10m: " + entityIDs.length);

getActionArguments

(static) getActionArguments( entityID, actionID ) → { Entities.ActionArguments }

Returns: The arguments of the action if found, otherwise an empty object.

Gets the arguments of an action.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity with the action.

actionID

Uuid

The ID of the action to get the arguments of.

getActionIDs

(static) getActionIDs( entityID ) → { Array.<Uuid> }

Returns: The action IDs if any are found, otherwise an empty array.

Gets the IDs of the actions that are associated with an entity.

Parameters

NameTypeDescription

entityID

Uuid

The entity to get the action IDs for.

getEntityObject

(static) getEntityObject( id ) → { object }

Returns: The script object for the entity if found.

Gets an entity's script object. In particular, this is useful for accessing a Web entity's HTML EventBridge script object to exchange messages with the web page script.

To send a message from an Interface script to a Web entity over its event bridge:

var entityObject = Entities.getEntityObject(entityID);
entityObject.emitScriptEvent(message);

To receive a message from a Web entity over its event bridge in an Interface script:

var entityObject = Entities.getentityObject(entityID);
entityObject.webEventReceived.connect(function(message) {
...
};

Alternatively, use Entities.emitScriptEvent and Entities.webEventReceived to exchange messages with a Web entity over its event bridge.

Parameters

NameTypeDescription

id

Uuid

The ID of the entity to get the script object for.

Example: Exchange messages with a Web entity
// HTML file, name: "webEntity.html".
<!DOCTYPE html>
<html>
<head>
<title>HELLO</title>
</head>
<body>
<h1>HELLO</h1>
<script>
function onScriptEventReceived(message) {
// Message received from the script.
console.log("Message received: " + message);
}

EventBridge.scriptEventReceived.connect(onScriptEventReceived);

setTimeout(function () {
// Send a message to the script.
EventBridge.emitWebEvent("hello");
}, 5000);
</script>
</body>
</html>

// Interface script file.
var webEntity = Entities.addEntity({
type: "Web",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -3 })),
rotation: MyAvatar.orientation,
sourceUrl: Script.resolvePath("webEntity.html"),
alpha: 1.0,
lifetime: 300 // 5 min
});

var webEntityObject;

function onWebEventReceived(message) {
// Message received.
print("Message received: " + message);

// Send a message back.
webEntityObject.emitScriptEvent(message + " back");
}

Script.setTimeout(function () {
webEntityObject = Entities.getEntityObject(webEntity);
webEntityObject.webEventReceived.connect(onWebEventReceived);
}, 500);

Script.scriptEnding.connect(function () {
Entities.deleteEntity(webEntity);
});

getEntityProperties

(static) getEntityProperties( entityID, desiredPropertiesopt )
   { Entities.EntityProperties }

Returns: The specified properties of the entity if the entity can be found, otherwise an empty object. If no properties are specified, then all properties are returned.

Gets an entity's property values.

Parameters

NameTypeAttributesDefault ValueDescription

entityID

Uuid

The ID of the entity to get the properties of.

desiredProperties

string | Array.<string>

<optional>

[]

The name or names of the properties to get. For properties that are objects (e.g., the "keyLight" property), use the property and subproperty names in dot notation (e.g., "keyLight.color").

Example: Report the color of a new box entity
var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
rotation: MyAvatar.orientation,
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
lifetime: 300 // Delete after 5 minutes.
});
var properties = Entities.getEntityProperties(entityID, ["color"]);
print("Entity color: " + JSON.stringify(properties.color));

getEntityType

(static) getEntityType( id ) → { Entities.EntityType }

Returns: The type of the entity.

Gets an entity's type.

Parameters

NameTypeDescription

id

Uuid

The ID of the entity to get the type of.

reloadServerScripts

(static) reloadServerScripts( entityID ) → { boolean }

Returns: true if the reload request was successfully sent to the server, otherwise false.

Reloads an entity's server entity script such that the latest version re-downloaded.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to reload the server entity script of.

sendClickDownOnEntity

(static) sendClickDownOnEntity( entityID, event )

Emits a clickDownOnEntity event.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to emit the event for.

event

PointerEvent

The event details.

sendClickReleaseOnEntity

(static) sendClickReleaseOnEntity( entityID, event )

Emits a clickReleaseOnEntity event.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity to emit the event for.

event

PointerEvent

The event details.

serversExist

(static) serversExist( ) → { boolean }

Returns: true if servers exist for the client to send entity packets to, otherwise false.

Checks whether servers exist for the client to send entity packets to, i.e., whether you are connected to a domain and its entity server is working.

setPacketsPerSecond

(static) setPacketsPerSecond( packetsPerSecond )

Sets the maximum number of entity packets that the client can send per second.

Parameters

NameTypeDescription

packetsPerSecond

number

Integer maximum number of entity packets that the client can send per second.

textSize

(static) textSize( id, text ) → { Size }

Returns: The size of the text in meters if the object is a text entity, otherwise { height: 0, width : 0 }.

Calculates the size of some text in a Text entity. The entity need not be set visible.

Note: The size of text in a Text entity cannot be calculated immediately after the entity is created; a short delay is required while the entity finishes being created.

Parameters

NameTypeDescription

id

Uuid

The ID of the Text entity to use for calculation.

text

string

The string to calculate the size of.

updateAction

(static) updateAction( entityID, actionID, arguments ) → { boolean }

Returns: true if the update was successful, otherwise false.

Updates an entity action.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity with the action to update.

actionID

Uuid

The ID of the action to update.

arguments

Entities.ActionArguments

The arguments to update.


Signal Details

addingEntity

addingEntity( entityID )

Returns: Signal

Triggered when an entity is added to Interface's local in-memory tree of entities it knows about. This may occur when entities are loaded upon visiting a domain, when the user rotates their view so that more entities become visible, and when any type of entity is created (e.g., by addEntity).

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity added.

Example: Report when an entity is added
Entities.addingEntity.connect(function (entityID) {
print("Added entity: " + entityID);
});

canGetAndSetPrivateUserDataChanged

canGetAndSetPrivateUserDataChanged( canGetAndSetPrivateUserData )

Returns: Signal

Triggered when your ability to get and set private user data changes.

Parameters

NameTypeDescription

canGetAndSetPrivateUserData

boolean

true if the script change the privateUserData property of an entity, false if it can't.

clearingEntities

clearingEntities( )

Returns: Signal

Triggered when you disconnect from a domain, at which time Interface's local in-memory tree of entities that it knows about is cleared.

Example: Report when Interfaces's entity tree is cleared
Entities.clearingEntities.connect(function () {
print("Entities cleared");
});

clickDownOnEntity

clickDownOnEntity( entityID, event )

Returns: Signal

Triggered when a mouse button is clicked while the mouse cursor is on an entity. Note: Not triggered by controllers.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that was clicked on.

event

PointerEvent

Details of the event.

Example: Compare clickDownOnEntity signal and entity script method
var entityScript = (function () {
// Method is called for only this entity.
this.clickDownOnEntity = function (entityID, event) {
print("Entity : Clicked sphere ; " + event.type);
};
});

var sphereID = Entities.addEntity({
type: "Sphere",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
script: "(" + entityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

Entities.clickDownOnEntity.connect(function (entityID, event) {
// Signal is triggered for all entities.
if (entityID === sphereID) {
print("Interface : Clicked sphere ; " + event.type);
} else {
print("Interface : Clicked another entity ; " + event.type);
}
});

clickReleaseOnEntity

clickReleaseOnEntity( entityID, event )

Returns: Signal

Triggered when a mouse button is released after clicking on an entity, even if the mouse cursor has moved off the entity. Note: Not triggered by controllers.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that was originally clicked.

event

PointerEvent

Details of the event.

collisionWithEntity

collisionWithEntity( idA, idB, collision )

Returns: Signal

Triggered on the client that is the physics simulation owner during the collision of two entities. Note: Isn't triggered for a collision with an avatar.

See also, Entity Methods and Script.addEventHandler.

Parameters

NameTypeDescription

idA

Uuid

The ID of one entity in the collision. For an entity script, this is the ID of the entity containing the script.

idB

Uuid

The ID of the other entity in the collision.

collision

Collision

The details of the collision.

Example: Change the color of an entity when it collides with another entity
var entityScript = (function () {
function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

this.collisionWithEntity = function (myID, otherID, collision) {
Entities.editEntity(myID, {
color: {
red: randomInteger(128, 255),
green: randomInteger(128, 255),
blue: randomInteger(128, 255)
}
});
};
});

var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
color: { red: 128, green: 128, blue: 128 },
dynamic: true,
collisionless: false, // So that collision events are generated.
script: "(" + entityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

deletingEntity

deletingEntity( entityID )

Returns: Signal

Triggered when an entity is deleted.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity deleted.

Example: Report when an entity is deleted
Entities.deletingEntity.connect(function (entityID) {
print("Deleted entity: " + entityID);
});

enterEntity

enterEntity( entityID )

Returns: Signal

Triggered when an avatar enters an entity, but only if the entity has an entity method exposed for this event.

See also, Entity Methods and Script.addEventHandler.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that the avatar entered.

leaveEntity

leaveEntity( entityID )

Returns: Signal

Triggered when an avatar leaves an entity, but only if the entity has an entity method exposed for this event.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that the avatar left.

preload

preload( entityID )

Returns: Signal

Triggered when the script starts for a user. See also, Script.entityScriptPreloadFinished.

Note: Can only be connected to via this.preload = function (...) { ... } in the entity script.

Supported Script Types: Client Entity Scripts • Server Entity Scripts

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that the script is running in.

Example: Get the ID of the entity that a client entity script is running in
var entityScript = (function () {
this.entityID = Uuid.NULL;

this.preload = function (entityID) {
this.entityID = entityID;
print("Entity ID: " + this.entityID);
};
});

var entityID = Entities.addEntity({
type: "Shape",
shape: "cube",
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 })),
dimensions: { x: 0.5, y: 0.5, z: 0.5 },
color: { red: 255, green: 0, blue: 0 },
script: "(" + entityScript + ")", // Could host the script on a Web server instead.
lifetime: 300 // Delete after 5 minutes.
});

unload

unload( entityID )

Returns: Signal

Triggered when the script terminates for a user.

Note: Can only be connected to via this.unload = function () { ... } in the entity script.

Supported Script Types: Client Entity Scripts • Server Entity Scripts

Parameters

NameTypeDescription

entityID

Uuid

The ID of the entity that the script is running in.

webEventReceived

webEventReceived( entityID, message )

Returns: Signal

Triggered when a script in a Web entity's HTML sends an event over the entity's HTML event bridge. The HTML web page can send a message by calling EventBridge.emitWebEvent(message);

Use Entities.emitScriptEvent to send messages to the Web entity's HTML page. Alternatively, use Entities.getEntityObject to exchange messages over a Web entity's HTML event bridge.

Parameters

NameTypeDescription

entityID

Uuid

The ID of the Web entity that the message was received from.

message

string

The message received.