[email protected] Posted August 31, 2016 Share Posted August 31, 2016 Hi, I'm loading a mesh like this : Quote BABYLON.SceneLoader.ImportMesh("", this.baseFolderUrl, this.fileName, this._refScene, function (newMeshes) { Is it possible to load the mesh without displaying it immediatly on scene ? Idealy, I would like to be able to load all the mesh data, store it in a var, and then load/unload it frome the scene. The idea behind it it that i don't need the base mesh, but i would like to be able to .clone() it and set it's data before displaying it. Thanks a lot for your ideas. Quote Link to comment Share on other sites More sharing options...
Gugis Posted August 31, 2016 Share Posted August 31, 2016 You can set isVisible parameter to false for every loaded mesh. Quote Link to comment Share on other sites More sharing options...
Athelios Posted August 31, 2016 Share Posted August 31, 2016 Or you can load them into second scene and clone them. var loaderScene = new BABYLON.Scene(engine); var loader = new BABYLON.AssetsManager(loaderScene); var assets = { "your_mesh_name":loader.addMeshTask("name", "", "/static/models/hand/", "hand.babylon") }; loader.load(); loader.onFinish = function (tasks) { scene = createScene(); }; var clone = function (name) { var clone = assets[name].loadedMeshes[0].clone(""); clone._scene = scene; if(clone.material) { clone.material._scene = scene; if(clone.material.subMaterials) { for (var i = 0; i < clone.material.subMaterials.length; i++) { clone.material.subMaterials[i]._scene = scene; } } } scene.addMesh(clone); return clone; } var mesh = clone('your_mesh_name'); Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 31, 2016 Share Posted August 31, 2016 You can also put / adjust visibilty in the .babylon file. You can also set enable to false. Enable also affects children. The Blender exporter supports editing visibilty, saving in .blend, & exporting. I am not a fan of .babylon files, but even less impressed with ImportMesh. To do all meshes, unless you have cameras or lights in the .babylon file, Append does the same thing. You get an array of the new meshes with ImportMesh, but better to look them up by name. The forum is littered with problems where the someone assumed newMeshes[0] was "it", but they screwed it up. V!nc3r 1 Quote Link to comment Share on other sites More sharing options...
[email protected] Posted September 1, 2016 Author Share Posted September 1, 2016 Thanks a lot for all these idead, i will try to implement the double scene trick in my project today ! Quote Link to comment Share on other sites More sharing options...
Quadear Posted September 1, 2016 Share Posted September 1, 2016 @Athelios Isn't it the role of private variables not to be modified like that ? Quote Link to comment Share on other sites More sharing options...
Athelios Posted September 1, 2016 Share Posted September 1, 2016 3 hours ago, Quadear said: @Athelios Isn't it the role of private variables not to be modified like that ? Probably yes, I'm not a JS specialist. I try something - it works - I implement it. Quote Link to comment Share on other sites More sharing options...
Lightnet Posted November 23, 2016 Share Posted November 23, 2016 This help me out well since I using the scene assets and other into the main scene. But it odd that it doesn't copy mesh to current scene when scene.addMesh doesn't work well. Had to used mesh._scene to deal with the render update scene to get it working. Plus some odd error like it freeze or lag or frame stop when try to look up camera free style. 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.