Sign in to follow this  

AssetManager not loading meshes correctly

Recommended Posts

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:

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;
// load body texture
this.loadTexture( + "_texture", bodyTextureUrl, () => {
console.log( + " texture loaded");
}, () => {});
// todo load mesh
this.loadMesh( + "_mesh", manifest.meshes[0], meshUrl, (task: BABYLON.MeshAssetTask) => {
console.log(task.loadedMeshes[0]); <====  No mesh WTF!!!!!!!!!!!
task.loadedMeshes[0].material = this._scene.getMaterialByName( + "_texture"); /
}, () => {
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;



Share this post

Link to post
Share on other sites


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'.

Share this post

Link to post
Share on other sites
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

Share this post

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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.