new Camera(scene)
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.
Parameters:
Name |
Type |
Description |
scene |
Scene
|
The scene. |
- Source:
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(scene);
camera.position = new Cesium.Cartesian3();
camera.direction = Cesium.Cartesian3.negate(Cesium.Cartesian3.UNIT_Z, new Cesium.Cartesian3());
camera.up = Cesium.Cartesian3.clone(Cesium.Cartesian3.UNIT_Y);
camera.frustum.fov = Cesium.Math.PI_OVER_THREE;
camera.frustum.near = 1.0;
camera.frustum.far = 2.0;
Members
(static) DEFAULT_VIEW_FACTOR :Number
A scalar to multiply to the camera position and add it back after setting the camera to view the rectangle.
A value of zero means the camera will view the entire Camera#DEFAULT_VIEW_RECTANGLE
, a value greater than zero
will move it further away from the extent, and a value less than zero will move it close to the extent.
Type:
- Source:
(static) DEFAULT_VIEW_RECTANGLE :Rectangle
The default rectangle the camera will view on creation.
Type:
- Source:
(readonly) changed :Event
Gets the event that will be raised when the camera has changed by percentageChanged
.
Type:
- Source:
If set, the camera will not be able to rotate past this axis in either direction.
Type:
- Default Value:
- Source:
defaultLookAmount :Number
The default amount to rotate the camera when an argument is not
provided to the look methods.
Type:
- Default Value:
- Source:
defaultMoveAmount :Number
The default amount to move the camera when an argument is not
provided to the move methods.
Type:
- Default Value:
- Source:
defaultRotateAmount :Number
The default amount to rotate the camera when an argument is not
provided to the rotate methods.
Type:
- Default Value:
- Source:
defaultZoomAmount :Number
The default amount to move the camera when an argument is not
provided to the zoom methods.
Type:
- Default Value:
- Source:
The view direction of the camera.
Type:
- Source:
(readonly) directionWC :Cartesian3
Gets the view direction of the camera in world coordinates.
Type:
- Source:
frustum :Frustum
The region of space in view.
Type:
- Default Value:
- Source:
- See:
-
(readonly) heading :Number
Gets the camera heading in radians.
Type:
- Source:
Gets the inverse camera transform.
Type:
- Default Value:
- Source:
(readonly) inverseViewMatrix :Matrix4
Gets the inverse view matrix.
Type:
- Source:
- See:
-
maximumZoomFactor :Number
The factor multiplied by the the map size used to determine where to clamp the camera position
when zooming out from the surface. The default is 1.5. Only valid for 2D and the map is rotatable.
Type:
- Default Value:
- Source:
(readonly) moveEnd :Event
Gets the event that will be raised when the camera has stopped moving.
Type:
- Source:
(readonly) moveStart :Event
Gets the event that will be raised at when the camera starts to move.
Type:
- Source:
percentageChanged :number
The amount the camera has to change before the changed
event is raised. The value is a percentage in the [0, 1] range.
Type:
- Default Value:
- Source:
(readonly) pitch :Number
Gets the camera pitch in radians.
Type:
- Source:
The position of the camera.
Type:
- Source:
(readonly) positionCartographic :Cartographic
Gets the
Cartographic
position of the camera, with longitude and latitude
expressed in radians and height in meters. In 2D and Columbus View, it is possible
for the returned longitude and latitude to be outside the range of valid longitudes
and latitudes when the camera is outside the map.
Type:
- Source:
(readonly) positionWC :Cartesian3
Gets the position of the camera in world coordinates.
Type:
- Source:
The right direction of the camera.
Type:
- Source:
Gets the right direction of the camera in world coordinates.
Type:
- Source:
(readonly) roll :Number
Gets the camera roll in radians.
Type:
- Source:
Gets the camera's reference frame. The inverse of this transformation is appended to the view matrix.
Type:
- Default Value:
- Source:
The up direction of the camera.
Type:
- Source:
Gets the up direction of the camera in world coordinates.
Type:
- Source:
(readonly) viewMatrix :Matrix4
Gets the view matrix.
Type:
- Source:
- See:
-
Methods
cameraToWorldCoordinates(cartesian, resultopt) → {Cartesian4}
Transform a vector or point from the camera's reference frame to world coordinates.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian4
|
|
The vector or point to transform. |
result |
Cartesian4
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed vector or point.
-
Type
-
Cartesian4
cameraToWorldCoordinatesPoint(cartesian, resultopt) → {Cartesian3}
Transform a point from the camera's reference frame to world coordinates.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian3
|
|
The point to transform. |
result |
Cartesian3
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed point.
-
Type
-
Cartesian3
cameraToWorldCoordinatesVector(cartesian, resultopt) → {Cartesian3}
Transform a vector from the camera's reference frame to world coordinates.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian3
|
|
The vector to transform. |
result |
Cartesian3
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed vector.
-
Type
-
Cartesian3
cancelFlight()
Cancels the current camera flight if one is in progress.
The camera is left at it's current location.
- Source:
computeViewRectangle(ellipsoidopt, resultopt) → {Rectangle|undefined}
Computes the approximate visible rectangle on the ellipsoid.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
ellipsoid |
Ellipsoid
|
<optional>
|
Ellipsoid.WGS84
|
The ellipsoid that you want to know the visible region. |
result |
Rectangle
|
<optional>
|
|
The rectangle in which to store the result |
- Source:
Returns:
The visible rectangle or undefined if the ellipsoid isn't visible at all.
-
Type
-
Rectangle
|
undefined
distanceToBoundingSphere(boundingSphere) → {Number}
Return the distance from the camera to the front of the bounding sphere.
Parameters:
Name |
Type |
Description |
boundingSphere |
BoundingSphere
|
The bounding sphere in world coordinates. |
- Source:
Returns:
The distance to the bounding sphere.
-
Type
-
Number
flyHome(durationopt)
Fly the camera to the home view. Use Camera#.DEFAULT_VIEW_RECTANGLE
to set
the default view for the 3D scene. The home view for 2D and columbus view shows the
entire map.
Parameters:
Name |
Type |
Attributes |
Description |
duration |
Number
|
<optional>
|
The number of seconds to complete the camera flight to home. See Camera#flyTo |
- Source:
flyTo(options)
Flies the camera from its current position to a new position.
Parameters:
Name |
Type |
Description |
options |
Object
|
Object with the following properties:
Properties
Name |
Type |
Attributes |
Description |
destination |
Cartesian3
|
Rectangle
|
|
The final position of the camera in WGS84 (world) coordinates or a rectangle that would be visible from a top-down view. |
orientation |
Object
|
<optional>
|
An object that contains either direction and up properties or heading, pith and roll properties. By default, the direction will point
towards the center of the frame in 3D and in the negative z direction in Columbus view. The up direction will point towards local north in 3D and in the positive
y direction in Columbus view. Orientation is not used in 2D when in infinite scrolling mode. |
duration |
Number
|
<optional>
|
The duration of the flight in seconds. If omitted, Cesium attempts to calculate an ideal duration based on the distance to be traveled by the flight. |
complete |
Camera~FlightCompleteCallback
|
<optional>
|
The function to execute when the flight is complete. |
cancel |
Camera~FlightCancelledCallback
|
<optional>
|
The function to execute if the flight is cancelled. |
endTransform |
Matrix4
|
<optional>
|
Transform matrix representing the reference frame the camera will be in when the flight is completed. |
maximumHeight |
Number
|
<optional>
|
The maximum height at the peak of the flight. |
easingFunction |
EasingFunction
|
EasingFunction~Callback
|
<optional>
|
Controls how the time is interpolated over the duration of the flight. |
|
- Source:
Throws:
-
If either direction or up is given, then both are required.
-
-
Type
-
DeveloperError
Example
// 1. Fly to a position with a top-down view
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
});
// 2. Fly to a Rectangle with a top-down view
viewer.camera.flyTo({
destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
});
// 3. Fly to a position with an orientation using unit vectors.
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
direction : new Cesium.Cartesian3(-0.04231243104240401, -0.20123236049443421, -0.97862924300734),
up : new Cesium.Cartesian3(-0.47934589305293746, -0.8553216253114552, 0.1966022179118339)
}
});
// 4. Fly to a position with an orientation using heading, pitch and roll.
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
heading : Cesium.Math.toRadians(175.0),
pitch : Cesium.Math.toRadians(-35.0),
roll : 0.0
}
});
flyToBoundingSphere(boundingSphere, optionsopt)
Flies the camera to a location where the current view contains the provided bounding sphere.
The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere.
The heading and the pitch angles are defined in the local east-north-up reference frame.
The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
angles are below the plane. Negative pitch angles are above the plane. The range is the distance from the center. If the range is
zero, a range will be computed such that the whole bounding sphere is visible.
In 2D and Columbus View, there must be a top down view. The camera will be placed above the target looking down. The height above the
target will be the range. The heading will be aligned to local north.
Parameters:
Name |
Type |
Attributes |
Description |
boundingSphere |
BoundingSphere
|
|
The bounding sphere to view, in world coordinates. |
options |
Object
|
<optional>
|
Object with the following properties:
Properties
Name |
Type |
Attributes |
Description |
duration |
Number
|
<optional>
|
The duration of the flight in seconds. If omitted, Cesium attempts to calculate an ideal duration based on the distance to be traveled by the flight. |
offset |
HeadingPitchRange
|
<optional>
|
The offset from the target in the local east-north-up reference frame centered at the target. |
complete |
Camera~FlightCompleteCallback
|
<optional>
|
The function to execute when the flight is complete. |
cancel |
Camera~FlightCancelledCallback
|
<optional>
|
The function to execute if the flight is cancelled. |
endTransform |
Matrix4
|
<optional>
|
Transform matrix representing the reference frame the camera will be in when the flight is completed. |
maximumHeight |
Number
|
<optional>
|
The maximum height at the peak of the flight. |
easingFunction |
EasingFunction
|
EasingFunction~Callback
|
<optional>
|
Controls how the time is interpolated over the duration of the flight. |
|
- Source:
getMagnitude() → {Number}
Gets the magnitude of the camera position. In 3D, this is the vector magnitude. In 2D and
Columbus view, this is the distance to the map.
- Source:
Returns:
The magnitude of the position.
-
Type
-
Number
getPickRay(windowPosition, resultopt) → {Ray}
Create a ray from the camera position through the pixel at windowPosition
in world coordinates.
Parameters:
Name |
Type |
Attributes |
Description |
windowPosition |
Cartesian2
|
|
The x and y coordinates of a pixel. |
result |
Ray
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
Returns the
Cartesian3
position and direction of the ray.
-
Type
-
Ray
getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight) → {Number}
Return the pixel size in meters.
Parameters:
Name |
Type |
Description |
boundingSphere |
BoundingSphere
|
The bounding sphere in world coordinates. |
drawingBufferWidth |
Number
|
The drawing buffer width. |
drawingBufferHeight |
Number
|
The drawing buffer height. |
- Source:
Returns:
The pixel size in meters.
-
Type
-
Number
getRectangleCameraCoordinates(rectangle, resultopt) → {Cartesian3}
Get the camera position needed to view an rectangle on an ellipsoid or map
Parameters:
Name |
Type |
Attributes |
Description |
rectangle |
Rectangle
|
|
The rectangle to view. |
result |
Cartesian3
|
<optional>
|
The camera position needed to view the rectangle |
- Source:
Returns:
The camera position needed to view the rectangle
-
Type
-
Cartesian3
look(axis, angleopt)
Rotate each of the camera's orientation vectors around axis
by angle
Parameters:
Name |
Type |
Attributes |
Description |
axis |
Cartesian3
|
|
The axis to rotate around. |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
lookAt(target, offset)
Sets the camera position and orientation using a target and offset. The target must be given in
world coordinates. The offset can be either a cartesian or heading/pitch/range in the local east-north-up reference frame centered at the target.
If the offset is a cartesian, then it is an offset from the center of the reference frame defined by the transformation matrix. If the offset
is heading/pitch/range, then the heading and the pitch angles are defined in the reference frame defined by the transformation matrix.
The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
angles are below the plane. Negative pitch angles are above the plane. The range is the distance from the center.
In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the
target will be the magnitude of the offset. The heading will be determined from the offset. If the heading cannot be
determined from the offset, the heading will be north.
Parameters:
Name |
Type |
Description |
target |
Cartesian3
|
The target position in world coordinates. |
offset |
Cartesian3
|
HeadingPitchRange
|
The offset from the target in the local east-north-up reference frame centered at the target. |
- Source:
Throws:
-
lookAt is not supported while morphing.
-
-
Type
-
DeveloperError
Example
// 1. Using a cartesian offset
var center = Cesium.Cartesian3.fromDegrees(-98.0, 40.0);
viewer.camera.lookAt(center, new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0));
// 2. Using a HeadingPitchRange offset
var center = Cesium.Cartesian3.fromDegrees(-72.0, 40.0);
var heading = Cesium.Math.toRadians(50.0);
var pitch = Cesium.Math.toRadians(-20.0);
var range = 5000.0;
viewer.camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, range));
Sets the camera position and orientation using a target and transformation matrix. The offset can be either a cartesian or heading/pitch/range.
If the offset is a cartesian, then it is an offset from the center of the reference frame defined by the transformation matrix. If the offset
is heading/pitch/range, then the heading and the pitch angles are defined in the reference frame defined by the transformation matrix.
The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
angles are below the plane. Negative pitch angles are above the plane. The range is the distance from the center.
In 2D, there must be a top down view. The camera will be placed above the center of the reference frame. The height above the
target will be the magnitude of the offset. The heading will be determined from the offset. If the heading cannot be
determined from the offset, the heading will be north.
Parameters:
Name |
Type |
Attributes |
Description |
transform |
Matrix4
|
|
The transformation matrix defining the reference frame. |
offset |
Cartesian3
|
HeadingPitchRange
|
<optional>
|
The offset from the target in a reference frame centered at the target. |
- Source:
Throws:
-
lookAtTransform is not supported while morphing.
-
-
Type
-
DeveloperError
Example
// 1. Using a cartesian offset
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-98.0, 40.0));
viewer.camera.lookAtTransform(transform, new Cesium.Cartesian3(0.0, -4790000.0, 3930000.0));
// 2. Using a HeadingPitchRange offset
var transform = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(-72.0, 40.0));
var heading = Cesium.Math.toRadians(50.0);
var pitch = Cesium.Math.toRadians(-20.0);
var range = 5000.0;
viewer.camera.lookAtTransform(transform, new Cesium.HeadingPitchRange(heading, pitch, range));
lookDown(amountopt)
Rotates the camera around its right vector by amount, in radians, in the opposite direction
of its up vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
lookLeft(amountopt)
Rotates the camera around its up vector by amount, in radians, in the opposite direction
of its right vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
lookRight(amountopt)
Rotates the camera around its up vector by amount, in radians, in the direction
of its right vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
lookUp(amountopt)
Rotates the camera around its right vector by amount, in radians, in the direction
of its up vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
move(direction, amountopt)
Translates the camera's position by amount
along direction
.
Parameters:
Name |
Type |
Attributes |
Description |
direction |
Cartesian3
|
|
The direction to move. |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveBackward(amountopt)
Translates the camera's position by amount
along the opposite direction
of the camera's view vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveDown(amountopt)
Translates the camera's position by amount
along the opposite direction
of the camera's up vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveForward(amountopt)
Translates the camera's position by amount
along the camera's view vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveLeft(amountopt)
Translates the camera's position by amount
along the opposite direction
of the camera's right vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveRight(amountopt)
Translates the camera's position by amount
along the camera's right vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
moveUp(amountopt)
Translates the camera's position by amount
along the camera's up vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in meters, to move. Defaults to defaultMoveAmount . |
- Source:
- See:
-
pickEllipsoid(windowPosition, ellipsoidopt, resultopt) → {Cartesian3}
Pick an ellipsoid or map.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
windowPosition |
Cartesian2
|
|
|
The x and y coordinates of a pixel. |
ellipsoid |
Ellipsoid
|
<optional>
|
Ellipsoid.WGS84
|
The ellipsoid to pick. |
result |
Cartesian3
|
<optional>
|
|
The object onto which to store the result. |
- Source:
Returns:
If the ellipsoid or map was picked, returns the point on the surface of the ellipsoid or map
in world coordinates. If the ellipsoid or map was not picked, returns undefined.
-
Type
-
Cartesian3
rotate(axis, angleopt)
Rotates the camera around axis
by angle
. The distance
of the camera's position to the center of the camera's reference frame remains the same.
Parameters:
Name |
Type |
Attributes |
Description |
axis |
Cartesian3
|
|
The axis to rotate around given in world coordinates. |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultRotateAmount . |
- Source:
- See:
-
rotateDown(angleopt)
Rotates the camera around the center of the camera's reference frame by angle downwards.
Parameters:
Name |
Type |
Attributes |
Description |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultRotateAmount . |
- Source:
- See:
-
rotateLeft(angleopt)
Rotates the camera around the center of the camera's reference frame by angle to the left.
Parameters:
Name |
Type |
Attributes |
Description |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultRotateAmount . |
- Source:
- See:
-
rotateRight(angleopt)
Rotates the camera around the center of the camera's reference frame by angle to the right.
Parameters:
Name |
Type |
Attributes |
Description |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultRotateAmount . |
- Source:
- See:
-
rotateUp(angleopt)
Rotates the camera around the center of the camera's reference frame by angle upwards.
Parameters:
Name |
Type |
Attributes |
Description |
angle |
Number
|
<optional>
|
The angle, in radians, to rotate by. Defaults to defaultRotateAmount . |
- Source:
- See:
-
setView(options)
Sets the camera position, orientation and transform.
Parameters:
Name |
Type |
Description |
options |
Object
|
Object with the following properties:
Properties
Name |
Type |
Attributes |
Description |
destination |
Cartesian3
|
Rectangle
|
<optional>
|
The final position of the camera in WGS84 (world) coordinates or a rectangle that would be visible from a top-down view. |
orientation |
Object
|
<optional>
|
An object that contains either direction and up properties or heading, pith and roll properties. By default, the direction will point
towards the center of the frame in 3D and in the negative z direction in Columbus view. The up direction will point towards local north in 3D and in the positive
y direction in Columbus view. Orientation is not used in 2D when in infinite scrolling mode. |
endTransform |
Matrix4
|
<optional>
|
Transform matrix representing the reference frame of the camera. |
|
- Source:
Example
// 1. Set position with a top-down view
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
});
// 2 Set view with heading, pitch and roll
viewer.camera.setView({
destination : cartesianPosition,
orientation: {
heading : Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
pitch : Cesium.Math.toRadians(-90), // default value (looking down)
roll : 0.0 // default value
}
});
// 3. Change heading, pitch and roll with the camera position remaining the same.
viewer.camera.setView({
orientation: {
heading : Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
pitch : Cesium.Math.toRadians(-90), // default value (looking down)
roll : 0.0 // default value
}
});
// 4. View rectangle with a top-down view
viewer.camera.setView({
destination : Cesium.Rectangle.fromDegrees(west, south, east, north)
});
// 5. Set position with an orientation using unit vectors.
viewer.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(-122.19, 46.25, 5000.0),
orientation : {
direction : new Cesium.Cartesian3(-0.04231243104240401, -0.20123236049443421, -0.97862924300734),
up : new Cesium.Cartesian3(-0.47934589305293746, -0.8553216253114552, 0.1966022179118339)
}
});
twistLeft(amountopt)
Rotate the camera counter-clockwise around its direction vector by amount, in radians.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
twistRight(amountopt)
Rotate the camera clockwise around its direction vector by amount, in radians.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount, in radians, to rotate by. Defaults to defaultLookAmount . |
- Source:
- See:
-
viewBoundingSphere(boundingSphere, offsetopt)
Sets the camera so that the current view contains the provided bounding sphere.
The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere.
The heading and the pitch angles are defined in the local east-north-up reference frame.
The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
angles are below the plane. Negative pitch angles are above the plane. The range is the distance from the center. If the range is
zero, a range will be computed such that the whole bounding sphere is visible.
In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the
target will be the range. The heading will be determined from the offset. If the heading cannot be
determined from the offset, the heading will be north.
Parameters:
Name |
Type |
Attributes |
Description |
boundingSphere |
BoundingSphere
|
|
The bounding sphere to view, in world coordinates. |
offset |
HeadingPitchRange
|
<optional>
|
The offset from the target in the local east-north-up reference frame centered at the target. |
- Source:
Throws:
-
viewBoundingSphere is not supported while morphing.
-
-
Type
-
DeveloperError
worldToCameraCoordinates(cartesian, resultopt) → {Cartesian4}
Transform a vector or point from world coordinates to the camera's reference frame.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian4
|
|
The vector or point to transform. |
result |
Cartesian4
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed vector or point.
-
Type
-
Cartesian4
worldToCameraCoordinatesPoint(cartesian, resultopt) → {Cartesian3}
Transform a point from world coordinates to the camera's reference frame.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian3
|
|
The point to transform. |
result |
Cartesian3
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed point.
-
Type
-
Cartesian3
worldToCameraCoordinatesVector(cartesian, resultopt) → {Cartesian3}
Transform a vector from world coordinates to the camera's reference frame.
Parameters:
Name |
Type |
Attributes |
Description |
cartesian |
Cartesian3
|
|
The vector to transform. |
result |
Cartesian3
|
<optional>
|
The object onto which to store the result. |
- Source:
Returns:
The transformed vector.
-
Type
-
Cartesian3
zoomIn(amountopt)
Zooms amount
along the camera's view vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount to move. Defaults to defaultZoomAmount . |
- Source:
- See:
-
zoomOut(amountopt)
Zooms amount
along the opposite direction of
the camera's view vector.
Parameters:
Name |
Type |
Attributes |
Description |
amount |
Number
|
<optional>
|
The amount to move. Defaults to defaultZoomAmount . |
- Source:
- See:
-
Type Definitions
FlightCancelledCallback()
A function that will execute when a flight is cancelled.
- Source:
FlightCompleteCallback()
A function that will execute when a flight completes.
- Source: