【问题标题】:SceneKit Node To Follow Camera跟随相机的 SceneKit 节点
【发布时间】:2017-09-12 02:38:07
【问题描述】:

我试图让 SceneKit 中的文本节点始终指向我 - 即指向我的相机位置。由于某种原因,它不会旋转而是保持静止:

let text = SCNText(string: "My String", extrusionDepth: 0.1)
text.font = UIFont(name: "Arial", size: 10)
let textNode = SCNNode(geometry: text)
textNode.position = position

//Here I add the constraint to the SCNView's pointOfView node
let lookAtConstraint = SCNLookAtConstraint(target: scnView.pointOfView)
textNode.constraints = [lookAtConstraint] 

我在这里错过了什么?

【问题讨论】:

  • 您是否正在创建平视显示器?
  • 如果您回答我的问题,我想我可以帮助您解决问题。我正在尝试确定您要完成的工作。
  • 抱歉出差了。是的,尝试平视显示器。我现在使用 SCN BillboardConstraint。谢谢!

标签: ios scenekit


【解决方案1】:

实际上有一种针对这个特定目的的约束。 它被称为SCNBillboardConstraint,它总是将分配给它的节点指向当前相机。您甚至不必在初始化时提供目标。

【讨论】:

  • 谢谢,这就是我所缺少的!
猜你喜欢
  • 2017-08-28
  • 2016-02-24
  • 2017-01-29
  • 2018-01-08
  • 2021-12-08
  • 1970-01-01
  • 2016-02-09
  • 2019-08-03
  • 2016-06-16
相关资源
最近更新 更多