Starts listening for input on options.view right away
Options for the controller
Orbit around the target on its own whenever no gesture is in progress
Auto-rotate speed in revolutions per minute; negative values turn the other way
Share of the remaining motion applied each update while enableDamping is on; lower values
glide longer
It applies per update, not per second, so the glide is shorter at higher frame rates.
Whether the controller responds to input
Damping and auto-rotate carry on while it's off, and every update still turns the camera to face the target, so turn autoUpdate off too before aiming the camera yourself.
Ease rotation and panning out after input stops, instead of halting with the pointer
The glide happens in update(), so it needs autoUpdate on, or your own update call every frame.
Whether drags pan the camera; pan() works either way
Whether drags rotate the camera; rotate() works either way
Whether the wheel, pinches and any button set to 'zoom' zoom the camera;
zoom() works either way
Largest azimuth the camera can reach, in radians; OrbitCamera#minAzimuthAngle covers how the pair of limits applies
Maximum distance from target
Largest polar angle the camera can reach, in radians
Largest camera.zoom an orthographic camera can reach
Smallest azimuth the camera can reach, in radians
The azimuth limits apply only while both are finite. They wrap, so a minimum greater than the maximum allows the arc that passes through ±π.
Minimum distance from target
Smallest polar angle the camera can reach, in radians
Smallest camera.zoom an orthographic camera can reach; a perspective camera zooms by distance
instead
ReadonlymouseWhat each mouse button does; change a slot to remap that button
Multiplier on pan drags
Whether the browser's context menu is kept from opening over the View, so a right-button drag or a ctrl + click on macOS doesn't open it
It applies only within the View's hitArea and only while enabled is on. On Windows the menu
opens on release, so a right-button drag that ends outside the View still opens it.
Multiplier on rotate drags
true pans in the screen's plane; false pans across the plane at right angles to
OrbitCamera#up, so vertical drags move over the ground like a map
ReadonlytargetWorld-space point the camera orbits; mutate freely, and the change shows on the next update
ReadonlytouchesWhat each touch gesture does; change a slot to remap that gesture
ReadonlyviewThe View3D this controller listens on and whose camera it drives
Multiplier on zoom input from the wheel, pinches and zoom-button drags
Zoom toward the point under the pointer, or between the fingers of a pinch, instead of toward the target
The target follows the zoom, so later orbits pivot near what you zoomed to.
StaticdefaultDefaults for every new OrbitCamera; an option passed as undefined keeps its default
Whether update() runs from Ticker.shared every frame
A default pixi Application renders from app.ticker, not Ticker.shared, so damping and
auto-rotate usually land a frame late. Turn this off and update from app.ticker to keep them
in step with the render.
Sets whether update() runs from Ticker.shared
true to update every frame
Current world-space distance from the camera to target
World-space up axis the orbit turns around
Assign a new value to change it, and the camera settles on the next update. Changing the returned vector in place leaves the orbit turning around the old axis.
Pan as a drag of (deltaX, deltaY) View pixels would, and apply the update
Positive values move the scene right and down, following the drag. It works whatever
enabled and enablePan say, and panSpeed doesn't scale it.
Horizontal drag in View pixels
Vertical drag in View pixels
Restore the last saveState() snapshot (the construction pose by default)
Orbit around target by the given angles and apply the update
It works whatever enabled and enableRotate say, since those only gate input. With damping
on, the turn is spread over the following updates.
Angle around up in radians; positive moves the camera the way a rightward
drag does
Angle toward up in radians; positive raises the camera over the target, as a
downward drag does
Snapshot target, camera.position, and camera.zoom for a later reset()
Moves the camera to match the orbit, applying damping and auto-rotate
Runs every frame while autoUpdate is on; call it yourself every frame when it's off.
Optionalticker: Ticker
The ticker driving this update; supplies frame timing for auto-rotate. Omitted, one 60 fps frame is assumed.
true when the camera changed enough to warrant a re-render
Zoom by a multiplicative factor toward the target and apply the update
It works whatever enabled and enableZoom say, and zoomSpeed doesn't scale it.
> 1 zooms in, < 1 zooms out; an orthographic camera changes camera.zoom
instead of moving
Orbit, zoom and pan controller for a View3D's camera
Rotate with the left mouse button or one finger, zoom with the wheel, the middle button or a two-finger pinch, and pan with the right button, ctrl/meta/shift + left button, or a two-finger drag. Supports damping, zoom-to-cursor, angle and distance limits, auto-rotate, and saving and restoring the camera.
Input comes from the View's pointer and wheel events, so a 3D node that stops propagation keeps the camera still, and the View's
hitAreabounds where input is read. The controller blocks the browser's context menu over the View so the right button can pan; see preventContextMenu.pixi listens for the wheel passively, so wheel zoom can't stop the page from scrolling, nor a trackpad pinch from zooming the page. To stop both, add your own
wheellistener on the canvas with{ passive: false }that callspreventDefault().Example
See