Qt Quick 3D - XR Freeform Teleportation Example
Demonstrates how to make a simple locomotion in Qt Quick 3D XR.
Overview
This example shows how to move to places in the virtual environment using a simple freeform teleportation system.
Controls
When you run the example, use the following controls for navigation.
Rotation | Left and Right stick on the right controller |
Aim and Teleport | Forward stick on the right controller |
Implementation
In this example the logic for the teleportation is contained within the FreeformTeleporter component for easy re-use in other projects.
FreeformTeleporter { id: teleporter rayPicker: xrView cameraOrigin: xrOrigin camera: xrOrigin.camera beamHandle: xrRightController onDoTeleportation: (cameraOriginPosition)=> { xrOrigin.position = cameraOriginPosition } onDoRotation: (cameraOriginRotation, cameraOriginPosition)=> { xrOrigin.rotation = cameraOriginRotation xrOrigin.position = cameraOriginPosition } }
The FreeformTeleporter component has the following properties that needs to be set:
var rayPicker
The rayPicker property can be any object that implements a rayPick method. In this example we are using the XrView's built-in ray picking method.
Node cameraOrigin
The cameraOrigin property is the center of the camera's local reference space. In Xr this will be the location where tracked items, like the camera, will be placed in relation to. We will therefore use the XrOrigin node as the cameraOrigin.
Node camera
The camera property contains the camera that that is used to render the scene. In our example we use the tracked XrCamera we created earlier.
Node beamHandle
The beamHandle property is the node that will be used as the start point for the teleportation beam. In our example we use the right controller xrRightController as the beamHandle.
See also Locomotion in Qt Quick 3D Xr.
© 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.