1

I have a ARSCNView in which I have placed some SCNNodes, assigned IDs to each one of them and then stored them in an array.

Now what I'm trying to get is SCNNode when I tap it. Right now I am able to tap and change colour of the node. But I am unable to get the node with ID I set (it is 0 as I set it in stored properties), it's position is also (0,0,0). What I think is it is returning a new instance of that node.

I took this code as a reference: https://stackoverflow.com/a/46074366/6605214

Any help would be appreciated.

1 Answers1

1

Found the solution. I was loading node from scene in wrong way.

Before:

let scene = SCNScene(named: "marker.scn")!
let node = scene.rootNode

After:

let scene = SCNScene(named: "marker.scn")!
let node = scene.rootNode.childNode(withName: "marker", recursively: true)