Chapter 11: Beginning User Interaction

大綱

接下來要繼續上一章的功能的接續。已經可以偵測到一個長方形平面,並在上面置放一個虛擬平面。

  • 目前這個平面的方向是有問題

  • 從平面偵測變成可以偵測QR Code

  • 增加一些使用者互動

  • 虛擬平面變成image再變成carousel

  • 播放影片

摘要

The world coordinate system

worldTransform property

  • 記錄了有關於hit test在world coordinate system的結果,包含了position和orientation。

The camera world alignment

Detecting a QR code

只要把VNDetectRectanglesRequest換成VNDetectBarcodesRequest, VNRectangleObservation換成VNBarcodeObservation就可以。

Showing an image

在虛擬平面上秀出一張圖片。

A UIView can be assigned to a materialarrow-up-right

Showing an image carousel

既然可以用UIImageView當作content,當然可以用更複雜的UIView來當作content,設計一個比較複雜的UIView carousel layout。

Playing a video

在UIView carousel layout中有個play button, 當play button被觸發時會開始播放影片。

Removing the video player

若已經在播放影片,在點擊螢幕一次,可以停止播放並換成billboard。

Last updated