i have a question regarding removing SCNNodes I have a function that makes a SCNNodes, when the Node is ready I add it with:
scene.rootNode.addChildNode(node)
then I make a new SCNNode with the function and like to remove the old one and add the new one, unfortunately SCNNode.removeFromParentNode()
wont remove the old one:
func cleanUpAndAdd(){
for node in scene.rootNode.childNodes{
if node.name == "object" {
node.removeFromParentNode()
scene.rootNode.addChildNode(object)
object.name = "object"
} else {
scene.rootNode.addChildNode(object)
object.name = "object"
}
}
}
It just adds and adds and never removes...
What am I missing?