ios - Error: removing the root node of a scene from its scene is not allowed -


i getting error @ last line of code.

- (scnscene *)getworkingscene {     scnscene *workingsceneview  = self.scene;      if (workingsceneview == nil){         workingsceneview = [[scnscene alloc] init];         workingsceneview.background.contents = self.skycolor;         self.scene = workingsceneview;         self.allowscameracontrol = true;         self.autoenablesdefaultlighting = true;         self.showsstatistics = true;         self.backgroundcolor = self.skycolor;         self.delegate = self;     }      return workingsceneview; }  dpoint *point = [coodinate convertcooridnateto3dpoint]; nsurl *pathtoresource = [nsurl urlwithobjectname:objectname oftype:@"dae"]; nserror *error; scnscene *scene = [scnscene scenewithurl:pathtoresource options:nil error:&error]; scnnode *node = scene.rootnode; node.position = scnvector3make(point.x, point.y, point.z); node.rotation = scnvector4make(0, 1, 0, ((m_pi*point.y)/180.0)); scnscene *workingscene = self.getworkingscene; [workingscene.rootnode addchildnode:node]; 

a node can belong 1 scene, view can have 1 parent view.

when call [workingscene.rootnode addchildnode:node]; moving node current scene (scene) different scene (workingscene). node root node of scene. not allowed remove root node of scene, hence error.

one solution move of child nodes of node workingscene.rootnode.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -