LoginSignup
5
3

ARCore Geospatial Creator for Unityを使って、Googleマップを3Dで眺める

Last updated at Posted at 2023-05-11

はじめに

2023年5月10日(現地時間)Google は、開発者向けに主催する年次カンファレンス Google I/O にて世界規模のAR(拡張現実)体験を数分で作成できる Geospatial Creator を発表しました。

ということで、Unityで早速触ってみましょう!

image.png

今日のゴール

参考ドキュメント

手順

  • 前提
  • APIの承認
  • 地理空間サンプルアプリをimport

前提

  • Unity2021.3以上
    • 記事ではUnity2021.3.19f1

APIの承認

  • Google Maps Tiles API
  • ARCore Geospatial API

Google Maps Tiles API

image.png

ARCore Geospatial API

こちらの記事を参考。

APIキーを控えておきましょう。

Google Maps Tiles APIとARCore Geospatial APIは同じAPI Keyになります。

Geospatialサンプルアプリをimport

Google ARCore Extensions for AR Foundationをinstallする。

  • UnityでPackage Managerを開く
  • [Add package from git URL]をクリック
    • https://github.com/google-ar/arcore-unity-extensions.gitを入力

image.png

  • ARCore ExtensionsのSample「Geospatial Sample」をimport

image.png

  • ProjectSettings > XR Plug-in Management
    • AndroidであればARCore, iOSであればARkitを有効にします。
    • ARCore Extensionsを選択
      • Authentication StrategyAPI Keyに変更し、先ほど入手したAPIキーを貼り付けます

必要な依存関係を追加する

Cesiumをimport

  • Cesiumをimportします
    • https://github.com/CesiumGS/cesium-unity/releases/ にアクセス
    • com.cesium.unity-1.2.0.tgz (2023/05/12の最新)をダウンロード
    • Package Managerにて+から [Add package from tarball...] を選択
    • 先ほどダウンロードしたtgzファイルを選択

image.png

  • こちらYesを選択

Geospatial Creatorを有効

  • Switch PlatformでiOS or Androidを選択
  • Project Settings > XR Plug-in Management > ARCore Extensions
    • [Geospatial]と[Geospatial Creator]にチェックを入れる
    • [Finish]をクリック

Map TilesでGeospatial Creator Originを追加する

シーンには「Geospatial Creator Origin」が一つだけ必要です。

  • ヒエラルキーから
    • XR > AR Geospatial Creator Originを選択
  • AR Geospatial Creator Originを部ジェクトのInspector
    • Add Cesium Georeference Componentをクリック
  • Google Map Tiles API Keyを入力
  • Cesium Georeferenceにて
    • 緯度経度を入力

image.png

image.png

できた!

参考資料: クイックスタート

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3