Qt Quick 3D - XR 간단한 예제
Qt Quick 3D XR로 간단한 VR 씬을 설정하는 방법을 보여줍니다.
이 예제는 기본적인 Qt Quick 3D Xr 기능에 대한 소개 개요를 제공합니다.
XR 애플리케이션을 작성할 때 가장 큰 차이점은 main.qml의 루트 항목이 View3D 이 있는 창이 아닌 XrView 이라는 점입니다:
import QtQuick3D import QtQuick3D.Xr XrView { id: xrView XrErrorDialog { id: err } onInitializeFailed: (errorString) => err.run("XRView", errorString) referenceSpace: XrView.ReferenceSpaceLocalFloor
XrView 에는 View3D 과 마찬가지로 3D 장면이 포함됩니다. 이 예제에서는 데스크톱 PC에서 스트리밍할 때 VR 헤드셋을 초기화할 때 오류가 발생하면 오류 대화 상자를 표시하는 XrErrorDialog 을 추가합니다. 또한 이 애플리케이션의 기준 프레임이 사용자가 위치한 방의 바닥에서 측정되도록 지정합니다. 즉, 바닥은 y = 0
입니다.
참조 프레임의 원점은 XrOrigin 에 의해 정의됩니다:
xrOrigin: theOrigin XrOrigin { id: theOrigin XrController { controller: XrController.ControllerLeft poseSpace: XrController.AimPose CubeModel { color: "blue" } } XrController { controller: XrController.ControllerRight poseSpace: XrController.AimPose CubeModel { color: "red" } } }
이 예제에서는 양손에 하나씩 XrController 항목을 두 개 추가합니다. 이는 사용자 손의 위치와 방향을 추적합니다. XrController 은 Node 이므로 모든 어린이는 자동으로 손의 움직임을 따라갑니다. 이 경우 컨트롤러의 위치를 시각화하기 위해 간단한 큐브 모델을 사용합니다.
main.qml의 나머지 부분은 일반적인 Qt Quick 3D 장면입니다.
© 2025 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.