You can navigate sceneSceneView or LocalSceneView) by:
- Using built-in navigation, such as panning, zooming, and changing pitch.
- By programmatically changing camera position.
Built-in navigation
The scene views have a number of built-in gestures that allow you to navigate a scene using touch screen, mouse, or keyboard.
Basic navigation
Navigation for scene views is the same as navigation for a map view. The following table summarizes the built-in navigation capabilities of the SceneView and LocalSceneView controls:
| Map navigation | Touch action | Mouse action | Key action |
|---|---|---|---|
| Pan the map | Touch, hold, and drag on the map | Press, hold, and drag the left mouse button | Press the left (pan west), right (pan east), up (pan north), or down (pan south) arrows |
| Zoom in (+) or zoom out (-) with animation | Pinch open (+) or pinch close (-) on the map | Scroll the mouse wheel forward (+) or backward (-) | Press the + / = key for in Press the - / _ key for out |
| Zoom in to the next level of detail or by a factor of 2 | Double tap on the map | Double-click the left mouse button | Press the + / = key |
| Zoom out to the next level of detail or by a factor of 2 | Single tap with two fingers simultaneously | Double-click of right mouse button | Press the - / _ key |
| Rotate | Two-finger pinch and twist fingers to rotate the map or scene | N/A | Press the 'a' (rotate counter-clockwise) or 'd' (rotate clockwise) keys |
| Set viewpoint to north | N/A | N/A | Press the 'n' key |
Advanced navigation
Scene views have additional navigation not found in a map view:
| Scene navigation | Touch action | Mouse action | Key action |
|---|---|---|---|
| Pitch: increase or decrease | Two-finger touch and hold (along the horizontal axis) and then slide up and down to adjust pitch | Press, hold and drag the right mouse button up (increase) or down (decrease) | Press the 'w' (increase) or 's' (decrease) keys. Press 'p' to set pitch to 0. |
| Elevation: increase or decrease | N/A | N/A | Press the 'u' (increase) or 'j' (decrease) keys |
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.
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
const Camera sceneCamera(53.06, -4.04, 1289.0, 295.0, 71.0, 0.0);
You now have a new camera to apply to the scene view. You can apply it immediately using set, as shown in the code below for a SceneView, or the camera can be animated to the new position using one of the asynchronous methods.
m_sceneView->setViewpointCameraAsync(sceneCamera);