Skip to content
On this page

Class: Scene

WebSG.Scene

Class representing the root of a scene graph.

Table of contents

Constructors

Methods

Constructors

constructor

new Scene()

Methods

addNode

addNode(node): Scene

Adds a node to the scene.

Parameters

NameTypeDescription
nodeNodeThe node to be added to the scene.

Returns

Scene

The instance of the Scene class (for method chaining).

Defined in

websg.d.ts:1113


getNode

getNode(index): undefined | Node

Gets a node from the scene by its index.

Parameters

NameTypeDescription
indexnumberThe index of the node to be retrieved.

Returns

undefined | Node

The node at the given index, or undefined if no node exists at the index.

Defined in

websg.d.ts:1127


nodes

nodes(): NodeIterator

Returns an iterator for the nodes in the scene.

Returns

NodeIterator

An iterator for the nodes in the scene.

Defined in

websg.d.ts:1133


removeNode

removeNode(node): Scene

Removes a node from the scene.

Parameters

NameTypeDescription
nodeNodeThe node to be removed from the scene.

Returns

Scene

The instance of the Scene class (for method chaining).

Defined in

websg.d.ts:1120