Created
June 25, 2018 12:21
-
-
Save simform-solutions/b1ae307c55af414d66fdfb2b64d2287a 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
func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? { | |
let node = SCNNode() | |
if let imageAnchor = anchor as? ARImageAnchor { | |
let plane = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height) | |
plane.firstMaterial?.diffuse.contents = UIColor(white: 1, alpha: 0.8) | |
let material = SCNMaterial() | |
material.diffuse.contents = viewObj | |
plane.materials = [material] | |
let planeNode = SCNNode(geometry: plane) | |
planeNode.eulerAngles.x = -.pi / 2 | |
node.addChildNode(planeNode) | |
} | |
return node | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment