OrbitCameraController QML Type

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

Import Statement: import QtQuick3D.Helpers
Inherits:

Item

Properties

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 {Camera::}{clipFar} properties based on the camera's z position.

This property was introduced in Qt 6.9.


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.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.