Hersir Posted June 7, 2017 Share Posted June 7, 2017 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 } } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2017 Share Posted June 7, 2017 Hey! Can you reproduce it in the repo? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2017 Share Posted June 7, 2017 Here is the code used by getMeshByName: public getMeshByName(name: string): AbstractMesh { for (var index = 0; index < this.meshes.length; index++) { if (this.meshes[index].name === name) { return this.meshes[index]; } } return null; } Quote Link to comment Share on other sites More sharing options...
Hersir Posted June 8, 2017 Author Share Posted June 8, 2017 @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 } }); } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 8, 2017 Share Posted June 8, 2017 ok sounds good 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.