Last active
October 13, 2018 15:52
-
-
Save SunXiaoShan/ba0627d7c829064b23da4a3f5bd1bede to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
// 判斷是否裝置支援 ar face 功能 | |
guard ARFaceTrackingConfiguration.isSupported else { fatalError() } | |
sceneView.delegate = self | |
} | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
// 畫面顯示的時候,才會開啟功能 | |
let configuration = ARFaceTrackingConfiguration() | |
sceneView.session.run(configuration) | |
} | |
override func viewWillDisappear(_ animated: Bool) { | |
super.viewWillDisappear(animated) | |
// 離開時則關閉 | |
sceneView.session.pause() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment