Chapter 21: World Tracking & Persistent AR Experiences

前言

這個新app的主要功能就是可以把ar體驗記錄下來,下次開啟app時可以繼續上次的ar體驗。

這app可以在實體世界的任何地方進行塗鴉,然後紀錄。下次重啟app只要經過同樣的地方就可以看到之前留下的塗鴉。

大綱

Getting started

這個app只能在iOS12上才能使用。 Sketch Button: 按下去後。可以隨意地移動裝置進行塗鴉。 Reset Button: 就是清空當前所有塗鴉。 ------

Placing anchors

要達到Persistent,要依賴ARKit幾個重要class - ARWorldMap, ARSession, ARAnchor

  • ARWorldMap: 可以想像是用來記錄環境特徵,例如當app移到相同的場景,可以把之前的ar塗鴉讀取出來放在場景上,以達到Persistent的功能。

  • ARSession: 主要是用來協助進行存檔,讀檔。

  • ARAnchor: 這就是要被存起來或讀取的資料。

Adding ARAnchor objects to your ARSession is a requirement because the objects are the means to restore the state of the app when it relaunches in the same physical environment

Saving your world map

  • 要取得穩定可靠(取得很多辨識度良好的環境特徵)的world map是要看時機的。

  • 可以透過ARFrame.WorldMappingStatus觀察是否是好時機。

Loading and restoring content

可以把AR記錄起來,當來就要可以讀取出來。

Resetting content

Last updated