Scene And Camera Managers
Site & Floors
The scene, the container of all 3D data can be assimated to body in html pages, is managed by floors, meaning there is only one floor displayed at a time. To control this behavior, you will have to manage the current floor.
Note that when the current floor is null, the scene it's at Site view meaning you will see the site with all buildings.
Get current floor
You can easily access the current floor by doing the following:
// Returns FloorObject or null
adsumRnMap.sceneManager.getCurrentFloor();
Change floor
To change the floor you will have to change the scene state then you will probably need to move the camera to show the current floor.
await adsumRnMap.sceneManager.setCurrentFloor(floorObjectOrNull);
await adsumRnMap.cameraManager.centerOnFloor(floorObjectOrNull);
By default setCurrentFloor
and centerOnFloor
are animated, you can use the optional parameter
animated
to change that behavior.
await adsumRnMap.sceneManager.setCurrentFloor(floorObjectOrNull, false);
await adsumRnMap.cameraManager.centerOnFloor(floorObjectOrNull, false);
Note: Even when not animated, you should wait for the returned Promise to be resolved
Calibration
Calibration is setting the default map view for a specific device. It is a predefined settings set in Studio Channel page
Here are the details on how it affects the AdsumWebMap behavior:
adsumRnMap.cameraManager.centerOnFloor
will take the camera view defined for the specified floor- when loading or using
adsumRnMap.setDeviceId
the default current floor will be the one defined as Start floor.
If you have located the device on the map the default user position will be set at the defined kiosk position.
Scene Manipulations
Display Mode
All AdsumObject3D has a display mode, which can take 3 values:
- DISPLAY_MODES.NONE: The AdsumObject and all its children will be hidden
- DISPLAY_MODES.VISIBLE: The AdsumObject will be visible, and its children display mode value will be taken into account.
- DISPLAY_MODES.TRANSPARENT: The AdsumObject will be hidden, but its children display mode value will be taken into account.
You can modify them like this:
adsumObject.setDisplayMode(DISPLAY_MODES.TRANSPARENT);
IMPORTANT: custom display mode values will be kept except for the following behavior
- When using
adsumRnMap.sceneManager.setCurrentFloor
- If the
currentFloor
is null- the SiteObject will be set to DISPLAY_MODES.VISIBLE
- all BuildingObject will be set to DISPLAY.MODES.VISIBLE
- Otherwise
- the SiteObject will be set to DISPLAY_MODES.TRANSPARENT
- the parent BuildingObject will be set to DISPLAY_MODES.TRANSPARENT
- the current FloorObject will be set to DISPLAY_MODES.VISIBLE
- If the
- All LabelObjects with a level of details will have their display mode updated depending on the Camera position.
Space
Bounce a Space
You can bounce a SpaceObject, i.e. multiply the height by a factor using:
await spaceObject.bounceUp(5);
Asynchronous
You can reverse this operation using:
await spaceObject.bounceDown();
Asynchronous
You can check if a SpaceObject is bounced using:
await spaceObject.isBounced();
Asynchronous
You can get the current bounce factor using:
await spaceObject.getBounceFactor();
Change Space color
You can change a SpaceObject color using:
await spaceObject.setColor("#ff0000");
Asynchronous
You can reverse this operation using:
await spaceObject.resetColor();
You can check if a SpaceObject color has been changed using:
await spaceObject.isInitialColor();
Asynchronous
Building
Change Building color
You can change a BuildingObject color using:
await buildingObject.setColor("#ff0000");
Asynchronous
You can reverse this operation using:
await buildingObject.resetColor();
Asynchronous
You can check if a BuildingObject color has been changed using:
await buildingObject.isInitialColor();
Asynchronous
Camera Manipulations
center on AdsumObject3D
You can center on any AdsumObject3D using:
await adsumRnMap.cameraManager.centerOn(adsumObject3D);
Asynchronous
By default centerOn
is animated, you can use the optional parameter animated
to change that behavior.
await adsumRnMap.cameraManager.centerOn(adsumObject3D, false);
Note: Even when not animated, you should wait for the returned Promise to be resolved
By default the centerOn
will zoom to make the adsumObject3D fit the camera, you can use the third
optional parameter options
to change that behavior:
await adsumRnMap.cameraManager.centerOn(adsumObject3D, animated, { zoom: false });
By default the centerOn
the zoom fit ratio is 1.5
, you can use the third optional parameter
options
to change that behavior:
await adsumRnMap.cameraManager.centerOn(adsumObject3D, animated, { fitRatio: 1 });
Note:
adsumRnMap.cameraManager.centerOn(floorObject)
will be different fromadsumRnMap.cameraManager.centerOnFloor(floorObject)
. The first one will be calculated whereas the second is defined using the Calibration.