Qt Quick 3D - XR 프리폼 텔레포트 예제

Qt Quick 3D XR에서 간단한 이동을 구현하는 방법을 시연합니다.

개요

이 예제에서는 비연속적인 이동 형태인 간단한 자유형 텔레포트 시스템을 사용하여 가상 환경의 장소로 이동하는 방법을 보여줍니다.

컨트롤

탐색하려면 오른쪽 컨트롤러의 엄지 스틱을 사용합니다:

  • 스틱을 앞으로 밀면 조준하고, 스틱을 놓으면 순간이동합니다.
  • 스틱을 옆으로 움직이면 회전합니다.

구현

텔레포트 로직은 FreeformTeleporter 컴포넌트에서 구현됩니다. 이는 별도의 하위 프로젝트 xr_shared 에 있으므로 다른 프로젝트에서 쉽게 재사용할 수 있습니다.

FreeformTeleporter {
    id: teleporter

    view: xrView
    originNode: xrOrigin
    cameraNode: xrOrigin.camera
    beamHandle: xrRightController

    rotationTriggerValue: xrRightController.xValue
    teleportTriggerValue: xrRightController.yValue

    onDoTeleportation: (cameraOriginPosition)=> {
                           xrOrigin.position = cameraOriginPosition
                       }
    onDoRotation: (cameraOriginRotation, cameraOriginPosition)=> {
                      xrOrigin.rotation = cameraOriginRotation
                      xrOrigin.position = cameraOriginPosition
                  }
}

프리폼 텔레포터 컴포넌트에는 다음과 같은 프로퍼티를 설정해야 합니다:

QtObject xrView

xrView 속성은 XrView 의 내장된 광선 선택 기능에 대한 액세스를 제공합니다. rayPick 메서드를 구현하는 모든 객체를 사용할 수 있습니다. 예를 들어 View3D 은 프로토타이핑에 유용할 수 있습니다.

Node originNode

originNode 프로퍼티는 자유형 텔레포터가 조작할 노드를 지정합니다. XR에서 인위적인 이동은 XrOrigin 을 이동하여 수행됩니다. 따라서 XrView 의 xrOrigin을 originNode 으로 사용합니다.

Node cameraNode

cameraNode 속성은 카메라의 위치를 제공합니다. 회전할 때는 회전 중심을 정의합니다. 텔레포트할 때는 선택한 위치 위에 배치될 위치를 정의합니다. 이 예제에서는 앞서 만든 추적된 XrCamera 을 사용합니다.

참고: XR에서 XrOrigin 은 씬과 사용자의 참조 공간 간의 관계를 정의합니다. 이 참조 공간은 일반적으로 사용자 주변의 물리적 공간에 고정됩니다. XrOrigin 의 위치를 변경하면 물리적 위치가 씬 좌표에 매핑되는 방식이 변경됩니다. XrCamera 은 사용자의 머리 위치를 추적합니다. 사용자가 물리적으로 움직이면 XrCamera 의 위치와 방향이 XrOrigin 을 기준으로 변경됩니다.

Node beamHandle

beamHandle 속성은 텔레포트 빔의 시작점으로 사용되는 노드입니다. 이 예제에서는 오른쪽 컨트롤러를 빔 핸들로 사용합니다.

예제 프로젝트 @ code.qt.io

Qt Quick 3D Xr의 로코모션도참조하세요 .

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