I am developing a scene using SceneKit. I have a main node with a subzone:
// Main node SCNNode* planet = [SCNNode node]; planet.geometry = [SCNSphere sphereWithRadius:2]; planet.position = SCNVector3Make(0, -3, 5); // sub-node SCNNode* satellite = [SCNNode node]; satellite.geometry = [SCNSphere sphereWithRadius:0.4]; satellite.position = SCNVector3Make(4, 0, 0); [planet addChildNode:satellite]; [scene.rootNode addChildNode:planet];
I use NSTimer to perform some actions and some animations. In the timer event, I do this:
planetRotation + = 0.1; planet.rotation = SCNVector4Make (0,1,0, planetRotation);
But if I try to get the position of the satellite node, I always get the same value. I tried to find out that positionnode knows the actual position of the satellite node, but nothing changes.
How can I get the real position under the node when I change the rotation of the parent node?
Thanks in advance
source share