nathanidp Posted October 10, 2018 Share Posted October 10, 2018 Hello, We are using the SceneLoader.ImportMeshAsync function for our project. However in local there's no particular problem but when we deploy the project it seems that the function don't work well. The promise called with ImportMeshAsync seems to break and it never resolve (the callback function in '.then' is never called). We tried to do a catch but no error is catched. What we do is we are using a proxy because the .obj files are stored in another website. Then we create a blob from the returned data by the proxy. Eventually we load the blob using the ImportMeshAsync function. We tried to put some breakpoint on the promise call in the browser (it don't work with every browser) and the weird thing is that ImportMeshAsync returns a string in the deployed project but it returns a mesh locally. Thank you for your help. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 10, 2018 Share Posted October 10, 2018 It could be a cross site issue ? Could you repro in the playground ? It would be pretty hard to troubleshoot otherwise. Quote Link to comment Share on other sites More sharing options...
Gotatang Posted October 10, 2018 Share Posted October 10, 2018 We found what the problem was. It came from babylon loader last version, 3.3.0. We didn't investigate much more, but there is a problem when you try to load a mesh from a url created with `createObjectURL`. nathanidp and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
Guest Posted October 10, 2018 Share Posted October 10, 2018 I would be interested to know more about this issue if you have time to investigate or repro it Quote Link to comment Share on other sites More sharing options...
nathanidp Posted October 11, 2018 Author Share Posted October 11, 2018 We changed the babylonjs-loaders version to 3.2 and it resolves our problem. There must be something that changed between 3.2 and 3.3 in the importMeshAsync function. We don't know how to repro it in the playground since we don't know what loader version is used and the files we are using are from a private link we cannot communicate... But here's how we call the function : return new Promise((resolve) => {( "", url, // The url of the blob "", that.scene, // our babylon scene null, this.fileExtension // ".obj" ).then((importedData) => { // We never get here ... (...) }).catch((err) => { // We never get here to ... self.app.log.error(err); }); }); Quote Link to comment Share on other sites More sharing options...
nathanidp Posted October 11, 2018 Author Share Posted October 11, 2018 Sorry my answer came late, I tried to send it yesterday but Html5 blocked my message Quote Link to comment Share on other sites More sharing options...
Guest Posted October 11, 2018 Share Posted October 11, 2018 The playground uses the very latest version (so 4.0-alpha now). We won't be able to fix it if you cannot help us repro. Can you use with another .obj? Quote Link to comment Share on other sites More sharing options...
nathanidp Posted October 12, 2018 Author Share Posted October 12, 2018 An example of something we try to do (it's not exactly the same but it's not that far) http://www.babylonjs-playground.com/#JUKXQD#44 Quote Link to comment Share on other sites More sharing options...
Guest Posted October 12, 2018 Share Posted October 12, 2018 This is how you could do it: http://www.babylonjs-playground.com/indexStable.html#JUKXQD#46 (there is a CORS issue but the load is how it should be) Quote Link to comment Share on other sites More sharing options...
Dr. Aaron Dishno Posted February 11, 2019 Share Posted February 11, 2019 I am running into the same issue. https://www.babylonjs-playground.com/#JUKXQD#113 This playground scene works when I use: BABYLON.SceneLoader.ImportMesh Notice that the loaded mesh (skull) parents to the small rotating box. But if I change it to: BABYLON.SceneLoader.ImportMeshAsync it doesn't parent to the box. and it doesn't appear to call the onsuccess function at all. I tested it in 3.3 and 4.0 prerelease with the same issue. Never mind... Looks like I found the answer here: https://doc.babylonjs.com/how_to/promises BABYLON.SceneLoader.ImportMeshAsync("", "scenes/", "skull.babylon", scene).then( function (newMeshes) { newMeshes.meshes[0].parent = box; }); Quote Link to comment Share on other sites More sharing options...
Guest Posted February 12, 2019 Share Posted February 12, 2019 Hey team. Please use our new forum here: forum.babylonjs.com 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.