new Camera
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
-
controller :CameraController
-
Defines camera behavior. The controller can be used to perform common camera manipulations.
- Default Value:
- CameraController(this)
-
direction :Cartesian3
-
The view direction of the camera.
-
directionWC :Cartesian3
-
Gets the view direction of the camera in world coordinates.
-
frustum :Frustum
-
The region of space in view.
- Default Value:
- PerspectiveFrustum()
See:
-
inverseTransform :Matrix4
-
Gets the inverse camera transform.
- Default Value:
-
inverseViewMatrix :Matrix4
-
Gets the inverse view matrix.
-
position :Cartesian3
-
The position of the camera.
-
positionWC :Cartesian3
-
Gets the position of the camera in world coordinates.
-
right :Cartesian3
-
The right direction of the camera.
-
rightWC :Cartesian3
-
Gets the right direction of the camera in world coordinates.
-
transform :Matrix4
-
Modifies the camera's reference frame. The inverse of this transformation is appended to the view matrix.
- Default Value:
See:
-
up :Cartesian3
-
The up direction of the camera.
-
upWC :Cartesian3
-
Gets the up direction of the camera in world coordinates.
-
viewMatrix :Matrix4
-
Gets the view matrix.
Methods
-
cameraToWorldCoordinates
-
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. -
clone
-
Returns a duplicate of a Camera instance.
Returns:
Camera A new copy of the Camera instance. -
worldToCameraCoordinates
-
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.