Dwengo Posted August 7, 2017 Share Posted August 7, 2017 TL;DR The `loadMesh` onSuccess gets called, But i got no mesh! haaaaalp! Hi all, I've been having a problem with my asset-manager when loading meshes. I've taken a look at the playground 'import mesh' and the code is almost the same, however on the 'addMeshTask' success callback I do not get access to the loaded mesh via 'task.getLoadedMeshes[0]' (as seen in the playground). I'm really confused as to what could be causing it to trigger a success event, but not have any 'loaded' meshes. My code is open source: https://github.com/dweng0/wildflower to get it up and running you'll need to do an `npm install` and npm install -g` when thats all done, in the command line, you'll need to run `webpack` then set up the mock server with `npm run serve` Then in your browser go to localhost:3000 (have the console open). I've added a debug in the offending function, but it starts in the AssetsManager.ts -> `loadCharacter` function loadCharacter(url: string, character: CharacterManifest, manifest: ICharacterData) { let bodyTextureUrl = url + character.url + "/textures" + manifest.textureUrl; let meshUrl = url + character.url + manifest.meshUrl; debugger; // load body texture this.loadTexture(character.name + "_texture", bodyTextureUrl, () => { console.log(character.name + " texture loaded"); }, () => {}); // todo load mesh this.loadMesh(character.name + "_mesh", manifest.meshes[0], meshUrl, (task: BABYLON.MeshAssetTask) => { console.log(task.loadedMeshes[0]); <==== No mesh WTF!!!!!!!!!!! task.loadedMeshes[0].material = this._scene.getMaterialByName(character.name + "_texture"); / }, () => { debugger; console.log('did it fail?'); }); } loadMesh(taskName: string, meshNames: any, rootUrl: string, success: (meshAsset: BABYLON.MeshAssetTask) => any, fail: () => any) { console.log('loading mesh', taskName); let meshLoader = this._assets.addMeshTask(taskName, taskName, rootUrl, meshNames); meshLoader.onSuccess = success.bind(this); meshLoader.onError = fail.bind(this); return meshLoader; } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 8, 2017 Share Posted August 8, 2017 Hello and welcome! Can you check in the network tab that there is no 404 issues or something? If this is not the case I ma need a repro in the Playground Quote Link to comment Share on other sites More sharing options...
Sailarg Posted September 1, 2017 Share Posted September 1, 2017 I have the same problem, but this happens with the typescript version, if you use the js and include them directly if it works, of course that is not the real solution. the error is: Property 'loadedMeshes' does not exist on type 'IAssetTask'. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 1, 2017 Share Posted September 1, 2017 Can you make sure you have the latest d.ts from the repo? Quote Link to comment Share on other sites More sharing options...
Sailarg Posted September 1, 2017 Share Posted September 1, 2017 12 hours ago, Deltakosh said: Can you make sure you have the latest d.ts from the repo? In my case if I am sure to have the latest version, update the repository every day, and copy the version that is dist -> preview release Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 1, 2017 Share Posted September 1, 2017 So you're good Do you mind sharing your project? Are you using vscode? 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.