【发布时间】:2017-12-17 02:41:21
【问题描述】:
将 .dae 文件加载为场景元素
此代码有效,将文件加载为场景:
let scene = SCNScene(named: "art.scnassets/base-wall-tile_sample.dae")!
此代码将文件加载为 SCNGeometry,但不会:
let url = Bundle.main.url(forResource: "art.scnassets/base-wall-tile_sample", withExtension: "dae")
let source = SCNSceneSource(url: url! )
let geo = source!.entryWithIdentifier("Geo", withClass: SCNGeometry.self)!
url 和 source 没问题,但它在尝试生成地理时崩溃。糟糕的指示。
这段代码,就像网络上提供的几个示例一样,是在 Swift 2 (load a collada (dae) file into SCNNode (Swift - SceneKit)。我不得不将它调整到 Swift 3,并且似乎在翻译中丢失了一些东西。有人可以告诉我如何做到这一点东西对吗?
【问题讨论】: