将SCNText添加到SCNPlane

时间:2018-01-19 05:47:49

标签: swift scenekit arkit

我正在使用

添加SCNPlane
artPlane = SCNPlane(width: CGFloat(widthRequired) * 0.0254,
                        height: CGFloat(size["width"]!) * 0.0254)

    artworkNode = SCNNode(geometry: artPlane)

    artworkNode?.geometry?.firstMaterial?.diffuse.contents = UIImage(named: "loadingar")

    let translation = SCNMatrix4MakeTranslation(0, -1, 0)
    let rotation = SCNMatrix4MakeRotation(Float.pi / 2, 0, 0, 1)
    artworkNode?.geometry?.firstMaterial?.diffuse.contentsTransform = SCNMatrix4Mult(translation, rotation)

    artworkNode?.geometry?.firstMaterial?.isDoubleSided = true
    artworkNode?.simdTransform = matrix

    self.sceneView.scene.rootNode.addChildNode(artworkNode!)

现在我想将SCNText添加到上面平面的中心,如何指定新textNode的位置,使其位于平面的中心?

0 个答案:

没有答案