I am trying to access / modify the properties of an SCNSphere
that I have in a SCNScene
. I have the scene pre-set as a file called "spaceScene.scn". I am loading the scene as such
self.sceneView.scene = [SCNScene sceneNamed:@"spaceScene.scn"];
self.sceneView.allowsCameraControl = YES;
self.sceneView.scene.rootNode.camera = [SCNCamera camera];
SCNSphere *earth = (SCNSphere *)[self.sceneView.scene.rootNode childNodeWithName:@"earth" recursively:NO];
NSMutableArray *materials = earth.materials;
NSLog(@"Materials of earth from scene: %@", materials);
I can not seem to get past reading the materials property of the SCNSphere
earth. I keep getting an instance error:
-[SCNNode materials]: unrecognized selector sent to instance 0x1701c5550
Feeling a little silly with this issue but please someone just tell me how to access the sphere properties? thanks
SCNSphere
does not inherit from SCNNode
. You should rather retrieve the node's geometry
which can be a sphere.