3

How can I create a copy of a node in SceneKit(using swift)? I have read Apple documentation but i didn't figure it out. I tried with clone() method and copy. But none of them gave results(actually nothing happened). Any hints?

Edit

Code is pretty simple. I have added successfully to scene node named ,,shipNode" and I want to make a copy of it. This is how my code looks like:

var life1 = shipNode.clone() as! SCNNode;
life1.position = SCNVector3Make(0, 0, 0);
self.rootNode.addChildNode(life1);
David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
Alec Firtulescu
  • 543
  • 6
  • 18
  • I've used both clone and copy successfully. It would be helpful if you could show the code you have tried so far to copy the node and elaborate on what you are doing with the copied node. – David Rönnqvist Apr 18 '15 at 14:46
  • Code is pretty simple. I have added successfully to scene node named ,,shipNode" and I want to make a copy of it. This is how my code looks like: var life1 = shipNode.clone() as! SCNNode; life1.position = SCNVector3Make(0, 0, 0); self.rootNode.addChildNode(life1); – Alec Firtulescu Apr 18 '15 at 14:56
  • When providing additional information to your question, you should edit it instead of posting comments. I edited your question this time. – David Rönnqvist Apr 18 '15 at 15:24
  • And what is happening when you do that? (Have you also made sure that the ship node is not positioned at 0,0,0?) – David Rönnqvist Apr 18 '15 at 15:26
  • Yes, did all kind of tests. The node that gets cloned just does not appear on screen – Alec Firtulescu Apr 18 '15 at 15:29

0 Answers0