Hi. Currently i’m storing models and animations on a separate server, and using HTTPS to load it to the scene. But since the model size was quite large, the loading time on app cold boot for downloading model is taking much time. I have research some topics on the forum but none of them work with the file system path (download + save local path from react-native-fs). Is there any way I can achieve that?
Thanks.
Cedric
August 9, 2023, 1:03pm
3
There is a known issue on Android with release build. There are also a number of workaround and different ways to circumvent the loading issue:
opened 12:55PM - 01 Mar 21 UTC
enhancement
Hi!
First of all, thanks for the great work for all maintainers.
I've ju… st started using this library in my project for rendering `.glb` files.
When the `.glb` file is served from a local static server, `SceneLoader.ImportMeshAsync` and other similar methods used for importing assets, such as `Append`, `AppendAsync`, etc.. work perfectly. However, when the file is not requested over HTTP, but rather the local path is provided to the above stated methods, the app just crashes without any easily traceable error (I wasn't looking so hard for the error, but it didn't appear in the terminal of the packager). Maybe it's my uneducatedness but from the documentation available [here](https://doc.babylonjs.com/divingDeeper/importers/loadingFileTypes), I expected the import to work with just a local path.
I was able to solve the issue by using `expo-asset` to load the `.glb` file instead and provide a local uri, and then passing that local uri to Babylon, described in the below way:
```ts
import '@babylonjs/loaders';
import { Asset } from 'expo-asset';
import { SceneLoader, ... } from '@babylonjs/core';
const [{ localUri }] = await Asset.loadAsync(
require('/assets/3d/tesla-high.glb')
);
const { meshes } = await SceneLoader.ImportMeshAsync(
'',
localUri as string,
'',
scene
);
```
However, I'd expect the library to do something similar internally, making the user to be able to only provide a path to a local `.glb` file and it load it without issues. If this work is purposefully left for the user, it would be nice to have it stated in the main documentation, since I think it's quite a common use-case.
An easy one is to use base64 encoded strings.
No ETA yet for a fix.