freetoplay Posted November 24, 2018 Share Posted November 24, 2018 Hi, I am getting an error when I try to loop through checking for tags. In my code, I have: let oldMesh = scene.meshes; for (let i=1; i < oldMesh.length; i++) { BABYLON.Tags.EnableFor(oldMesh[i]); } oldMesh[3].addTags("test"); Inside my importMesh function, I have: BABYLON.SceneLoader.ImportMesh(null, "/assets/", "test.glb", scene, function (meshes, particleSystems, skeletons) { meshes[0].position.y += 1; for (let i=1; i < oldMesh.length; i++) { console.log(oldMesh[i]); // this works fine console.log(oldMesh[i].hasTags()); // this throws an error } }); Does anyone know know why the hasTags function is throwing an error in the loop? Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 25, 2018 Share Posted November 25, 2018 Hi FTP. Sorry to hear you are having problems. Could you build a playground demo... that reproduces the error? That would be great. Also, it might help to tell us WHAT error was seen. thx. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 26, 2018 Share Posted November 26, 2018 oldMesh refers to scene.meshes so will change during import and you are not enabling tag again on the new elements. You need to create a new list if you want to keep track of some of them. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.