Not able to load .dae file while creating a SCNScene object in ARKit

梦想的初衷 提交于 2019-12-25 01:45:50

问题


I am trying to load a .dae file with the help of the following line of code:

let scene = SCNScene(named: "art.scnassets/bench.dae")

But, when I run my project, the app is crashing because the variable scene is nil.

What am I doing wrong?


回答1:


It seems that the problem was with the .dae file's size/orientation. I rotated it by 90 degrees and scaled the image down and it seems to work now.




回答2:


I know this is pretty old, but in case anyone faces this issue like i had yesterday, here is what I did to fix the issue. I thought issue was in format, so I tried .scn model but with copying it in main directory and it worked, then guessed issue was in directory, so I copied my .dae file to main directory of project then re-added it under copy-bundle-resources from build phases and it worked perfectly. Hope this helps.




回答3:


Add art.scnassets to Copy Bundle Resources



来源:https://stackoverflow.com/questions/46026848/not-able-to-load-dae-file-while-creating-a-scnscene-object-in-arkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!