Jump to content

MeshAssetTask problem


Carharttguy
 Share

Recommended Posts

Hello

I'm learning the AssetsManager, but I bump into this problem:

Quote

var meshtask = this._assetManager.addMeshTask(name, "", rooturl, fileName);
meshtask.onSuccess = function (task) {
    task.loadedMeshes[0].position = BABYLON.Vector3.Zero();
}

But one way or another, task.loadedMeshes doesn't exist. How is this possible?
Edit: I also should call .load first, but I don't think that's the problem here.

Thanks!

Link to comment
Share on other sites

Hi @davrous, thanks for your fast answer.
I found the problem. The error shown was something like this:
TS2099: loadedMeshes not found on IAssetTask. So i figured I should've defined the type of 'task' this way:

Quote

meshtask.onSuccess = function (task: BABYLON.MeshAssetTask) {
    task.loadedMeshes[0].position = BABYLON.Vector3.Zero();
}

And this works.

Wouldn't it be an idea to also have TypeScript examples in the docs? So the reader can choose which code examples are shown? I'm willing to translate the parts I can.
Also poking @Deltakosh for this.

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

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

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...