class pygfx.controllers.OrbitController(camera=None, *, enabled=True, damping=4, auto_update=True, register_events=None)

Bases: PanZoomController

A controller to move a camera in an orbit around a center position.

Supports panning parallel to the screen, zooming, orbiting.

The direction of rotation is defined such that it feels like you’re grabbing onto something in the foreground; if you move the mouse to the right, the objects in the foreground move to the right, and those in the background (on the opposite side of the center of rotation) move to the left.

Default controls:

  • Left mouse button: orbit / rotate.

  • Right mouse button: pan.

  • Fourth mouse button: quickzoom

  • wheel: zoom to point.

  • alt+wheel: adjust fov.

rotate(delta: Tuple, rect: Tuple, *, animate=False)

Rotate in an orbit around the target, using two angles (azimuth and elevation, in radians).

If animate is True, the motion is damped. This requires the controller to receive events from the renderer/viewport.