美文网首页
AR 让文字一直对我们

AR 让文字一直对我们

作者: heigo | 来源:发表于2017-12-27 18:22 被阅读0次
    // 包装文字节点
    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)

相关文章

网友评论

      本文标题:AR 让文字一直对我们

      本文链接:https://www.haomeiwen.com/subject/gdtpgxtx.html