1
我試圖在iOS上的SceneKit中移動一個節點集合,但我得到一個神祕的錯誤。這裏是我到目前爲止的代碼:
func renderer(aRenderer: SCNSceneRenderer, updateAtTime time: NSTimeInterval) {
let cubes = scene.rootNode.childNodesPassingTest { (node, stop) -> Bool in node.name == "cube" }
for cube in cubes {
cube.position = SCNVector3(x: cube.position.x - 5.0, y: cube.position.y, z: cube.position.z)
}
}
上線cube.position = ...
我得到'@lvalue $T7' is not identical to 'CGPoint!'
這個錯誤是什麼意思?另外,如果有更好的方法來循環這些節點,請讓我知道!謝謝。
也許嘗試明確鑄造5.0〜'CGFloat'?所以'x'值會是'cube.position.x - CGFloat(5.0)' – nickgraef 2014-11-04 00:54:12
@nickgraef同樣的錯誤。 – 2014-11-04 00:55:27
你有沒有想過使用通配符或正則表達式來循環節點的快速方法? – 2015-07-23 15:29:08