Jump to content

Loading models in NullEngine


Recommended Posts

How does one load a *.obj in NullEngine?

const BABYLON = require('babylonjs')
require('babylonjs-loaders') // mutates something globally
global.XMLHttpRequest = require('xhr2').XMLHttpRequest


BABYLON.SceneLoader.LoadAssetContainer("./", "cubio.obj", scene, function (container) {
    console.log('CONTAINER', container)


           throw new NetworkError("Unsupported protocol " + this._url.protocol);

Do I need to do something to xhr2 to teach it about obj?

Link to comment
Share on other sites

Looks like the answer is that './' and '/' are not valid paths for either babylon or xhr (not sure which). This syntax will work in the client, but not on the server.

I was able to get it working with the full path:

BABYLON.SceneLoader.LoadAssetContainer('http://localhost:8080/', 'cubio.obj', scene, (container) => { //etc...


Link to comment
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.

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.


  • Recently Browsing   0 members

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