olexale / arkit_flutter_plugin

ARKit Flutter Plugin
MIT License
797 stars 225 forks source link

Possible to load .dae (or any extension) from network to serve as 3d model/asset? #104

Closed BrutalCoding closed 3 years ago

BrutalCoding commented 4 years ago

Duplicate of https://github.com/olexale/arkit_flutter_plugin/issues/62 basically, but can't seem to get this to work. I've been playing with ARKit (this plugin) and ARCore (https://github.com/giandifra/arcore_flutter_plugin). With ARCore, to load a 3d model, it was a matter of adding an objectUrl argument to a Node, in this case a .gltf file hosted from GitHub (raw).

Is there something similar with this plugin? From my understanding, the ARKitReferenceNode 'url' property simply means a local model. That works, but again that's local. Can't find anything in the example that's loading a 3d model from a remote URL.

Also tried Googling around, can't find clear answers but it seems like other developers are downloading 3d models beforehand (e.g. during a loading screen) and then load them like a local model.

I've tried to do the same, by simply putting a 3d model in the flutter root 'assets' folder but that doesn't work either, it crashes.

This merge https://github.com/olexale/arkit_flutter_plugin/pull/61 sounds like the 'url' property should now load assets outside the main bundle, but when I tried using 'assets/nameofmodel.dae' (and '/assets/nameofmodel.dae') it crashed the app instantly (right after its trying to load model from URL path I believe) without an error message, even in verbose mode. It's just ending the logs with lost connection to device and shutting down messages.

Seems like the only way to get a 3d model is to include it in the main bundle so far, really would like to use models downloaded during runtime.

BrutalCoding commented 4 years ago

I've tried the Master branch now (0.6.0) instead of using the version on pub.dev (0.5.1). Seems like it no longer crashes/kill the app if the asset couldn't be loaded/found. I still don't see any error messages, in fact, it looks like it works but I can't find the 3d model around me.

So I thought maybe it needs a full path instead of a relative one. So I used path_provider to get me the location of iOS's temp. directory for my app, plus downloaded the .dae file with Dio. I managed to download the file in the tmp. directory now with as filename example_model.dae, still no model around me even though it looks like it was downloaded properly and loaded properly in the scene.

Any idea's?

mpowloka commented 3 years ago

Hey, I am having a similar issue. I also try to combine this plugin and ARCore.

For me placing models in ios/Runner/models.scnassets worked fine (after I opened the project in Xcode and imported this directory). Did you find any other way, possibly one that includes downloading model from remote URL?

BrutalCoding commented 3 years ago

Hey, I am having a similar issue. I also try to combine this plugin and ARCore.

For me placing models in ios/Runner/models.scnassets worked fine (after I opened the project in Xcode and imported this directory). Did you find any other way, possibly one that includes downloading model from remote URL?

Hi @mpowloka, I'm using the same way you do (local assets) since I couldn't get remote objects working (from a URL). Hope someone has a found a way to do it, not me unfortunately.

mpowloka commented 3 years ago

Fun fact that I also tracked your PR on arcore plugin :)

I managed to make it work for me, even without #62 merged. I basically edite plugin the same way in the local cache (but I will either ping @OleksiiShvachenko to release this change or I will have to fork it to make it work on my CI).

I recommend you do the same but mind one thing. Xcode, when building iOS app, applies some changes to DAE files placed in scnassets. The same DAE files won't work properly when opened from remote URL. You have to manually prepare them for that, running one Xcode script. Check this out.

BrutalCoding commented 3 years ago

Fun fact that I also tracked your PR on arcore plugin :)

I managed to make it work for me, even without #62 merged. I basically edite plugin the same way in the local cache (but I will either ping @OleksiiShvachenko to release this change or I will have to fork it to make it work on my CI).

I recommend you do the same but mind one thing. Xcode, when building iOS app, applies some changes to DAE files placed in scnassets. The same DAE files won't work properly when opened from remote URL. You have to manually prepare them for that, running one Xcode script. Check this out.

I'll look into this, didn't know that Xcode processed *.dae files. By reading your link I suppose that might've been the problem in my case.

This issue will be closed as soon as I can verify the solution. I'll reply with the necessary steps and close this issue if I manage to solve it.

Thanks again!

BrutalCoding commented 3 years ago

Looks like I don't have the time yet to test this so I'll close this issue now.