Skip to main content

Class: Scene

Defined in: livelink.clients/livelink.js/sources/scene/Scene.ts:17

The browser Scene, producing the proxied browser Entity.

It reuses all the shared headless scene logic and only specializes the entity factory so that every scene method returns the browser entity flavour (proxied component access + transform helpers).

Extends​

Methods​

addEventListener()​

addEventListener<_EventName>(
event_name: _EventName,
listener: (event: SceneEvents<Entity>[_EventName]) => void,
options?: boolean | AddEventListenerOptions): void;

Defined in: livelink.clients/livelink.base/sources/TypedEventTarget.ts:10

Type Parameters​

Type Parameter
_EventName extends | "on-entities-created" | "on-entities-deleted" | "on-scene-settings-updated"

Parameters​

ParameterType
event_name_EventName
listener(event: SceneEvents<Entity>[_EventName]) => void
options?boolean | AddEventListenerOptions

Returns​

void

Inherited from​

SceneBase.addEventListener;

removeEventListener()​

removeEventListener<_EventName>(
event_name: _EventName,
listener: (event: SceneEvents<Entity>[_EventName]) => void,
options?: boolean | EventListenerOptions): void;

Defined in: livelink.clients/livelink.base/sources/TypedEventTarget.ts:21

Type Parameters​

Type Parameter
_EventName extends | "on-entities-created" | "on-entities-deleted" | "on-scene-settings-updated"

Parameters​

ParameterType
event_name_EventName
listener(event: SceneEvents<Entity>[_EventName]) => void
options?boolean | EventListenerOptions

Returns​

void

Inherited from​

SceneBase.removeEventListener;

newEntity()​

newEntity(params: {
name: string;
components: ComponentsManifest;
options?: {
delete_on_client_disconnection?: boolean;
auto_broadcast?: boolean;
};
parent?: Entity | null;
}): Promise<Entity>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:222

Create a new entity.

Parameters​

ParameterTypeDescription
params{ name: string; components: ComponentsManifest; options?: { delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }; parent?: Entity | null; }-
params.namestringThe name of the entity.
params.componentsComponentsManifestThe components to add to the entity with their initial values. If no initial values are provided, the default values are used.
params.options?{ delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }Additional options for the entity creation.
params.options.delete_on_client_disconnection?booleanWhether to delete the entity when the client disconnects.
params.options.auto_broadcast?booleanDeprecated Whether to broadcast the entity automatically.
params.parent?Entity | null-

Returns​

Promise<Entity>

A promise that resolves to the created entity.

Example​

const entity = await scene.newEntity({
name: "My Entity",
components: {
local_transform: {
position: [0, 2, 0],
// default values are used for scale and orientation
},
},
});

Inherited from​

SceneBase.newEntity;

newEntities()​

newEntities(params: {
components_array: ComponentsManifest[];
options?: {
delete_on_client_disconnection?: boolean;
auto_broadcast?: boolean;
};
}): Promise<Entity[]>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:255

Create multiple entities at once. This method is more efficient than calling newEntity multiple times. It creates all entities in a single call to the core.

Parameters​

ParameterTypeDescription
params{ components_array: ComponentsManifest[]; options?: { delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }; }-
params.components_arrayComponentsManifest[]An array of objects with the name and components of each entity.
params.options?{ delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }Additional options for the entity creation.
params.options.delete_on_client_disconnection?booleanWhether to delete the entity when the client disconnects.
params.options.auto_broadcast?booleanDeprecated Whether to broadcast the entity automatically.

Returns​

Promise<Entity[]>

A promise that resolves to an array of the created entities.

Inherited from​

SceneBase.newEntities;

findEntity()​

findEntity(params: {
entity_uuid: UUID;
linkage?: UUID[];
}): Promise<Entity | null>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:283

Find an entity by its UUID and linkage.

Parameters​

ParameterTypeDescription
params{ entity_uuid: UUID; linkage?: UUID[]; }-
params.entity_uuidUUIDThe UUID of the entity to find.
params.linkage?UUID[]The linkage of the entity to find.

Returns​

Promise<Entity | null>

A promise that resolves to the found entity or null if not found.

Inherited from​

SceneBase.findEntity;

findEntities()​

findEntities(params: {
entity_uuid: UUID;
}): Promise<Entity[]>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:325

Find entities by their UUID.

This can return multiple entities if the entity is a child of a Components.SceneRef that is instanced multiple times.

Parameters​

ParameterTypeDescription
params{ entity_uuid: UUID; }-
params.entity_uuidUUIDThe UUID of the entity to find.

Returns​

Promise<Entity[]>

A promise that resolves to an array of entities with the given UUID.

Inherited from​

SceneBase.findEntities;

deleteEntities()​

deleteEntities(params: {
entities: Entity[];
}): Promise<void>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:346

Delete a batch of entities.

Parameters​

ParameterTypeDescription
params{ entities: Entity[]; }-
params.entitiesEntity[]The entities to delete.

Returns​

Promise<void>

