AR 让文字一直对我们

2017-12-27  本文已影响0人  heigo
    // 包装文字节点
    let wrapperTextNode = SCNNode(geometry: textScn)
    wrapperTextNode.eulerAngles = SCNVector3Make(0, .pi, 0)
    wrapperTextNode.scale = SCNVector3(1/500.0, 1/500.0, 1/500.0)


  textNode = SCNNode()
  textNode.addChildNode(wrapperTextNode)

    // 让文字对着我们
    // SCNLookAtConstraint 让他跟随我们设定的目标

   let constraint = SCNLookAtConstraint(target: scnneView.pointOfView)

    // 开启万向节锁, 方向不受接受方影响
      constraint.isGimbalLockEnabled = true

    textNode.constraints = [constraint]

    scnneView.scene.rootNode.addChildNode(textNode)
上一篇下一篇

猜你喜欢

热点阅读