Created
June 6, 2018 16:26
-
-
Save azamsharp/fc5e3bf3f337a84d360ebd1fdb47261f 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, didAdd node: SCNNode, for anchor: ARAnchor) { | |
if anchor is ARImageAnchor { | |
let phoneScene = SCNScene(named: "Phone_01.scn")! | |
let phoneNode = phoneScene.rootNode.childNode(withName: "parentNode", recursively: true)! | |
// rotate the phone node | |
let rotationAction = SCNAction.rotateBy(x: 0, y: 0.5, z: 0, duration: 1) | |
let inifiniteAction = SCNAction.repeatForever(rotationAction) | |
phoneNode.runAction(inifiniteAction) | |
phoneNode.position = SCNVector3(anchor.transform.columns.3.x,anchor.transform.columns.3.y + 0.1,anchor.transform.columns.3.z) | |
node.addChildNode(phoneNode) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment