gpt4 book ai didi

swift - SCNCamera 不会更新位置

转载 作者:行者123 更新时间:2023-11-28 10:56:51 28 4
gpt4 key购买 nike

我有一个 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)
}

最佳答案

我认为不是在 SCNView 上设置 pointOfView 属性,而是添加一个名为 pointOfViewNode 的节点。

试试这个。

 self.scnView.pointOfView = someCameraNode;

Here is the relevant reference.

关于swift - SCNCamera 不会更新位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42966373/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com