- Qt 6.10
- Qt Quick 3D
- QML Types
- QtQuick3D.Helpers
- WasdController
- Qt Quick 3D | Commercial or GPLv3

# WasdController QML Type

Control node position and orientation with keys and mouse. More...

Import Statement: | `import QtQuick3D.Helpers`
Inherits: | Item

- List of all members, including inherited members

## Properties

- acceptedButtons : enumeration
- backSpeed : real
- controlledObject : QtQuick3D::Node
- downSpeed : real
- forwardSpeed : real
- inputsNeedProcessing : bool
- keysEnabled : bool
- leftSpeed : real
- mouseEnabled : bool
- rightSpeed : real
- shiftSpeed : real
- speed : real
- upSpeed : real
- xInvert : bool
- xSpeed : real
- yInvert : bool
- ySpeed : real

## Detailed Description

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 forward
- `S` or `down` - go backward
- `A` or `left` - strafe left
- `D` or `right` - strafe right
- `R` or `page up` - move up
- `F` or `page down` - move down
- `shift` 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
     }

## Property Documentation

acceptedButtons : enumeration `[default: Qt.LeftButton]`

Specifies the buttons accepted by the controller.

See also DragHandler and MultiPointHandler.

backSpeed : real `[default: 5]`

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

Specifies the speed of navigation when the down key is pressed.

forwardSpeed : real `[default: 5]`

Specifies the speed of navigation when the forward key is pressed.

inputsNeedProcessing : bool `[read-only]`

This property is true when there are inputs needing processing.

keysEnabled : bool `[default: true]`

Enables key controls.

leftSpeed : real `[default: 5]`

Specifies the speed of navigation when the left key is pressed.

mouseEnabled : bool `[default: true]`

Enables mouse controls.

rightSpeed : real `[default: 5]`

Specifies the speed of navigation when the right key is pressed.

shiftSpeed : real `[default: 3]`

Specifies the speed multiplier that is active when the shift key is pressed.

speed : real `[default: 1]`

Specifies the speed of navigation.

upSpeed : real `[default: 5]`

Specifies the speed of navigation when the up key is pressed.

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.