Camera

class Camera

A camera represents an observer's location and their perspective of an ArcGISScene within a SceneView. A Camera object can be thought of as a camera that you look through to see a viewable area of a scene. What you see depends on how you orientate the camera and how far it is above the Surface. A camera has four main configurable properties:

The camera orientation uses a local right-handed XYZ coordinate system aligned to East, North, Up (ENU): X = East, Y = North, Z = Up.

  • Location - The 3D point in space where the camera is located. The camera will adopt the spatial reference of the point at the time of creation. If a spatial reference is not supplied, a spatial reference having a WGS84 horizontal coordinate system is assumed. When no vertical coordinate system is provided, a point's z value is inferred based on the horizontal coordinate system's unit, interpreted as a height-based value relative to the horizontal coordinate system's surface:

    • Projected coordinate systems use the unit of the horizontal coordinate system.

    • Geographic coordinate systems use meters.

  • Heading - The angle around the z-axis at which the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360, where 0 is looking North and 90 is looking East.

  • Pitch - The angle around the x-axis at which the camera is rotated. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up.

  • Roll - The angle around the y-axis (the direction of sight) at which the camera is rotated. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down.

You can construct a Camera based on these values or you can obtain it from the scene view's current viewpoint using SceneView.getCurrentViewpointCamera. The Camera is immutable which means that once it is created it you cannot modify it.

You can define the user's camera interactions using the scene view's camera controller. The default camera controller (GlobeCameraController) allows users to freely move and focus the camera anywhere in the scene. Other camera controllers provide specialized behavior, such as:

Since

200.1.0

Constructors

Link copied to clipboard
constructor(latitude: Double, longitude: Double, altitude: Double, heading: Double, pitch: Double, roll: Double)

Creates a camera with the specified latitude, longitude, altitude, heading, pitch, and roll. The Camera's spatial reference will be WGS84.

constructor(locationPoint: Point, heading: Double, pitch: Double, roll: Double)

Creates a camera with the specified location, heading, pitch, and roll. The camera's spatial reference is derived from the locationPoint.

constructor(lookAtPoint: Point, distance: Double, heading: Double, pitch: Double, roll: Double)

Creates a camera based on a point to look at, the distance to this point, heading, pitch, and roll. The camera's spatial reference is derived from the lookAtPoint. Note: the given values may mean that the point is not visible on screen. You can check its visibility using SceneView.locationToScreen.

constructor(transformationMatrix: TransformationMatrix)

Creates a camera from a transformation matrix whose pose is already expressed in the scene's world coordinate frame. This constructor assumes the input matrix already encodes a world-space camera pose. No additional origin mapping (for example, room-to-world anchoring) or translation scaling is applied by this constructor.

Properties

Link copied to clipboard

The heading of the camera. The angle around the z-axis at which the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360, where 0 is looking North and 90 is looking East.

Link copied to clipboard

The point geometry containing the location and altitude of the camera.

Link copied to clipboard

The pitch of the camera. The angle around the x-axis at which the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up.

Link copied to clipboard

The roll of the camera. The angle around the y-axis (the direction of sight) at which the camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down.

Link copied to clipboard

The camera's TransformationMatrix. Regardless of how the camera is created, the camera's location and orientation can always be represented as a TransformationMatrix.

Functions

Link copied to clipboard
fun elevate(deltaAltitude: Double): Camera

Creates a copy of the camera with the specified change in altitude applied.

Link copied to clipboard
fun moveForward(distance: Double): Camera

Creates a copy of the camera moved by the specified distance in the direction it is facing.

Link copied to clipboard
fun moveTo(location: Point): Camera

Creates a copy of the camera with a new location.

Link copied to clipboard
fun moveToward(targetPoint: Point, distance: Double): Camera

Creates a copy of the camera with the camera moved in the direction of a target point by the specified distance.

Link copied to clipboard
fun rotateAround(targetPoint: Point, deltaHeading: Double, deltaPitch: Double, deltaRoll: Double): Camera

Creates a copy of the camera with the heading and pitch rotated from a specified target point by the delta angles in degrees.

Link copied to clipboard
fun rotateTo(heading: Double, pitch: Double, roll: Double): Camera

Creates a copy of the camera with the specified heading, pitch and roll values.

Link copied to clipboard
fun zoomToward(targetPoint: Point, factor: Double): Camera

Creates a copy of the camera with its location moved in the direction of a target point by the specified zoom factor.