我正在使用SceneKit开发一个场景。我有一个带有子节点的主节点:
// 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];
我使用了NSTimer来执行一些动作和动画。在计时器事件中,我做了以下操作:
planetRotation += 0.1; planet.rotation = SCNVector4Make(0,1,0, planetRotation);
但是如果我尝试获取卫星节点的位置,我总是得到相同的值。我尝试通过获取positionnode来知道卫星节点的真实位置,但是什么也没有改变。
当我更改父节点的旋转时,如何获取子节点的真实位置?
提前感谢您的帮助。