我正在我的应用程序中显示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]