A promise that resolves when the entities are deleted.

Inherited from​

SceneBase.deleteEntities;

highlightEntities()​

highlightEntities(params: {
entities: Entity[];
keep_old_selection?: boolean;
}): Promise<void>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:363

Highlight a batch of entities.

Parameters​

ParameterTypeDescription
params{ entities: Entity[]; keep_old_selection?: boolean; }-
params.entitiesEntity[]The entities to highlight.
params.keep_old_selection?booleanWhether to keep the old selection or not.

Returns​

Promise<void>

A promise that resolves when the message is sent.

Inherited from​

SceneBase.highlightEntities;

fireEvent()​

fireEvent(params: {
event_map_id: UUID;
event_name: string;
emitter_entity?: Entity;
target_entities?: Entity[];
data_object?: ScriptDataObject;
}): void;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:392

Experimental

Fire a script event.

Parameters​

ParameterTypeDescription
params{ event_map_id: UUID; event_name: string; emitter_entity?: Entity; target_entities?: Entity[]; data_object?: ScriptDataObject; }-
params.event_map_idUUIDThe UUID of the event map.
params.event_namestringThe name of the event.
params.emitter_entity?EntityThe entity that emits the event.
params.target_entities?Entity[]The entities that are the target of the event. Leave empty for global events.
params.data_object?ScriptDataObjectThe data object to pass with the event.

Returns​

void

A promise that resolves when the message is sent.

Inherited from​

SceneBase.fireEvent;

setFilter()​

setFilter(__namedParameters: {
name: string;
value: string;
}): void;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:417

Experimental

Parameters​

ParameterType
__namedParameters{ name: string; value: string; }
__namedParameters.namestring
__namedParameters.valuestring

Returns​

void

Inherited from​

SceneBase.setFilter;

toggleFilter()​

toggleFilter(__namedParameters: {
name: string;
enabled: boolean;
}): void;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:425

Experimental

Parameters​

ParameterType
__namedParameters{ name: string; enabled: boolean; }
__namedParameters.namestring
__namedParameters.enabledboolean

Returns​

void

Inherited from​

SceneBase.toggleFilter;

removeFilter()​

removeFilter(__namedParameters: {
name: string;
}): void;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:432

Experimental

Parameters​

ParameterType
__namedParameters{ name: string; }
__namedParameters.namestring

Returns​

void

Inherited from​

SceneBase.removeFilter;

findEntitiesByNames()​

findEntitiesByNames(__namedParameters: {
entity_names: string[];
}): Promise<Entity[]>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:439

Parameters​

ParameterType
__namedParameters{ entity_names: string[]; }
__namedParameters.entity_namesstring[]

Returns​

Promise<Entity[]>

Deprecated​

Inherited from​

SceneBase.findEntitiesByNames;

findEntitiesWithComponents()​

findEntitiesWithComponents(__namedParameters: {
mandatory_components: keyof ComponentsRecord[];
forbidden_components?: keyof ComponentsRecord[];
}): Promise<Entity[]>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:450

Parameters​

ParameterType
__namedParameters{ mandatory_components: keyof ComponentsRecord[]; forbidden_components?: keyof ComponentsRecord[]; }
__namedParameters.mandatory_componentskeyof ComponentsRecord[]
__namedParameters.forbidden_components?keyof ComponentsRecord[]

Returns​

Promise<Entity[]>

Deprecated​

Inherited from​

SceneBase.findEntitiesWithComponents;

getSettings()​

getSettings(): Promise<Readonly<SceneSettingsRecord>>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:788

Get the current scene settings. These values can be updated in real-time by other clients. Altering these values locally will update the scene settings on the server and broadcast the changes to other connected clients.

Returns​

Promise<Readonly<SceneSettingsRecord>>

The current scene settings.

Inherited from​

SceneBase.getSettings;

getInfo()​

getInfo(): Promise<SceneInfo<Entity>>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:798

Get scene information such as the entity count, triangle count, and scene bounding box.

Returns​

Promise<SceneInfo<Entity>>

The scene info.

Inherited from​

SceneBase.getInfo;

waitForSceneLoaded()​

waitForSceneLoaded(): Promise<boolean>;

Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:820

Wait until the server reports it has finished loading every pending scene, so that the entities of the scenes referenced through scene_ref components are addressable. Resolves immediately if the server already reported so.

A scene referencing others is streamed in progressively: until the server is done, entities living in those referenced scenes are not available yet. It starts loading again — and this starts waiting again — whenever a new scene is referenced.

This has no timeout, so it may never resolve. It waits on the server, and the server does not always report: a scene whose reference the session's token cannot read never finishes loading, and nothing marks that as an error. Disconnecting is then the only thing that ends the wait, resolving it false. Never rejects — a caller that cannot afford to be parked indefinitely should race it against a deadline of its own.

Returns​

Promise<boolean>

true once the server reports the scenes loaded, false if the session was disconnected before it did.

Inherited from​

SceneBase.waitForSceneLoaded;