Jump to content

Correct way to load GLB from text string?


benforreal
 Share

Recommended Posts

Hi all, 

Sorry for the lack of sandbox example, but I'm not even sure how i'd properly set this one up. Anyway, my issue is that I export my Babylon scene (as a GLB) along with some other assets as a zip file. This works AWESOME, I was surprised it was so easy.

Importing is the problem. I can get the incoming asset as whatever (binary, or string). The problem is that when I load, it incorrectly parses the file - it gives me back my JSON + binary and says ": Unexpected token g in JSON at position 0". If I trace, it looks like it has no idea what importer to use, and appears to be defaulting to the Babylon format importer.

So my question is, what is the correct mechanism to load a GLB file when I just have the data?

I'm using:

BABYLON.SceneLoader.ImportMesh('', 'data:' + content, myscene, () => { console.log('success')});

thanks!

Link to comment
Share on other sites

  • 1 month later...

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...