Look around camera position

Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

The default navigation of a SceneView allows you to rotate around a fixed camera position with B + Left-click + Drag. This sample shows how to rotate around the camera's position using the keyboard:

  • w key: look up
  • a key: look to the Left
  • s key: look down
  • d key: look to the right

Look up, down or to the sides is defined by camera tilt and heading. When the user hits one of the keys, the tilt or heading will be modified by 1 degree:

  // listen for key-down events on the view
  view.on("key-down", function(event) {
    var camera = view.camera.clone();
    // if the user clicked the d key
    if (event.key === "d") {
      // set the view to go to the new target: same position, but different heading
      view.goTo({
        position: camera.position,
        heading: camera.heading + 1
      }, {
        animate: false
      });
    }
  }

Sample search results

TitleSample
Loading...