swift - 节点的几何(来自 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
生产,这是我无法弄清楚的部分,因此没有应用材料。另外我想澄清一下几何图形按预期工作,但它使用默认材质,因为没有应用任何内容。
解决方案
我终于通过将.dae
文件转换为.scn
. 不确定这里会发生什么,因为我还有其他.dae
按预期工作的。
推荐阅读
- python - Openpyxl:如何解决 .iter_cols 不支持的操作数错误
- sql - 提取每月时段数据
- python - Jupyter Notebook - 一段时间后内核下线
- javascript - jszip在压缩文件夹中返回空或空白的pdf文件
- triggers - 插入触发后不累积条件文本
- r - 在 dplyr 1.0.0 中从关卡集中移除“僵尸”NA
- python - 如何在 Django 中进行指数或自然日志?
- android - 如何使用 UsageStatsManager.queryUsageStats(...)?
- c++ - Win32 API 中的指针所有权
- c - 如何在 main 函数中分配指针?