Qt Quick 3D - XR フリーフォーム テレポーテーションの例
Qt Quick 3D XRで簡単なロコモーションを作る方法を説明します。
概要
この例では、簡単なフリーフォームテレポートシステム(非連続的な移動形式)を使用して、仮想環境内の場所に移動する方法を示します。
コントロール
この例を実行するときは、ナビゲーションに次のコントロールを使用します。
アクション | コントロール |
---|---|
回転 | 右コントローラーの左右スティック |
照準とテレポート | 右コントローラーの前方スティック |
実装
すべてのロジックがこの型に含まれているため、他のプロジェクトでFreeformTeleporter
を簡単に再利用できます。
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 } }
FreeformTeleporter コンポーネントには、次のプロパティを設定する必要があります:
var rayPicker
rayPicker
プロパティには、rayPick メソッドを実装する任意のオブジェクトを指定できます。この例では、XrView の組み込みレイ ピック メソッドを使用しています。
Node cameraOrigin
cameraOrigin
プロパティは、カメラのローカル参照空間の中心です。Xr では、カメラのようなトラッキングされたアイテムが相対的に配置される場所になります。したがって、XrOrigin ノードを cameraOrigin として使用します。
Node camera
camera
プロパティには、シーンのレンダリングに使用するカメラが含まれます。この例では、先ほど作成したトラッキングされたXrCamera を使用します。
Node beamHandle
beamHandle
プロパティは、テレポーテーション ビームの始点として使用されるノードです。この例では、beamHandle として右コントローラxrRightController を使用します。
Qt Quick 3D XrのLocomotionも参照して ください。
© 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.