Jump to content

Mesh not listed in scene.mesh


Hersir
 Share

Recommended Posts

Hi,

Got strange situation, one mesh, that was exported from 3d max , is not appearing in `scene.mesh` list, but it works with `scene.getMeshByName("meshName");`

var mesh;
mesh = scene.getMeshByName("meshName"); // Works
scene.meshes.forEach((m) => {
  console.log(m.name); // Doesn't appear here
  if(m.name === "meshName") {
     mesh = m; // Never happens
  }
}

 

Link to comment
Share on other sites

@Deltakosh Sorry for false alarm. Looks like Error was done in 3d max. Could be that mesh and mesh position was clones or were linked so dispose, killed both meshes, but weird that getMeshByName still worked. I will ask designer to check what happened there.

private registerMeshes(meshes: Array<AbstractMesh>) {
        meshes.forEach(m => {
            if (mesh.name === "someMesh") {
                this.someMesh = m;
            } else if (mesh.name === "someMesh-position") {
                this.someMeshPosition = m.getAbsolutePosition().clone();
                m.dispose(); // That was causing the issue
            }
        });
}

 

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