Helper to create orbit camera controls (sometimes called arc ball camera).

Example

// assuming renderer is a valid CameraRenderer
const { camera } = renderer
const orbitControls = new OrbitControls({ camera })

Constructors

Properties

camera: Camera

Camera to use with this OrbitControls.

#element: any = null

HTMLElement (or Window element) to use for event listeners.

target: Vec3

The focus point or the OrbitControls. Default to Vec3(0).

enableZoom: boolean

Whether to allow zooming or not. Default to true.

minZoom: number

Minimum zoom value to use. Default to 0.

maxZoom: number

Maximum zoom value to use. Default to Infinity.

zoomSpeed: number

Zoom speed value to use. Default to 1.

enableRotate: boolean

Whether to allow rotating or not. Default to true.

minPolarAngle: number

Minimum angle to use for vertical rotation. Default to 0.

maxPolarAngle: number

Maximum angle to use for vertical rotation. Default to Math.PI.

minAzimuthAngle: number

Minimum angle to use for horizontal rotation. Default to -Infinity.

maxAzimuthAngle: number

Maximum angle to use for horizontal rotation. Default to Infinity.

rotateSpeed: number

Rotate speed value to use. Default to 1.

enablePan: boolean

Whether to allow paning or not. Default to true.

panSpeed: number

Pan speed value to use. Default to 1.

Accessors

  • get element(): HTMLElement | Window
  • Get our element to use for event listeners.

    Returns HTMLElement | Window

    • HTMLElement (or Window element) used.
  • set element(value): void
  • Set the element to use for event listeners. Can remove previous event listeners first if needed.

    Parameters

    • value: HTMLElement | Window

      HTMLElement (or Window element) to use.

    Returns void

Methods

  • Private

    Update the camera position based on input coordinates so it rotates around the target.

    Parameters

    • x: number

      input coordinate along the X axis.

    • y: number

      input coordinate along the Y axis.

    Returns void