timetocode Posted May 15, 2018 Share Posted May 15, 2018 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) container.addAllToScene() }) Error: ...\node_modules\xhr2\lib\xhr2.js:206 throw new NetworkError("Unsupported protocol " + this._url.protocol); Do I need to do something to xhr2 to teach it about obj? Quote Link to comment Share on other sites More sharing options...
timetocode Posted May 15, 2018 Author Share Posted May 15, 2018 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... Quote Link to comment Share on other sites More sharing options...
Guest Posted May 15, 2018 Share Posted May 15, 2018 Cool! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.