You can navigate scene A scene is a collection of layers that are displayed in 3D. It is typically composed of a basemap layer, data layers, and 3D data. Learn more views (SceneView or LocalSceneView) by:

Built-in navigation

Scene views have a number of built-in gestures that allow you to navigate a scene.

Basic navigation

Scene view navigation is similar to map view navigation, with additional capabilities designed for navigating 3D content. The following table summarizes the built-in navigation for SceneView and LocalSceneView:

NavigationTouchKeyboard
Move/PanDrag or swipeArrow keys (, , , )
Zoom inDouble-tap; or pinch open+ key; or Shift + =
Zoom outTwo-finger tap; or pinch closed- key
Continuous zoom in/outDouble-tap and hold, then drag up or downPress and hold the + or - key
Rotate sceneTwo-finger rotateShift + (rotate counterclockwise); or Shift + (rotate clockwise)
Tilt sceneTwo-finger drag up or down
(vertically aligned on the scene view)
w (tilt up); or s (tilt down)
Reorient to northn key
Reset pitchp key

Note: The plus and minus keys on the numeric keyboard are not supported for scene navigation.

Programmatically change camera position

Your applications can programmatically navigate a 3D scene by creating a new camera and setting it to the view you are working with. A camera defines the location from which you are viewing the scene.

Camera position for a scene view

The camera is shown in this image for illustration purposes; when you set camera settings (location, pitch), think of the camera class as a real-life camera you’re adjusting the position of.

Set the camera

For example, to point the camera to toward the Snowdon mountainside, use these values:

  • For 3D location, use 53.06 latitude, -4.04 longitude, 1289 meters above sea level
  • For heading, use 295 degrees
  • For pitch, use 71 degrees
  • For roll, use 0 degrees
val snowdonCamera = Camera(
latitude = 53.06,
longitude = -4.04,
altitude = 1289.0,
heading = 295.0,
pitch = 71.0,
roll = 0.0
)

Surface elevation applied to a scene

Apply the new camera to the scene view using SceneViewProxy.setViewpointCamera(), or animate the transition to it with SceneViewProxy.setViewpointAnimated().

sceneViewProxy.setViewpointCamera(snowdonCamera)

Move and adjust the camera

After you set a camera, you can update the scene view display by creating and applying a new camera. You can define the new camera with absolute values for location and orientation, or derive it from the current camera using relative values.

For example, using the relative approach, your code can preserve the current camera location, pitch, and roll, but rotate the heading by 45 degrees.

// Declare a currentCamera variable outside the UI composition
var currentCamera: Camera? = snowdonCamera
// . . . Set up UI composition here
Button(
onClick = {
val camera = currentCamera ?: return@Button
val updatedCamera = Camera(
locationPoint = Point(
x = camera.location.x,
y = camera.location.y,
z = camera.location.z
),
heading = camera.heading + 45.0,
pitch = camera.pitch,
roll = camera.roll
)
coroutineScope.launch {
sceneViewProxy.setViewpointCameraAnimated(
updatedCamera,
duration = 1500.0.milliseconds
)
currentCamera = updatedCamera
}
}
) {
Text("Rotate camera")
}

When the scene view’s current viewpoint camera changes, the onCurrentViewpointCameraChanged callback (see SceneView) is invoked with the updated camera. Store the current camera in mutable state using remember. To adjust the viewpoint relative to the camera’s current position or orientation, use the stored camera to create a new camera, then apply the new camera with SceneViewProxy.setViewpointCamera().