OrbitCameraController QML Type

Camera Controller which rotates around an origin. 更多...

import 语句: import QtQuick3D.Helpers
继承:

Item

特性

详细描述

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

特性文档编制

camera : QtQuick3D::Camera

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

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.