GPSを利用し、現在位置からコンテンツまでの方向と距離を計算して、コンテンツをカメラ上に浮かび上がらせます。
本ページの内容は、サンプルプログラム[TutorialSample.zip]に含まれています。
// AR画面を呼び出すと、設定しておいたコンテンツがARカメラ上に表示される let navigationController = PicnicRootNavigationController.instantiate(.AR) self.presentViewController(navigationController, animated: true, completion: nil)サンプルプログラムTutorialSampleでは、ViewController.swiftのinitializePicnicSDKメソッドに記載されています。
// AR画面の初期設定を行う // カメラの画角 PicnicARSettings.viewAngle = 35 // 一度に表示するコンテンツ数の上限を指定する // (1度に大量のコンテンツを表示するとカメラがコンテンツで埋もれてしまうため) PicnicARSettings.displayContentsLimit = 20 // カメラに浮かぶARタグは、距離によってサイズが変わる。 // 現在位置から近いほど大きく表示される。 // コンテンツに近づいた時に、ARタグが最大サイズで表示される距離を設定する。 PicnicARSettings.maxSizeDistance = 30 // カメラに浮かぶARタグは、距離によってサイズが変わる。 // 現在位置から遠いほど小さく表示される。 // コンテンツから離れた時に、ARタグが表示されなくなる距離を設定する。 PicnicARSettings.minSizeDistance = 200 // コンテンツに近づいた際の、ARタグの最大表示サイズ PicnicARSettings.maxSizeRatio = 0.4 // コンテンツから遠ざかって、表示範囲ギリギリになった際の、ARタグの最小表示サイズ PicnicARSettings.minSizeRatio = 0.05 // 地図画面に移動するボタンをAR画面上に表示するか PicnicARSettings.isVisibleMapButton = trueサンプルプログラムTutorialSampleでは、ViewController.swiftのinitializePicnicSDKメソッドに記載されています。
Key : NSLocationWhenInUseUsageDescription Type : String Value : Your current location may be shown on the map and may be use to display contents on the AR view.