Class: OrbitControls

OrbitControls(camera, element, optionsopt)

Orbit controller, that rotates a camera around a target point. Controls: - Mouse left drag: orbit (yaw/pitch). - Mouse wheel: zoom (distance). Notes: - This class modifies camera local `position` and `rotation`. - View matrix is still computed by the camera (inverse of its TRS transform).

Constructor

new OrbitControls(camera, element, optionsopt)

Parameters:
Name Type Attributes Description
camera Camera Controlled camera instance.
element HTMLElement DOM element that receives input (usually the canvas).
options Object <optional>
Orbit options (plain object).
Properties
Name Type Attributes Default Description
targetX number <optional>
0 Orbit target X component.
targetY number <optional>
0 Orbit target Y component.
targetZ number <optional>
0 Orbit target Z component.
distance number <optional>
6 Orbit distance from the target.
minDistance number <optional>
0.1 Minimum orbit distance.
maxDistance number <optional>
1000 Maximum orbit distance.
azimuthRadians number <optional>
0.7 Initial yaw angle in radians.
polarRadians number <optional>
-0.6 Initial pitch angle in radians.
minPolarRadians number <optional>
-1.5 Minimum pitch angle in radians.
maxPolarRadians number <optional>
1.5 Maximum pitch angle in radians.
rotationSpeed number <optional>
1.0 Rotation speed multiplier.
zoomSpeed number <optional>
1.0 Zoom speed multiplier.
Source:

Classes

OrbitControls

Members

distance

Current orbit distance.
Source:

target

Orbit target (the point camera looks at).
Source:

Methods

dispose()

Disposes the controller by removing all event listeners.
Source:

isRotationEnabled() → {boolean}

Returns the current state of the pointer-driven camera rotation input.
Source:
Returns:
- True if the rotation input is enabled, otherwise false.
Type
boolean

setCamera(camera)

Replaces the controlled camera.
Parameters:
Name Type Description
camera Camera New controlled camera instance.
Source:

setDistance(distance)

Sets orbit distance (useful for UI sliders).
Parameters:
Name Type Description
distance number New distance value.
Source:

setRotationEnabled(enabled) → {void}

Enables or disables the pointer-driven rotation.
Parameters:
Name Type Description
enabled boolean Whether the rotation input is enabled.
Source:
Throws:
When the enabled flag is invalid.
Type
TypeError
Returns:
Type
void

setTarget(x, y, z)

Sets orbit target components.
Parameters:
Name Type Description
x number Target X component.
y number Target Y component.
z number Target Z component.
Source:

update()

Applies the current orbit state to the camera (position + rotation).
Source: