DylanD

External Sources for Babylon loading

Recommended Posts

Hey everyone I recently started trying to put my webapp made in Babylonjs and typescript into a Cordova android app.

Before this I was just setting up a local server, this way I could load all of my assets easily.

However when my app gets built for android it makes all of the assets go through this type of path  file:///android_asset/www/Audio/

Which I don't believe Babylonjs can handle er something.  Except some of the sound files load source: I can hear them but they still give the error.

So I was wondering what the next best solution would be, but I don't have my own server to host these assets on, I was thinking GitHub maybe but I don't know how I would reference that in my code.  The type of assets I have are babylon scenes, images, textures, and sound files so imgur won't work (I think).  Im going to try the GitHub approach for now.  

They would need to be private so no one but me can see them but I also need them to be accessible to anyone who has the app so I'm kinda stumped about how to do it with that respect...

Any ideas ?

More details in these posts about my problems:

Thanks have a beautiful time!

Share this post


Link to post
Share on other sites

These are some of the way I import things/load things into my scenes

(these are just snippets from a much bigger picture)

let button = BABYLON.GUI.Button.CreateImageWithCenterTextButton("button","",("textures/model"+ (i*3+k>0? (i*3+k):"")+".png"));



BABYLON.SceneLoader.ImportMesh("","./models/","model.babylon",this.scene,(meshes)=>{
            
            importFunc(meshes);
          
        });





 var materialPlane = new BABYLON.StandardMaterial("texturesPlane",this.menuScene);
        var backgroundTexture = new BABYLON.Texture("textures/background.png", this.menuScene);

 

Share this post


Link to post
Share on other sites

I'm really hoping there is a way to do this locally but from what I understand I need to import from some type of server.

Is there anyway to get around having to load assets off a server?  I think assetManager can do it with text and binary files, even scene files but I cannot use that for making my image only buttons... or can I?

Share this post


Link to post
Share on other sites

Hi DylanD,

I am pretty sure you can do that without any server. This is not an specific BabylonJs topic but web standards topics. 

You should find in Cordova documentation where should the assets folder be. I could bet Cordova handles an agnostic assets folder regardless the OS target. This is a very common use case of webapps packaged to "native" so I guess should be easy find something just don't look for specific "Cordova + Babylon js" keywords but JavaScript in general.

 Maybe this can help:

https://stackoverflow.com/a/48341518/1765828

https://github.com/apache/cordova-plugin-file/blob/master/README.md

Cheers.

 

Share this post


Link to post
Share on other sites
25 minutes ago, Salc2 said:

Hi DylanD,

I am pretty sure you can do that without any server. This is not an specific BabylonJs topic but web standards topics. 

You should find in Cordova documentation where should the assets folder be. I could bet Cordova handles an agnostic assets folder regardless the OS target. This is a very common use case of webapps packaged to "native" so I guess should be easy find something just don't look for specific "Cordova + Babylon js" keywords but JavaScript in general.

 Maybe this can help:

https://stackoverflow.com/a/48341518/1765828

https://github.com/apache/cordova-plugin-file/blob/master/README.md

Cheers.

 

Good idea, I didn't think of that.  Im looking into this.  

Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.