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
SceneBase<Entity>
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
| Parameter | Type |
|---|---|
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
| Parameter | Type |
|---|---|
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:204
Create a new entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { name: string; components: ComponentsManifest; options?: { delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }; parent?: Entity | null; } | - |
params.name | string | The name of the entity. |
params.components | ComponentsManifest | The 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? | boolean | Whether to delete the entity when the client disconnects. |
params.options.auto_broadcast? | boolean | Deprecated 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:237
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
| Parameter | Type | Description |
|---|---|---|
params | { components_array: ComponentsManifest[]; options?: { delete_on_client_disconnection?: boolean; auto_broadcast?: boolean; }; } | - |
params.components_array | ComponentsManifest[] | 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? | boolean | Whether to delete the entity when the client disconnects. |
params.options.auto_broadcast? | boolean | Deprecated 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:265
Find an entity by its UUID and linkage.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { entity_uuid: UUID; linkage?: UUID[]; } | - |
params.entity_uuid | UUID | The 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:307
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
| Parameter | Type | Description |
|---|---|---|
params | { entity_uuid: UUID; } | - |
params.entity_uuid | UUID | The 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:328
Delete a batch of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { entities: Entity[]; } | - |
params.entities | Entity[] | 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:345
Highlight a batch of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { entities: Entity[]; keep_old_selection?: boolean; } | - |
params.entities | Entity[] | The entities to highlight. |
params.keep_old_selection? | boolean | Whether 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:374
Experimental
Fire a script event.
Parameters
| Parameter | Type | Description |
|---|---|---|
params | { event_map_id: UUID; event_name: string; emitter_entity?: Entity; target_entities?: Entity[]; data_object?: ScriptDataObject; } | - |
params.event_map_id | UUID | The UUID of the event map. |
params.event_name | string | The name of the event. |
params.emitter_entity? | Entity | The 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? | ScriptDataObject | The 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:399
Experimental
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { name: string; value: string; } |
__namedParameters.name | string |
__namedParameters.value | string |
Returns
void
Inherited from
SceneBase.setFilter;
toggleFilter()
toggleFilter(__namedParameters: {
name: string;
enabled: boolean;
}): void;
Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:407
Experimental
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { name: string; enabled: boolean; } |
__namedParameters.name | string |
__namedParameters.enabled | boolean |
Returns
void
Inherited from
SceneBase.toggleFilter;
removeFilter()
removeFilter(__namedParameters: {
name: string;
}): void;
Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:414
Experimental
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { name: string; } |
__namedParameters.name | string |
Returns
void
Inherited from
SceneBase.removeFilter;
findEntitiesByNames()
findEntitiesByNames(__namedParameters: {
entity_names: string[];
}): Promise<Entity[]>;
Defined in: livelink.clients/livelink.base/sources/scene/Scene.ts:421
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { entity_names: string[]; } |
__namedParameters.entity_names | string[] |
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:432
Parameters
| Parameter | Type |
|---|---|
__namedParameters | { mandatory_components: keyof ComponentsRecord[]; forbidden_components?: keyof ComponentsRecord[]; } |
__namedParameters.mandatory_components | keyof 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:770
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:780
Get scene information such as the entity count, triangle count, and scene bounding box.
Returns
The scene info.
Inherited from
SceneBase.getInfo;