Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created February 20, 2018 15:57
Show Gist options
  • Save azamsharp/33763175cbf24b038ece10c264a1e12f to your computer and use it in GitHub Desktop.
Save azamsharp/33763175cbf24b038ece10c264a1e12f to your computer and use it in GitHub Desktop.
@objc func tapped(recognizer :UIGestureRecognizer) {
guard let currentFrame = self.sceneView.session.currentFrame else {
return
}
// create a web view
let webView = UIWebView(frame: CGRect(x: 0, y: 0, width: 640, height: 480))
let request = URLRequest(url: URL(string: "http://www.amazon.com")!)
webView.loadRequest(request)
let tvPlane = SCNPlane(width: 1.0, height: 0.75)
tvPlane.firstMaterial?.diffuse.contents = webView
tvPlane.firstMaterial?.isDoubleSided = true
let tvPlaneNode = SCNNode(geometry: tvPlane)
var translation = matrix_identity_float4x4
translation.columns.3.z = -1.0
tvPlaneNode.simdTransform = matrix_multiply(currentFrame.camera.transform, translation)
tvPlaneNode.eulerAngles = SCNVector3(0,0,0)
self.sceneView.scene.rootNode.addChildNode(tvPlaneNode)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment