Skip to main content

SimpleWorld<T, U, S>

A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.

Extends

Type parameters

Type parameterValueDescription
T extends BaseSceneBaseSceneThe type of the scene. Default is BaseScene.
U extends BaseCameraBaseCameraThe type of the camera. Default is BaseCamera.
S extends BaseRendererBaseRendererThe type of the renderer. Default is BaseRenderer.

Implements

Properties

enabled

enabled: boolean = true

Indicates whether the world is currently enabled. When disabled, the world will not be updated.


isDisposing

isDisposing: boolean = false

Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.

Implementation of

World . isDisposing


meshes

readonly meshes: Set<Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>>

All the loaded meshes. These meshes will be taken into account in operations like raycasting.

Implementation of

World . meshes


name?

optional name: string

An optional name for the world.


onAfterUpdate

readonly onAfterUpdate: Event<unknown>

Updateable.onAfterUpdate

Implementation of

Updateable . onAfterUpdate


onBeforeUpdate

readonly onBeforeUpdate: Event<unknown>

Updateable.onBeforeUpdate

Implementation of

Updateable . onBeforeUpdate


onDisposed

readonly onDisposed: Event<unknown>

Disposable.onDisposed

Implementation of

Disposable . onDisposed


uuid

readonly uuid: string

A unique identifier for the world. Is not meant to be changed at any moment.

Implementation of

World . uuid

Accessors

camera

get camera(): U

Getter for the camera. If no camera is initialized, it throws an error.

set camera(camera): void

Setter for the camera. It sets the current camera, adds the world to the camera's worlds set, sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.

Parameters

ParameterTypeDescription
cameraUThe new camera to be set.

Returns

U

The current camera.


renderer

get renderer(): null | S

Getter for the renderer.

set renderer(renderer): void

Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set, sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action. If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.

Parameters

ParameterTypeDescription
renderernull | SThe new renderer to be set or null to remove the current renderer.

Returns

null | S

The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).


scene

get scene(): T

Getter for the scene. If no scene is initialized, it throws an error.

set scene(scene): void

Setter for the scene. It sets the current scene, adds the world to the scene's worlds set, sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.

Parameters

ParameterTypeDescription
sceneTThe new scene to be set.

Returns

T

The current scene.

Methods

dispose()

dispose(disposeResources): void

Disposable.dispose

Parameters

ParameterTypeDefault value
disposeResourcesbooleantrue

Returns

void

Implementation of

Disposable . dispose


isConfigurable()

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns

this is Configurable<any, any>

Inherited from

Base . isConfigurable


isDisposeable()

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns

this is Disposable

Inherited from

Base . isDisposeable


isHideable()

isHideable(): this is Hideable

Whether is component is Hideable.

Returns

this is Hideable

Inherited from

Base . isHideable


isResizeable()

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns

this is Resizeable

Inherited from

Base . isResizeable


isUpdateable()

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns

this is Updateable

Inherited from

Base . isUpdateable


update()

update(delta?): void

Updateable.update

Parameters

ParameterType
delta?number

Returns

void

Implementation of

Updateable . update