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

automaticClipping : bool [since 6.9]

Enables automatic updating of the camera's clipNear and {Camera::}{clipFar} properties based on the camera's z position. The default value is true.

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

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.


© 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.