首页 > 解决方案 > 节点的几何(来自 DAE 文件)仅在生产版本中为零

问题描述

我有一个 3D 模型,当从 Xcode 编译时,它在真实设备和模拟器上始终可以正常工作,即使设置为 Release 并使用任何优化设置,但是当上传到 TestFlight 时它会丢失一些材料。

调试后(使用 TF 构建,因为无法在本地重现)我发现我正在使用的两个节点(看起来很糟糕的节点)没有几何结构(它们在本地确实有几何结构)。

我正在使用的代码:

self.scene = SCNScene(named: "model.scnassets/Body.dae")
self.scene?.rootNode.rotation = SCNVector4(1, 0, 0, 45.degreesToRadians)
let baseNode = self.scene?.rootNode.childNode(withName: "Body", recursively: true)
let bodyImageMaterial = SCNMaterial()
bodyImageMaterial.isDoubleSided = false
bodyImageMaterial.diffuse.contents = UIImage(named: "Body_Background")
baseNode?.geometry?.materials = [bodyImageMaterial]

baseNode?.geometry返回nil生产,这是我无法弄清楚的部分,因此没有应用材料。另外我想澄清一下几何图形按预期工作,但它使用默认材质,因为没有应用任何内容。

标签: swiftscenekitarkitscnscene

解决方案


我终于通过将.dae文件转换为.scn. 不确定这里会发生什么,因为我还有其他.dae按预期工作的。


推荐阅读