SceneKit euler角度在iOS 8上无效

时间:2016-02-12 12:49:22

标签: ios scenekit

在场景构建器中,我将一个圆柱节点添加到场景中,其欧拉角为(0,90,0)。这在我的场景看起来很棒。现在,当我去运行它时,在iOS 8上忽略了euler角度,但在iOS 9上工作。我试着在这里寻找使用欧拉角的工作,但我找不到一个,所以我问是否有人找到了解决这个问题的方法。我已经尝试删除节点并将其添加回场景,但这不起作用。就像我说的,这是通过场景构建器完成的,因此没有代码可以显示。

1 个答案:

答案 0 :(得分:2)

The answer/work around is that for iOS you have to manually assign the euler angles in code, it seems that pulling the node from the scn file will not carry over the euler angles assigned to it, and you can't even reassign the current value (let x = node.euler.x; node.euler.x = x) because it will pull a 0.

Also, the scene builder takes in degrees, the code takes in radians.

Code Behind:

let node = scene.rootNode.childNodeWithName("nodename")
node.eulerAngles = SCNVector3Make(Float(M_PI_2),0,0)