Last active
August 22, 2018 13:24
-
-
Save brunomunizaf/0bf3d250180a59138d53d9455c324404 to your computer and use it in GitHub Desktop.
gesture recognizer
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: - Private | |
extension ViewController { | |
@objc func tapped(recognizer: UIGestureRecognizer) { | |
guard let currentFrame = self.sceneView.session.currentFrame, | |
let url = URL(string: "https://www.supercharge.io") else { | |
return | |
} | |
webView.loadRequest(URLRequest(url: url)) | |
let browserPlane = SCNPlane(width: 1.0, height: 0.75) | |
browserPlane.firstMaterial?.diffuse.contents = webView | |
browserPlane.firstMaterial?.isDoubleSided = true | |
let browserPlaneNode = SCNNode(geometry: browserPlane) | |
var translation = matrix_identity_float4x4 | |
translation.columns.3.z = -1.0 | |
browserPlaneNode.simdTransform = matrix_multiply(currentFrame.camera.transform, translation) | |
browserPlaneNode.eulerAngles = SCNVector3Zero | |
self.sceneView.scene.rootNode.addChildNode(browserPlaneNode) | |
} | |
private func loopCoreMLUpdate() { | |
serialQueue.async { | |
self.updateCoreML() | |
self.loopCoreMLUpdate() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment