Camera

Camera

new

The camera is defined by a position, orientation, and view frustum.

The orientation forms an orthonormal basis with a view, up and right = view x up unit vectors.

The viewing frustum is defined by 6 planes. Each plane is represented by a {Cartesian4} object, where the x, y, and z components define the unit vector normal to the plane, and the w component is the distance of the plane from the origin/camera position.

Example
// Create a camera looking down the negative z-axis, positioned at the origin,
// with a field of view of 60 degrees, and 1:1 aspect ratio.
var camera = new Cesium.Camera(context);
camera.position = new Cesium.Cartesian3();
camera.direction = Cesium.Cartesian3.negate(Cesium.Cartesian3.UNIT_Z);
camera.up = Cesium.Cartesian3.clone(Cesium.Cartesian3.UNIT_Y);
camera.frustum.fovy = Cesium.Math.PI_OVER_THREE;
camera.frustum.near = 1.0;
camera.frustum.far = 2.0;
Demo:
Source:

Members

:CameraController

Defines camera behavior. The controller can be used to perform common camera manipulations.
Default Value:
  • CameraController(this)

:Cartesian3

The view direction of the camera.

:Cartesian3

Gets the view direction of the camera in world coordinates.

:Frustum

The region of space in view.
Default Value:
  • PerspectiveFrustum()
See:

:Matrix4

Gets the inverse camera transform.
Default Value:

:Matrix4

Gets the inverse view matrix.
See:

:Cartesian3

The position of the camera.

:Cartesian3

Gets the position of the camera in world coordinates.
The right direction of the camera.

:Cartesian3

Gets the right direction of the camera in world coordinates.

:Matrix4

Modifies the camera's reference frame. The inverse of this transformation is appended to the view matrix.
Default Value:
See:

:Cartesian3

The up direction of the camera.

:Cartesian3

Gets the up direction of the camera in world coordinates.

:Matrix4

Gets the view matrix.
See:

Methods

Transform a vector or point from the camera's reference frame to world coordinates.

Parameters:
Name Type Argument Description
vector Cartesian4 The vector or point to transform.
result Cartesian4 <optional>
The object onto which to store the result.
Returns:
Cartesian4 The transformed vector or point.

Returns a duplicate of a Camera instance.

Returns:
Camera A new copy of the Camera instance.

Transform a vector or point from world coordinates to the camera's reference frame.

Parameters:
Name Type Argument Description
cartesian Cartesian4 The vector or point to transform.
result Cartesian4 <optional>
The object onto which to store the result.
Returns:
Cartesian4 The transformed vector or point.