- Qt 6.10
- 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

- acceptedButtons : Qt::MouseButtons `(since 6.9)`
- automaticClipping : bool `(since 6.9)`
- 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

acceptedButtons : Qt::MouseButtons `[default: Qt.LeftButton, since 6.9]`

Specifies the mouse button that controls the camera.

This property was introduced in Qt 6.9.

automaticClipping : bool `[default: true, since 6.9]`

Enables automatic updating of the camera's clipNear and l{PerspectiveCamera::}{clipFar} properties based on the camera's z position.

This property was introduced in Qt 6.9.

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 `[default: true]`

Enables mouse controls.

origin : QtQuick3D::Node

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

panEnabled : bool `[default: true]`

Enables panning controls.

xInvert : bool `[default: false]`

Inverts the x-axis controls.

xSpeed : real `[default: 0.1]`

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

yInvert : bool `[default: true]`

Inverts the y-axis controls.

ySpeed : real `[default: 0.1]`

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