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
|
- Source:
Classes
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: