ScreenSpaceTiltOrbitCameraController

Creates a new instance of ScreenSpaceTiltOrbitCameraController.

viewer.scene.screenSpaceCameraController.enableInputs = false;
viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;

const tiltOrbitController = new ScreenSpaceTiltOrbitCameraController();
viewer.addController(tiltOrbitController);
// Tilt around the position under the cursor or tap when dragging starts instead of the position at the center of the screen.
viewer.scene.screenSpaceCameraController.enableInputs = false;
viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;

const tiltOrbitController = new ScreenSpaceTiltOrbitCameraController();
tiltOrbitController.useDragPosition = true;
viewer.addController(tiltOrbitController);
// Configure the controller to use the left mouse button for tilting and orbiting instead of the default right mouse button.
const tiltOrbitController = new ScreenSpaceTiltOrbitCameraController({
dragInputs: [{ button: MouseButton.LEFT }]
});
viewer.addController(tiltOrbitController);

Parameters

options

The options for configuring the controller.

See also

Constructors

Link copied to clipboard
constructor(options: ScreenSpaceTiltOrbitCameraController.ControllerOptions? = definedExternally)

Types

Link copied to clipboard

Properties

Link copied to clipboard

Enables or disables damping for tilt and orbit animations. Damping smooths out the camera movement and makes it feel more natural or weighty, but it can also introduce a slight delay in the camera response. If damping is disabled, the camera will respond immediately to user input.

Link copied to clipboard

The drag input bindings that control tilting. Each binding is a combination of the mouse button and an optional keyboard modifier.

Link copied to clipboard
open override var enabled: Boolean

Determines if the controller is enabled and should be updated by the host scene.

Link copied to clipboard

A parameter in the range [0, 1) used to limit the range of inputs to a percentage of the window width/height per animation frame. This helps keep the camera under control in low-frame-rate situations.

Link copied to clipboard

The maximum orbit velocity in radians per second. A value of Number.POSITIVE_INFINITY means that the maximum orbit velocity is unbounded.

Link copied to clipboard

The maximum tilt velocity in radians per second. A value of Number.POSITIVE_INFINITY means that the maximum tilt velocity is unbounded.

Link copied to clipboard

Specifies the length of time in seconds in which a single orbit animation completes.

Link copied to clipboard

Enabled dragging to orbit the camera.

Link copied to clipboard

The amount at which the camera orbits per dragged pixel. A value of 1.0 means that dragging the mouse across the entire canvas will orbit the camera by 180 degrees.

Link copied to clipboard

A callback function used to pick the world position around which to tilt or orbit. The function is called with Scene, the Cartesian2 screen space position, and a Cartesian3 instance to store the result. The function should return the Cartesian3 world position from which to tilt or orbit, or undefined if no position could be picked.

Link copied to clipboard

Specifies the length of time in seconds in which a single tilt animation is targeted to complete.

Link copied to clipboard

Enabled dragging to tilt the camera.

Link copied to clipboard

The amount at which the camera tilts per dragged pixel. A value of 1.0 means that dragging the mouse across the entire canvas will tilt the camera by 90 degrees.

Link copied to clipboard

If false, the camera will orbit and tilt around the position at the center of the screen. If true, the camera will orbit and tilt around the position under the cursor or tap when dragging starts.

Functions

Link copied to clipboard
open override fun connectedCallback(element: HTMLElement)

Invoked when the controller is added to the DOM. Implement connectedCallback to set up any DOM event listeners.

Link copied to clipboard
open override fun disconnectedCallback(element: HTMLElement)

Invoked when the controller is removed from the DOM. Implement disconnectedCallback to tear down any DOM event listeners.

Link copied to clipboard
open override fun firstUpdate(scene: Scene, time: JulianDate)

Invoked when the controller is being updated the first time, immediately before update is called. Implement firstUpdate to perform one-time work after the relevant scene has begun its render loop. Some examples might include initializing simulation time values or adding a primitive to the scene.

Link copied to clipboard
fun orbit(camera: Camera, target: Cartesian3, axis: Cartesian3, amount: Double, dt: Double, ellipsoid: Ellipsoid? = definedExternally)

Attempts to orbit the camera around the specified origin by the specified amount in radians. Positive values orbit the camera clockwise, negative values orbit the camera counterclockwise. If the drag origin is not on the ellipsoid, no orbit is applied.

Link copied to clipboard
fun tilt(camera: Camera, target: Cartesian3, axis: Cartesian3, amount: Double, dt: Double, ellipsoid: Ellipsoid? = definedExternally)

Attempts to tilt the camera by the specified amount in radians. Positive values tilt the camera down, negative values tilt the camera up. If the drag origin is not on the ellipsoid, no tilt is applied.

Link copied to clipboard
open override fun update(scene: Scene, time: JulianDate)

Invoked once per frame. Implement update to modify the camera or other parts of the scene.