Created
March 4, 2019 14:44
-
-
Save giln/e1174f1d50605eeabb56787b2ad35d62 to your computer and use it in GitHub Desktop.
ARSCNViewDelegate
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
// MARK: - ARSCNViewDelegate | |
func renderer(_: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? { | |
guard let _ = anchor as? ARPlaneAnchor else { return nil } | |
// We return a special type of SCNNode for ARPlaneAnchors | |
return PlaneNode() | |
} | |
func renderer(_: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { | |
guard let planeAnchor = anchor as? ARPlaneAnchor, | |
let planeNode = node as? PlaneNode else { | |
return | |
} | |
planeNode.update(from: planeAnchor) | |
} | |
func renderer(_: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { | |
guard let planeAnchor = anchor as? ARPlaneAnchor, | |
let planeNode = node as? PlaneNode else { | |
return | |
} | |
planeNode.update(from: planeAnchor) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment