Jump to content

getMeshByName function does not return a mesh


georage
 Share

Recommended Posts

Hello, I am probably doing this all wrong, but I need a "get mesh by name" function.

I understand there is some sort of built in function for this, but I cannot find out how to use it.

I created this function, which I thought would return the mesh, but it doesn't. (I assign m.name during creation of all meshes, and this function does accurately report finding the mesh)

function getMeshByName(meshName, scene){    
    scene.meshes.forEach(function(m) {
            if(m.name == meshName) {
                console.log("found mesh " + m);
                return m;
                }
        });        
}

how do I make "m" return the actual mesh? Or how do I do this using the existing functions?

Thanks for any help!

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