INode | Matterport SDK
Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

Scene Node

A scene node is an object with a 3D transform: position, rotation, and scale. It can contain a collection of components and manages their life cycle.

A scene node has the following states:

Initializing - after construction but before start has been called
Updating - after start has been called but before stop has been called
Destroyed - after stop has been called

Components can only be added during the Initializing state. A scene node cannot be restarted.

sdk.Scene.createNode().then(function(node) {
   node.addComponent('mp.gltfLoader', {
     url: 'http://www.someModelSite.com/rabbit.gltf'
   });

   node.position.set(0, 1, 0);
   node.start();
});

Setting the position, rotation, or scale of a scene node affects child components.

Hierarchy

  • INode

Index

Properties

Readonly id

id: string

A read-only unique id used to reference this node in a path binding. This id is autogenerated unless it is specifed and created via the Scene.Object.

name

name: string

The node name.

Readonly position

position: Vector3

The scene node position. You can call methods on this object to set its values. See https://threejs.org/docs/#api/en/math/Vector3

Readonly quaternion

quaternion: Quaternion

The scene node rotation. You can call methods on this object to set its values. See https://threejs.org/docs/#api/en/math/Quaternion

Readonly scale

scale: Vector3

The scene node scale vector. You can call methods on this object to set its values. See https://threejs.org/docs/#api/en/math/Vector3

Methods

addComponent

  • addComponent<T>(name: T, initialInputs?: SceneComponentOptions[T], id?: undefined | string): Scene.IComponent
  • Instantiates a component and adds it to the nodes internal component list. This function does nothing if the node is in the Operating or Destroyed state.

    Type parameters

    Parameters

    • name: T

      The registered component name.

    • Optional initialInputs: SceneComponentOptions[T]

      initial key-value pairs that will be applied to the component before onInit is called. If the keys do not match the components inputs, they are ignored.

    • Optional id: undefined | string

      an optional id for this component, if not specified an id will be computed for the component.

    Returns Scene.IComponent

    The newly created component.

componentIterator

  • Returns in iterator iterating over all the components contained by this node.

    Returns IterableIterator<Scene.IComponent>

start

  • start(): void
  • Transitions the node to Operating if it is in the Initializing state. Calling this function has no effect if the node is already Operating.

    Returns void

stop

  • stop(): void
  • Transitions the node to Destroyed state if it is in any state. Calling this function has no effect if the node is already Destroyed.

    Returns void