Swift我的3D对象无法正确渲染ARKIT

时间:2019-08-15 16:57:11

标签: swift arkit

我正在我的应用程序中显示3D对象,但无法正确渲染。这是我的代码,还有从网址

下载的3d对象
var plane  = SCNPlane(width: imageAnchor.referenceImage.physicalSize.width, height: imageAnchor.referenceImage.physicalSize.height)

                var NodoObj = SCNNode()
                node = SCNNode(geometry: plane)

                    do {
                        let shipScene:SCNScene
                        let sceneSource = try GLTFSceneSource(url: URL(string: media)!)
                        shipScene =  try sceneSource.scene()
                        NodoObj = shipScene.rootNode.childNodes.first!

                        NodoObj.eulerAngles.x = -.pi / 2

                        self.sceneView.allowsCameraControl = true

                        node.addChildNode(NodoObj)                                

                    }
                    catch {
                        self.stopAnimating()
                        let alert = CDAlertView(title: "Error", message: "No se pudo descargar el archivo", type: .error)
                        alert.add(action: CDAlertViewAction(title: "Aceptar"))
                        alert.show()
                        print("\(error.localizedDescription)")
                    }
                }
            }
            self.stopAnimating()
            return node[][1]

snap

0 个答案:

没有答案