The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself.
OptionaldomElement: HTMLElement | SVGElement | nullThe HTML element used for event listeners. (optional)
Set to true to automatically rotate around the target.
Note that if this is enabled, you must call .update() in your animation loop. If you want the auto-rotate speed
to be independent of the frame rate (the refresh rate of the display), you must pass the time deltaTime, in
seconds, to .update().
How fast to rotate around the target if .autoRotate is true. Default is 2.0, which equates to 30 seconds per orbit at 60fps. Note that if .autoRotate is enabled, you must call .update() in your animation loop.
The focus point of the .minTargetRadius and .maxTargetRadius limits. It can be updated manually at any point to change the center of interest for the .target.
The damping inertia used if .enableDamping is set to true. Default is 0.05.
Note that for this to work, you must call .update() in your animation loop.
The HTML element used for event listeners. If not provided via the constructor, .connect must be called
after domElement has been set.
When set to false, the controls will not respond to user input. Default is true.
Set to true to enable damping (inertia), which can be used to give a sense of weight to the controls. Default is false. Note that if this is enabled, you must call .update() in your animation loop.
Enable or disable camera panning. Default is true.
Enable or disable horizontal and vertical rotation of the camera. Default is true. Note that it is possible to disable a single axis by setting the min and max of the [polar angle].minPolarAngle or [azimuth angle].minAzimuthAngle to the same value, which will cause the vertical or horizontal rotation to be fixed at that value.
Enable or disable zooming (dollying) of the camera.
How fast to pan the camera when the keyboard is used. Default is 7.0 pixels per keypress.
How fast to rotate the camera when the keyboard is used. Default is 1.
This object contains references to the keycodes for controlling camera panning. Default is the 4 arrow keys.
How far you can orbit horizontally, upper limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.
How far you can dolly out ( PerspectiveCamera only ). Default is Infinity.
How far you can orbit vertically, upper limit. Range is 0 to Math.PI radians, and default is Math.PI.
How far you can move the target from the 3D .cursor. Default is Infinity.
How far you can zoom out ( OrthographicCamera only ). Default is Infinity.
How far you can orbit horizontally, lower limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.
How far you can dolly in ( PerspectiveCamera only ). Default is 0.
How far you can orbit vertically, lower limit. Range is 0 to Math.PI radians, and default is 0.
How close you can get the target to the 3D .cursor. Default is 0.
How far you can zoom in ( OrthographicCamera only ). Default is 0.
This object contains references to the mouse actions used by the controls.
The 3D object that is managed by the controls.
Speed of panning. Default is 1.
Used internally by the .saveState and .reset methods.
Speed of rotation. Default is 1.
Defines how the camera's position is translated when panning. If true, the camera pans in screen space.
Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is true.
The focus point of the controls, the .object orbits around this. It can be updated manually at any point to change the focus of the controls.
Used internally by the .saveState and .reset methods.
This object contains references to the touch actions used by the controls.
Used internally by the .saveState and .reset methods.
Speed of zooming / dollying. Default is 1.
Setting this property to true allows to zoom to the cursor's position. Default is false.
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Connects the controls to the DOM. This method has so called "side effects" since it adds the module's event listeners to the DOM.
Disconnects the controls from the DOM.
Fire an event type.
The event that gets fired.
Call this method if you no longer want use to the controls. It frees all internal resources and removes all event listeners.
Get the current horizontal rotation, in radians.
Returns the distance from the camera to the target.
Get the current vertical rotation, in radians.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Adds key event listeners to the given DOM element. window is a recommended argument for using this method.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
Reset the controls to their state from either the last time the .saveState was called, or the initial state.
Save the current state of the controls. This can later be recovered with .reset.
Removes the key event listener previously defined with .listenToKeyEvents().
Update the controls. Must be called after any manual changes to the camera's transform, or in the update loop if
.autoRotate or .enableDamping are set. deltaTime, in seconds, is optional, and is only required
if you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display).
OptionaldeltaTime: number | null
Orbit controls allow the camera to orbit around a target.