Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.
Index
Namespaces
Enumerations
Types
Properties
Methods
Types
FloorData
Type declaration
-
id: string
-
name: string
-
sequence: number
Floors
Type declaration
-
current
Floor: number -
floor
Names: string[] -
total
Floors: number
ObservableFloorData
Type declaration
-
id: string | undefined
-
name: string
-
sequence: number | undefined
Properties
current
data
An observable collection of Floor data that can be subscribed to.
See IObservableMap to learn how to receive data from the collection.
mpSdk.Floor.data.subscribe({
onCollectionUpdated: function (collection) {
console.log('Collection received. There are ', Object.keys(collection).length, 'floors in the collection');
}
});
Methods
getData
-
This function returns the state of all floors.
mpSdk.Floor.getData() .then(function(floors) { // Floor data retreival complete. console.log('Current floor: ' + floors.currentFloor); console.log('Total floos: ' + floors.totalFloors); console.log('Name of first floor: ' + floors.floorNames[0]); }) .catch(function(error) { // Floors data retrieval error. });
Returns Promise<Floor.Floors>
moveTo
-
When in inside mode, this function changes the active floor, and moves the camera to the nearest position on that floor. When in floorplan/dollhouse mode, this function changes the active floor, but does not modify the camera
mpSdk.Floor.moveTo(2) .then(function(floorIndex) { // Move to floor complete. console.log('Current floor: ' + floorIndex); }) .catch(function(error) { // Error moving to floor. });
Parameters
-
index: number
Returns Promise<number>
The destination floor index.
-
showAll
-
This function displays all floors.
mpSdk.Floor.showAll() .then(function(){ // Show floors complete. }) .catch(function(error) { // Error displaying all floors. });
Returns Promise<void>
An observable for the player's currently active floor.
The current floor can tell you when "all floors" are visible and encodes when the camera is transitioning between floors.
The following table shows all 4 states of the current floor observable (INSIDE: inside mode, DH: dollhouse mode, FP: floorplan mode).
${current.id}
${current.sequence}
${current.name}
mpSdk.Floor.current.subscribe(function (currentFloor) { // Change to the current floor has occurred. if (currentFloor.sequence === -1) { console.log('Currently viewing all floors'); } else if (currentFloor.sequence === undefined) { if (currentFloor.id === undefined) { console.log('Current viewing an unplaced unaligned sweep'); } else { console.log('Currently transitioning between floors'); } } else { console.log('Currently on floor', currentFloor.id); console.log('Current floor\'s sequence index', currentFloor.sequence); console.log('Current floor\'s name', currentFloor.name) } });