Last active
July 8, 2020 20:02
-
-
Save MasDennis/9daa4a0cd92db9662700df61ff0d367b to your computer and use it in GitHub Desktop.
This file contains 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
import UIKit | |
import ARKit | |
class ViewController: UIViewController, ARSCNViewDelegate { | |
@IBOutlet var sceneView: ARSCNView! | |
private var viewportSize: CGSize! | |
override var shouldAutorotate: Bool { return false } | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
sceneView.delegate = self | |
viewportSize = sceneView.frame.size | |
} | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
let configuration = ARWorldTrackingConfiguration() | |
configuration.planeDetection = [] | |
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