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
The options for configuring the controller.
See also
Types
Properties
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.
The drag input bindings that control tilting. Each binding is a combination of the mouse button and an optional keyboard modifier.
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.
The maximum orbit velocity in radians per second. A value of Number.POSITIVE_INFINITY means that the maximum orbit velocity is unbounded.
The maximum tilt velocity in radians per second. A value of Number.POSITIVE_INFINITY means that the maximum tilt velocity is unbounded.
Specifies the length of time in seconds in which a single orbit animation completes.
Enabled dragging to orbit the camera.
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.
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.
Specifies the length of time in seconds in which a single tilt animation is targeted to complete.
Enabled dragging to tilt the camera.
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.
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
Invoked when the controller is added to the DOM. Implement connectedCallback to set up any DOM event listeners.
Invoked when the controller is removed from the DOM. Implement disconnectedCallback to tear down any DOM event listeners.
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.
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.
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.
Invoked once per frame. Implement update to modify the camera or other parts of the scene.