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.

Throws:
DeveloperError : canvas is required.
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 Camera(canvas);
camera.position = new Cartesian3();
camera.direction = Cartesian3.UNIT_Z.negate();
camera.up = Cartesian3.UNIT_Y;
camera.frustum.fovy = CesiumMath.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.

:Cartesian3

The view direction of the camera.

:Frustum

The region of space in view.
See:

:Cartesian3

The position of the camera.
The right direction of the camera.

:Matrix4

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

:Cartesian3

The up direction of the camera.

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.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian4 The transformed vector or point.

Returns a duplicate of a Camera instance.

Returns:
Camera A new copy of the Camera instance.

DOC_TBA

Returns:
Matrix4 DOC_TBA

DOC_TBA

Returns the view matrix.

Returns:
Matrix4 The view matrix.
See:

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.
Throws:
DeveloperError : cartesian is required.
Returns:
Cartesian4 The transformed vector or point.

<static>

The view direction of the camera in world coordinates.

<static>

The position of the camera in world coordinates.

<static>

The right direction of the camera in world coordinates.

<static>

The up direction of the camera in world coordinates.