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;
}