Skip to content

Instantly share code, notes, and snippets.

@MasDennis
Last active July 8, 2020 20:02
Show Gist options
  • Save MasDennis/9daa4a0cd92db9662700df61ff0d367b to your computer and use it in GitHub Desktop.
Save MasDennis/9daa4a0cd92db9662700df61ff0d367b to your computer and use it in GitHub Desktop.
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