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

Index

Types

CurrentViewmodeData

CurrentViewmodeData: Mode.Mode | null

MoveToModeOptions

MoveToModeOptions: object

Type declaration

TransitionData

TransitionData: object

Type declaration

Properties

current

current: IObservable<Mode.Mode | null>
embed
bundle

Introduced 3.1.68.12-7-g858688944a

The current view mode.

mpSdk.Mode.current.subscribe(function (mode) {
  // the view mode has changed
  console.log('Current view mode is is ', mode);
});

transition

embed
bundle

Introduced 3.1.68.12-7-g858688944a

An observable transition of the current viewmode. from and to will be null if there is no active transition.

mpSdk.Mode.transition.subscribe(function (transition) {
  // the transition has changed
  console.log(transition.from, transition.to, transition.progress);
});

Methods

moveTo

  • Change the viewing mode in 3D Showcase.

    const mode = mpSdk.Mode.Mode.FLOORPLAN;
    const position = {x: 0, y: 0, z: 0};
    const rotation = {x: -90, y: 0};
    const transition = mpSdk.Mode.TransitionType.FLY;
    const zoom = 5;
    
    mpSdk.Mode.moveTo(mode, {
        position: position,
        rotation: rotation,
        transition: transition,
        zoom,
      })
      .then(function(nextMode){
        // Move successful.
        console.log('Arrived at new view mode ' + nextMode);
      })
      .catch(function(error){
        // Error with moveTo command
      });
    

    Notes about transitions to Floorplan mode:

    • zoom option is only taken into account in Floorplan transitions, the lower the number, the further the camera is zoomed in
    • The position of a floorplan view is determined by the X and Z arguments of the optional position object.
    • The rotation of a floorplan view is determined by the X and Y of the optional rotation object, changing X changes the 'roll' of the view, similar to hitting the LEFT/RIGHT arrow keys in Showcase floorplan view, changing the Y value has no analog in showcase, but changes the 'tilt' of the view.

    Parameters

    Returns Promise<Mode.Mode>

    A promise that resolves with the new mode once the mode has transitioned.