Mpman Posted May 26, 2017 Share Posted May 26, 2017 Hi there, i am a Bab3D junior. I was wondering how do i identify and control an imported mesh i.e. (newMeshes[0].position.x=100;) My mesh is newMeshes[0] other meshes [1] [2] etc. myMesh = newMeshes[0]; myMesh.position=''; //Babylon myMesh.css("display","none"); //jQuery object.style.opacity myMesh.whatever... Thanks! Quote Link to comment Share on other sites More sharing options...
hunts Posted May 26, 2017 Share Posted May 26, 2017 @Mpman hy there and welcome to Bjs, you can use var mesh = scene.getMeshById("put the name of the mesh you need here); you can use the debugLayer to find the submeshes in your imported mesh, you can find the name of the mesh that you want there. The debugLayer is really a great tool for this Quote Link to comment Share on other sites More sharing options...
hunts Posted May 26, 2017 Share Posted May 26, 2017 var mesh = scene.getMeshById("put the name of the mesh you need here); Quote Link to comment Share on other sites More sharing options...
brianzinn Posted May 27, 2017 Share Posted May 27, 2017 Hi Mpman, If the imported meshes are from the SceneLoader then you can change their properties after loading: BABYLON.SceneLoader.ImportMesh("", "/dir/", "file.obj", scene, function (loadedMeshes) { loadedMeshes.forEach(function(loadedMesh) { console.log(`loaded ${loadedMesh.name}`, loadedMesh) } }); If you want to hide a mesh instead of using css, try to set it's visibility property to 0. So, in the code above you could do: if (loadedMesh.name === 'hideme' ) { loadedMesh.visibility = 0 } If you share the file you are importing and where you are stuck we can be more helpful. Quote Link to comment Share on other sites More sharing options...
hunts Posted May 27, 2017 Share Posted May 27, 2017 @MpmanAnd you can't use css with the imported mesh...you're working with webgl Quote Link to comment Share on other sites More sharing options...
Mpman Posted May 29, 2017 Author Share Posted May 29, 2017 Thanks a lot for your responses! 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.