- Qt 6.8
- Qt Quick 3D
- QML Types
- QtQuick3D.Helpers
- OrbitCameraController
- Qt Quick 3D | Commercial or GPLv3

# OrbitCameraController QML Type

Camera Controller which rotates around an origin. More...

Import Statement: | `import QtQuick3D.Helpers`
Inherits: | Item

- List of all members, including inherited members

## Properties

- camera : QtQuick3D::Camera
- mouseEnabled : bool
- origin : QtQuick3D::Node
- panEnabled : bool
- xInvert : bool
- xSpeed : real
- yInvert : bool
- ySpeed : real

## Detailed Description

This helper provides a way to rotate a camera around an origin. To function OrbitCameraController accepts a Node as the origin, and a Camera object which should be a child of the originNode to control. By only adjusting the z position of the child camera relative to the parent origin it has the effect of moving the camera nearer or farther from the target origin. By applying a rotation to the origin node, the child camera will be orbited around the origin node.

The OrbitCameraController item itself is a 2D item that accepts input events so whatever it's size and position will be where input events are accepted. To zoom either use the scroll wheel of the mouse or perform a pinch gesture. To rotate click or touch and drag the area. To pan, hold control and drag the area. Panning will change the position of the origin node. It is also possible to perform a panning gesture by performing a two finger drag.

     View3D {
         camera: cameraNode
         Node {
             id: originNode
             PerspectiveCamera {
                 id: cameraNode
                 z: 100
             }
         }
         OrbitCameraController {
             anchors.fill: parent
             origin: originNode
             camera: cameraNode
         }
         ...
     }

## Property Documentation

camera : QtQuick3D::Camera

Specifies the camera node to control. This is a required property and should be a child of the origin node.

mouseEnabled : bool

Enables mouse controls. The default value is true.

origin : QtQuick3D::Node

Specifies the origin node to control. This is a required property and should be the parent of the camera

panEnabled : bool

Enables panning controls. The default value is true.

xInvert : bool

Inverts the x-axis controls. The default value is false.

xSpeed : real

Specifies the speed of navigation when the mouse is moved along the X axis.

yInvert : bool

Inverts the y-axis controls. The default value is true.

ySpeed : real

Specifies the speed of navigation when the mouse is moved along the Y axis.