【发布时间】:2017-08-15 10:28:30
【问题描述】:
我有一个 SCNNode,它有一个名为 pointOfViewNode 的摄像头
每当我按下按钮时,我都会调用函数更新相机,我希望 SCNNode 在其中将其位置更改为聚焦目标,但是当我调用此函数时,位置不会按需要更改,我怎样才能将其移至可以吗?
func updateCamera()
{
targetNode = SCNLookAtConstraint(target: planetNodeArray[currentFocusedElement])
pointOfViewNode.constraints = [targetNode]
//positions the camera node
pointOfViewNode.position = SCNVector3(x: planetNodeArray[currentFocusedElement].position.x - 3 , y:planetNodeArray[currentFocusedElement].position.y + 65, z: planetNodeArray[currentFocusedElement].position.z + 2)
pointOfViewNode.rotation = SCNVector4Make(1, 1, 1, -90)
self.rootNode.addChildNode(pointOfViewNode)
print(pointOfViewNode.position)
}
【问题讨论】: