018 Posted December 17, 2016 Share Posted December 17, 2016 I have a scene generated from the Blender export. It has a variety of different meshes, but I really only want them loaded so that I can access them later as a level is generated (and then I would make InstancedMeshes from them). I can load them and set them out far out of view, but is there a better way? Thanks. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted December 17, 2016 Share Posted December 17, 2016 Best practice would be to either load everything at start, meshes you don't need from start can be set to mesh.isEnabled( false ); Or if you have different "levels" you can load meshes between levels, adding a loading scene when changing from level 1 to level 2, etc, and loading them there. What's best for you really depends on the number and quality(size) of your meshes , So lets say if you have 50+ MB total, the second option would probably be best (if possible), since not all players will reach every level and actually use every mesh, loading them at start is just wasting bandwidth and adding unnecessary loading time which may make some players leave before the game even starts Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 17, 2016 Share Posted December 17, 2016 Using Blender / .BABYLON exporter, there is a 'Load Disabled' checkbox in the exporter properties for a mesh. If going that route, this would disable it by default. Less code to put in the onready callback. I hesitate to mention it due to lack of documentation (this is way out of date), but the Tower of Babel source code exporter does have an alternative. You add a script tag for the exported .JS file that has the inline geometry in your html file. This gets downloaded at the beginning, and also parsed, but nothing is created. When you wish a mesh to appear, just instance it: var myMesh = new module.Meshclass('name', scene, materialsDirectory); Seeing as you only have 3 posts, I would not try this, but it does have advantages. You can also pick from 5 ways to have your mesh displayed from Blender: Expand Gather Fire shown about midway Just Make Visible Custom (a JavaScript class coded by you) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 17, 2016 Share Posted December 17, 2016 Make a container object and load all your meshes on runtime and when they load have them assign on the container object like: presets[mesh1.name] or something g like that and when you need it you just reference the object in the preset object and clone it so var newObject = presets[presetname].clone() Quote Link to comment Share on other sites More sharing options...
018 Posted December 18, 2016 Author Share Posted December 18, 2016 Thanks very much. 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.