为了让我的所有项目都能将所有内容放在我想要的位置,我在导出之前将(0,0,0)的变换应用于blender中的每个对象。这导致运行场景看起来与blender文件完全相同,但是当我要求它时,每个SCNNode给我一个位置(0,0,0)。我已经尝试了十几种方法来尝试为每个对象找到正确的位置,他们一直说位置是(0,0,0)。有什么建议吗?
var rollingBall: SCNNode = SCNNode(geometry: SCNSphere(radius: 15))
scene.rootNode.enumerateChildNodesUsingBlock(){
node, stop in
if node.name == "BackWall" {
println("VVVVVVVVVVVVVVVVVVVV")
var axis: SCNVector3
node.position = self.scene.rootNode.convertPosition(node.position, toNode: node.presentationNode())
rollingBall.transform = node.worldTransform
rollingBall.scale = SCNVector3Make(1,1,1)
rollingBall.position.y = 70
let x = rollingBall.presentationNode()
let carPos = rollingBall.position
let targetPos = SCNVector3Make(x.position.x, x.position.y, x.position.z + 150)
self.cameraNode.position = targetPos
}
}