joshcamas Posted October 14, 2016 Share Posted October 14, 2016 AYEEE IM BACK I have a little project idea that I'm working on, but dang I've forgotten things. Specifically, I have my own file uploader that loads babylon files onto the browser. Now what? How do I add this stuff to my scene? (I don't want to create a new scene, I want to loop through the meshes and add certain ones and all sorts of fun junk) Thanks! Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted October 14, 2016 Share Posted October 14, 2016 Hi, could you give us an example of your code structure? how is it loaded/saved? etc Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 14, 2016 Author Share Posted October 14, 2016 Never mind, I figured it out! It's amazing what you forget! /* Loading scene from uploaded file */ /* HTML: */ <input type="file" id="fileupload" onchange="SpriteGen.handleFileInput(event)"> /* JS */ SpriteGen.handleFileInput = function(event) { var uploader = event.srcElement || event.currentTarget; var files = uploader.files; var reader = new FileReader(); reader.onload = function(event) { SpriteGen.uploadedData = event.target.result; SpriteGen.onSceneLoad(event) }; reader.readAsDataURL(files[0]); } SpriteGen.onSceneLoad = function(event) { var result = event.target.result; BABYLON.SceneLoader.ImportMesh(null, event.target.result, '', Game.scene, function(newMeshes, particleSystems, skeletons) { var mesh = newMeshes[0]; mesh.position = new BABYLON.Vector3(0, 0, 0); }); } Thanks for the reply dude! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 14, 2016 Share Posted October 14, 2016 Are you in a "self-replied" mode? I would love that all of our users would be in that mode Kemal UÇAR, joshcamas and Vousk-prod. 3 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.