このページでは

Qt Quick 3D XR

VRヘッドセットのレンダリング画像

はじめに

拡張現実(XR)とは、仮想現実(VR)、拡張現実(AR)、複合現実(MR)を含む総称です。これらの技術は、ユーザーが周囲の世界を認識する方法を変化させる没入型の体験を生み出します。Qt Quick の3D Xrモジュールは、さまざまなデバイスやプラットフォーム上でQt Quick 3Dを使用したXRアプリケーションを開発するためのAPIを提供します。

Qt Quick 3DとQt Quick 3D XRアプリケーションの違い

エントリポイント

開発者の観点から見た場合、Qt Quick 3DとQt Quick 3D XRアプリケーションの主な違いは、シーンのエントリポイントにあり、実世界の単位やトラッキングデータを把握することが不可欠です。

Qt Quick 3Dでは、最小限のアプリケーションはカメラ、ライト、および3Dモデルで構成されます。これらの要素の位置とサイズは、シーンの座標系で定義されます。この座標系は任意のものであり、アプリケーションのニーズに合わせて開発者が定義することができます。

View3D {
    width: 1280
    height: 720

    PerspectiveCamera {
        position: Qt.vector3d(0, 200, 300)
    }

    DirectionalLight {
    }

    Node {
        id: sceneRoot
        Model {
            id: model
            position: Qt.vector3d(0, -200, 0)
            source: "#Cylinder"
            materials: [ PrincipledMaterial {
                    baseColor: "red"
            }]
        }
    }
}

XRアプリケーションでは、シーンを定義する際に、現実世界の単位とトラッキングデータを考慮する必要があります。カメラの位置と向きは、デバイスの位置と向き、あるいはヘッドマウントディスプレイ(HMD)の場合はユーザーの頭の位置と向きによって定義されます。 シーンの単位は、現実世界の単位と一致させる必要があります。たとえば、ドアや机は、現実世界と仮想世界の両方で同じサイズになるようにしたいでしょう。

注: Qt Quick の3D XRアプリケーションにおけるエントリポイントは 、View3D ではなく、XrView です。また、XrOrigin は、シーンの原点を定義し、トラッキング対象のアイテムはこれに対して相対的に配置されます。

XrView {
    DirectionalLight {
    }

    xrOrigin: XrOrigin {
        XrController {
            id: rightController
            controller: XrController.ControllerRight
        }
        XrController {
            id: leftController
            controller: XrController.ControllerLeft
        }
    }

    Node {
        id: sceneRoot
        Model {
            id: floor
            source: ":meshes/floor.mesh"
            materials: [ PrincipledMaterial {
                    baseColor: "green"
                }]
        }

        Model {
            id: table
            property real height: 0.7
            position: Qt.vector3d(0, height - 2.5, 0)
            source: ":meshes/table.mesh"
            materials: PrincipledMaterial {
                baseColor: "white"
            }
        }

        Model {
            id: monitor
            source: ":meshes/monitor.mesh"
            y: table.height
            XrItem {
                id: theScreen
                y: monitor.yOffset + height
                x: -width / 2
                width: monitor.width
                height: monitor.height
                contentItem: ScreenContent {}
            }
        }
    }
}

追加のCMake関数

すべての「Qt Quick 」3D XRサンプルにおけるCmakeLists.txt ファイルからもわかるように、プロジェクトの最上位にあるCMakeListsファイルにいくつかの関数を追加する必要があります。

カスタムAndroidManifest.xml を指定し、確実にそれが使用されるようにするには、プロジェクトのCMakeListsファイルに次の行を追加します。

if(ANDROID)
    set_property(TARGET xr_simple APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android)
endif()

AndroidManifest.xml の設定に関する詳細については、「Meta Quest 3の始め方」ページの関連セクションを参照してください。

CMakeLists.txt への変更は、MacOSXBundleInfo.plist.in ファイルが組み込まれている visionOS にも適用されます:

if (APPLE AND CMAKE_SYSTEM_NAME STREQUAL "visionOS")
    set_target_properties(xr_simple PROPERTIES
        MACOSX_BUNDLE_GUI_IDENTIFIER io.qt.xr_simple
        MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/visionos/MacOSXBundleInfo.plist.in
    )
endif()

次のステップは?

特定のデバイスでの開始方法に関する詳細については、「Meta Quest 3 入門」または「Apple Vision Pro 入門」をご覧ください。サポートされているプラットフォームおよびデバイスに関する詳細については、「サポートされているプラットフォーム 」ページを参照してください。

特定のQt Quick 3D XR APIをお探しの場合は、「API Reference 」を参照するか、Qt Quick 3DXR APIの使用方法を示す「Qt Quick 3D XR Examples」のいずれかを試してみてください。

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