Control node position and orientation with keys and mouse. More...
Import Statement: | import QtQuick3D.Helpers |
Inherits: |
This helper allows the user to control a node using W, A, S, D, the arrow keys, and the mouse. Usually the controlled node is a Camera, specified in the controlledObject property.
Adding a WasdController can be highly useful both in applications that wish to provide a standard way of navigating the scene, and also as a temporary measure during development and troubleshooting, as it allows inspecting the scene at run time via familiar keyboard and mouse navigation.
The key bindings are as follows:
W
or up
- go forwardS
or down
- go backwardA
or left
- strafe leftD
or right
- strafe rightR
or page up
- move upF
or page down
- move downshift
together with other keys - move faster, depending on shiftSpeed
The following snippet shows how a WasdController object can be added. By default both key and mouse based navigation is active, so in most cases there is no further configuration needed:
View3D { anchors.fill: parent camera: camera PerspectiveCamera { id: camera position: Qt.vector3d(0, 0, 600) } ... } WasdController { controlledObject: camera }
acceptedButtons : enumeration
Specifies the buttons accepted by the controller.
See also DragHandler and MultiPointHandler.
backSpeed : real
Specifies the speed of navigation when the back key is pressed.
controlledObject : QtQuick3D::Node
Specifies the node to control. This is typically a Camera object.
downSpeed : real
Specifies the speed of navigation when the down key is pressed.
forwardSpeed : real
Specifies the speed of navigation when the forward key is pressed.
[read-only] inputsNeedProcessing : bool
This property is true when there are inputs needing processing.
keysEnabled : bool
Enables key controls. The default value is true.
leftSpeed : real
Specifies the speed of navigation when the left key is pressed.
mouseEnabled : bool
Enables mouse controls. The default value is true.
rightSpeed : real
Specifies the speed of navigation when the right key is pressed.
shiftSpeed : real
Specifies the speed multiplier that is active when the shift key is pressed.
speed : real
Specifies the speed of navigation.
upSpeed : real
Specifies the speed of navigation when the up key is pressed.
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.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qml-qtquick3d-helpers-wasdcontroller.html