Skip to content

Instantly share code, notes, and snippets.

@simform-solutions
Created June 25, 2018 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simform-solutions/b1ae307c55af414d66fdfb2b64d2287a to your computer and use it in GitHub Desktop.
Save simform-solutions/b1ae307c55af414d66fdfb2b64d2287a to your computer and use it in GitHub Desktop.
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