Description
Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts
TheOverlays
API provides facilities to create and interact with overlays. These are 2D and 3D objects visible
only to yourself and that aren't persisted to the domain. They are used for UI.
Note: 3D overlays are local Entities, internally, so many of the methods also work with entities.
3D overlays are deprecated: Use local Entities for these instead.
Properties
Name | Type | Summary |
---|---|---|
keyboardFocusOverlay | Uuid |
The |
Methods
Name | Return Value | Summary |
---|---|---|
addOverlay
|
Uuid |
Adds an overlay to the scene. |
cloneOverlay
|
Uuid |
Creates a clone of an existing overlay (or entity). Note: For cloning behavior of 3D overlays and entities, see Entities.cloneEntity. |
deleteOverlay
|
None |
Deletes an overlay (or entity). |
editOverlay
|
boolean |
Edits an overlay's (or entity's) properties. |
editOverlays
|
boolean |
Edits the properties of multiple overlays (or entities). |
findOverlays
|
Array.<Uuid> |
Gets a list of visible 3D overlays (local entities) with bounding boxes that touch a search sphere. |
findRayIntersection
|
Overlays.RayToOverlayIntersectionResult |
Finds the closest 3D overlay (or local entity) intersected by a PickRay. |
getKeyboardFocusOverlay
|
Uuid |
Gets the ID of the |
getOverlayAtPoint
|
Uuid |
Gets the ID of the 2D overlay at a particular point on the desktop screen or HUD surface. |
getOverlayObject
|
object |
Gets an overlay's (or entity's) script object. In particular, this is useful for accessing a
To send a message from an Interface script to a
To receive a message from a
|
getOverlaysProperties
|
object.<Uuid, Overlays.OverlayProperties> |
Gets the values of multiple overlays' (or entities') properties. |
getOverlayType
|
Overlays.OverlayType |
Gets the type of an overlay. |
getProperties
|
Overlays.OverlayProperties |
Gets specified property values of a 3D overlay (or entity). Note: 2D overlays' property values cannot be retrieved. |
getProperty
|
object |
Gets a specified property value of a 3D overlay (or entity). Note: 2D overlays' property values cannot be retrieved. |
height
|
number |
Gets the height of the Interface window or HUD surface. |
isAddedOverlay
|
boolean |
Checks if an overlay (or entity) exists. |
isLoaded
|
boolean |
Checks whether an overlay's (or entity's) assets have been loaded. For example, for an
|
sendHoverEnterOverlay
|
None |
Generates a hover enter event on an overlay (or local entity). |
sendHoverLeaveOverlay
|
None |
Generates a hover leave event on an overlay (or local entity). |
sendHoverOverOverlay
|
None |
Generates a hover over event on an overlay (or entity). |
sendMouseMoveOnOverlay
|
None |
Generates a mouse move event on an overlay (or local entity). |
sendMousePressOnOverlay
|
None |
Generates a mouse press event on an overlay (or local entity). |
sendMouseReleaseOnOverlay
|
None |
Generates a mouse release event on an overlay (or local entity). |
setKeyboardFocusOverlay
|
None |
Sets the |
textSize
|
Size |
Calculates the size of some text in a text overlay (or entity). The overlay (or entity) need not be set visible. Note: The size of text in a 3D overlay (or entity) cannot be calculated immediately after the overlay (or entity) is created; a short delay is required while the overlay (or entity) finishes being created. |
width
|
number |
Gets the width of the Interface window or HUD surface. |
Signals
Name | Summary |
---|---|
hoverEnterOverlay
|
Triggered when a mouse cursor starts hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverEnterOverlay for a 2D overlay). |
hoverLeaveOverlay
|
Triggered when a mouse cursor finishes hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverLeaveOverlay for a 2D overlay). |
hoverOverOverlay
|
Triggered when a mouse cursor continues hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverOverOverlay for a 2D overlay). |
mouseDoublePressOffOverlay
|
Triggered when a mouse double press event occurs on something other than a 3D overlay. |
mouseDoublePressOnOverlay
|
Triggered when a mouse double press event occurs on an overlay. Only occurs for 3D overlays. |
mouseMoveOnOverlay
|
Triggered when a mouse move event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMouseMoveOnOverlay for a 2D overlay). |
mousePressOffOverlay
|
Triggered when a mouse press event occurs on something other than a 3D overlay. |
mousePressOnOverlay
|
Triggered when a mouse press event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMousePressOnOverlay for a 2D overlay). |
mouseReleaseOnOverlay
|
Triggered when a mouse release event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMouseReleaseOnOverlay for a 2D overlay). |
overlayDeleted
|
Triggered when an overlay (or entity) is deleted. |
Type Definitions
OverlayProperties Type: object |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Different overlay types have different properties: some common to all overlays (listed in the table) and some specific to each OverlayType (linked to below). 3D overlays are local entities, internally, so they also support the relevant entity's properties. Properties
See:
|
OverlayProperties-Circle3D Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Cube Type: object |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Grid Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Image Type: object |
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Properties
|
OverlayProperties-Image3D Type: object |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Line3D Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Model Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Rectangle Type: object |
||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Properties
|
OverlayProperties-Rectangle3D Type: object |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Shape Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Sphere Type: object |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Text Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Properties
|
OverlayProperties-Text3D Type: object |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayProperties-Web3D Type: object |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The Deprecated: Use local Entities instead. Properties
|
OverlayType Type: string |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
An overlay may be one of the following types:
2D overlays are rendered on the display surface in desktop mode and on the HUD surface in HMD mode. 3D overlays are rendered at a position and orientation in-world. 3D overlays are deprecated. Use local Entities instead. |
RayToOverlayIntersectionResult Type: object |
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The result of a PickRay search using findRayIntersection. Properties
|
Shape Type: string |
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A
|
Method Details
(static) addOverlay( type, properties ) → {Uuid}
Returns: The ID of the newly created overlay if successful, otherwise Uuid.NULL. |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Adds an overlay to the scene. Parameters
Example
|
(static) cloneOverlay( id ) → {Uuid}
Returns: The ID of the new overlay (or entity) if successful, otherwise Uuid.NULL. |
||||||
---|---|---|---|---|---|---|
Creates a clone of an existing overlay (or entity). Note: For cloning behavior of 3D overlays and entities, see Entities.cloneEntity. Parameters
|
(static) deleteOverlay( id ) | ||||||
---|---|---|---|---|---|---|
Deletes an overlay (or entity). Parameters
|
(static) editOverlay( id, properties ) → {boolean}
Returns: false if Interface is exiting. Otherwise, if a 2D overlay then true always,
and if a 3D overlay then true if the overlay was found and edited, otherwise false .
|
|||||||||
---|---|---|---|---|---|---|---|---|---|
Edits an overlay's (or entity's) properties. Parameters
Example
|
(static) editOverlays( propertiesById ) → {boolean}
Returns: false if Interface is exiting, otherwise true .
|
||||||
---|---|---|---|---|---|---|
Edits the properties of multiple overlays (or entities). Parameters
Example
|
(static) findOverlays( center, radius ) → {Array.<Uuid>}
Returns: The IDs of the overlays (local entities) that are visible and have bounding boxes that touch a search sphere. |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Gets a list of visible 3D overlays (local entities) with bounding boxes that touch a search sphere. Parameters
Example
|
(static) findRayIntersection( pickRay, precisionPickingopt, includeopt, discardopt, visibleOnlyopt, collideableOnlyopt ) → {Overlays.RayToOverlayIntersectionResult}
Returns: The result of the search for the first intersected overlay (or local entity. |
|||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Finds the closest 3D overlay (or local entity) intersected by a PickRay. Parameters
Example
|
(static) getKeyboardFocusOverlay( ) → {Uuid}
Returns: The ID of the "web3d" overlay
(Web entity) that has focus, if any, otherwise null .
|
---|
Gets the ID of the |
(static) getOverlayAtPoint( point ) → {Uuid}
Returns: The ID of the 2D overlay at the specified point if found, otherwise null .
|
||||||
---|---|---|---|---|---|---|
Gets the ID of the 2D overlay at a particular point on the desktop screen or HUD surface. Parameters
Example
|
(static) getOverlayObject( overlayID ) → {object}
Returns: The script object for the overlay if found. |
||||||
---|---|---|---|---|---|---|
Gets an overlay's (or entity's) script object. In particular, this is useful for accessing a
To send a message from an Interface script to a
To receive a message from a
Parameters
Example
|
(static) getOverlaysProperties( propertiesById ) → {object.<Uuid, Overlays.OverlayProperties>}
Returns: An object with overlay (or entity) IDs as keys and OverlayProperties as values. |
||||||
---|---|---|---|---|---|---|
Gets the values of multiple overlays' (or entities') properties. Parameters
Example
|
(static) getOverlayType( id ) → {Overlays.OverlayType}
Returns: The type of the overlay if found, otherwise "unknown" .
|
||||||
---|---|---|---|---|---|---|
Gets the type of an overlay. Parameters
Example
|
(static) getProperties( id, properties ) → {Overlays.OverlayProperties}
Returns: The values of valid properties if the overlay can be found, otherwise an empty object. |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Gets specified property values of a 3D overlay (or entity). Note: 2D overlays' property values cannot be retrieved. Parameters
Example
|
(static) getProperty( id, property ) → {object}
Returns: The value of the property if the 3D overlay and property can be found, otherwise undefined .
|
|||||||||
---|---|---|---|---|---|---|---|---|---|
Gets a specified property value of a 3D overlay (or entity). Note: 2D overlays' property values cannot be retrieved. Parameters
Example
|
(static) height( ) → {number}
Returns: The height, in pixels, of the Interface window if in desktop mode or the HUD surface if in HMD mode. |
---|
Gets the height of the Interface window or HUD surface. |
(static) isAddedOverlay( id ) → {boolean}
Returns: true if an overlay (or entity) with the given ID exists, false if it doesn't.
|
||||||
---|---|---|---|---|---|---|
Checks if an overlay (or entity) exists. Parameters
|
(static) isLoaded( id ) → {boolean}
Returns: true if the overlay's (or entity's) assets have been loaded, otherwise
false .
|
||||||
---|---|---|---|---|---|---|
Checks whether an overlay's (or entity's) assets have been loaded. For example, for an
Parameters
Example
|
(static) sendHoverEnterOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a hover enter event on an overlay (or local entity). Parameters
|
(static) sendHoverLeaveOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a hover leave event on an overlay (or local entity). Parameters
|
(static) sendHoverOverOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a hover over event on an overlay (or entity). Parameters
|
(static) sendMouseMoveOnOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a mouse move event on an overlay (or local entity). Parameters
|
(static) sendMousePressOnOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a mouse press event on an overlay (or local entity). Parameters
Example
|
(static) sendMouseReleaseOnOverlay( id, event ) | |||||||||
---|---|---|---|---|---|---|---|---|---|
Generates a mouse release event on an overlay (or local entity). Parameters
|
(static) setKeyboardFocusOverlay( id ) | ||||||
---|---|---|---|---|---|---|
Sets the Parameters
|
(static) textSize( id, text ) → {Size}
Returns: The size of the text if the object is a text overlay (or entity), otherwise
{ height: 0, width : 0 } . If the object is a 2D overlay, the size is in pixels; if the object is a 3D
overlay (or entity), the size is in meters.
|
|||||||||
---|---|---|---|---|---|---|---|---|---|
Calculates the size of some text in a text overlay (or entity). The overlay (or entity) need not be set visible. Note: The size of text in a 3D overlay (or entity) cannot be calculated immediately after the overlay (or entity) is created; a short delay is required while the overlay (or entity) finishes being created. Parameters
Example
|
(static) width( ) → {number}
Returns: The width, in pixels, of the Interface window if in desktop mode or the HUD surface if in HMD mode. |
---|
Gets the width of the Interface window or HUD surface. |
Signal Details
hoverEnterOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse cursor starts hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverEnterOverlay for a 2D overlay). Parameters
Example
|
hoverLeaveOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse cursor finishes hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverLeaveOverlay for a 2D overlay). Parameters
|
hoverOverOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse cursor continues hovering over an overlay. Only occurs for 3D overlays (unless you use sendHoverOverOverlay for a 2D overlay). Parameters
|
mouseDoublePressOffOverlay(
)
Returns: Signal |
---|
Triggered when a mouse double press event occurs on something other than a 3D overlay. |
mouseDoublePressOnOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse double press event occurs on an overlay. Only occurs for 3D overlays. Parameters
|
mouseMoveOnOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse move event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMouseMoveOnOverlay for a 2D overlay). Parameters
|
mousePressOffOverlay(
)
Returns: Signal |
---|
Triggered when a mouse press event occurs on something other than a 3D overlay. |
mousePressOnOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse press event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMousePressOnOverlay for a 2D overlay). Parameters
Example
|
mouseReleaseOnOverlay(
id,
event
)
Returns: Signal |
|||||||||
---|---|---|---|---|---|---|---|---|---|
Triggered when a mouse release event occurs on an overlay. Only occurs for 3D overlays (unless you use sendMouseReleaseOnOverlay for a 2D overlay). Parameters
|
overlayDeleted(
id
)
Returns: Signal |
||||||
---|---|---|---|---|---|---|
Triggered when an overlay (or entity) is deleted. Parameters
Example
|