skalibran Posted September 12, 2015 Share Posted September 12, 2015 Hey there, I have a problem with my imported babylon-mesh. Its not that small, and sometimes if I refresh the site, it is loaded to the half (the balloon loads, the basket not). Thats probably because the basket uses some textures, the balloon not.Is there a way to wait for everything (also textures) to load? Like the spinning circle from a lot of bablyonjs-projects featured on the main site. Here is the project:http://spielwiese.vllg.at/ Thanks! I don't want to seem unthankful, and because of that this small information: I'm not at home from now on till probably tomorrow Thanks for any answers, I'll have a close look tomorrow! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 12, 2015 Share Posted September 12, 2015 yes you can: just call the runRenderLoop inside a scene.executeWhenReady:var canvas = document.getElementById("renderCanvas");var engine = new BABYLON.Engine(canvas, true);BABYLON.SceneLoader.Load("TestScene/", "test.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { newScene.activeCamera.attachControl(canvas); engine.runRenderLoop(function () { newScene.render(); }); });}, function (progress) { // To do: give progress feedback to user}); Quote Link to comment Share on other sites More sharing options...
Temechon Posted September 12, 2015 Share Posted September 12, 2015 Hello, Indeed, you just have to move your renderLoop inside your block here:var balloon;BABYLON.SceneLoader.ImportMesh("", "", "balloon-ef.babylon", scene, function (newMeshes) { balloon = newMeshes[0]; }); Quote Link to comment Share on other sites More sharing options...
skalibran Posted September 12, 2015 Author Share Posted September 12, 2015 Thanks for your answers. I want to add more models later, so both solutions don't seem to fit, am I wrong? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 13, 2015 Share Posted September 13, 2015 Can you elaborate a bit more on what you want to achieve then? Quote Link to comment Share on other sites More sharing options...
Temechon Posted September 13, 2015 Share Posted September 13, 2015 I think you can see how to use the Assets Manager (explained here: http://doc.babylonjs.com/tutorials/How_to_use_AssetsManager - or explained in my book) Quote Link to comment Share on other sites More sharing options...
skalibran Posted September 13, 2015 Author Share Posted September 13, 2015 I guess I had a complete wrong approach to loading 3D-models into the scene. However, I'm not quite sure what I did wrong now. I created a complete fresh file for testing the assetsmanager and added a clean code from the beginners tutorial to be sure to have a working scene.http://spielwiese.vllg.at/assetsmanager.html The balloon is loaded correctly, but it seems like I cannot modify its position. This is what I've added to the sourcecode:var assetsManager = new BABYLON.AssetsManager(scene);var balloon = assetsManager.addMeshTask("balloon", "", "", "balloon-ef.babylon");balloon.onSuccess = function (task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 10, 0);} assetsManager.load(); Quote Link to comment Share on other sites More sharing options...
Temechon Posted September 13, 2015 Share Posted September 13, 2015 Hi, Your code is correct. However, your 3D model (exported from Blender as I suppose) is not.The attribute mesh.position returns the pivot point of the mesh: Your model is actually positionned at x: -1.565878181216135, y: 829.4620088867188, z: 0.7638135395141035}. Try to set the model in Blender in (0,0,0), export it again and test your code. (and don't forget to empy your cache ) Quote Link to comment Share on other sites More sharing options...
skalibran Posted September 13, 2015 Author Share Posted September 13, 2015 Meh, 3D modelling is a buggy mess. I created the balloon with SketchUp, and if I import it into blender there is always something not working correctly. When I export it to blender using .3ds, the .babylon-file has seriously size issues (the basket is too small, etc). If I export a .dae, there is a small balloon inside the basket of the balloon. It is a pain in the ass. However, my op question has been resolved, thanks for that! Quote Link to comment Share on other sites More sharing options...
dbawel Posted September 14, 2015 Share Posted September 14, 2015 If you import into Blender for the purpose of exporting .babylon files to BJS, I always advise resetting all transforms on your objects in Blender - especially if you will be using bones to weigh vertex deformations on any mesh. But as different software packages and export file formats use dramatically different units of measurement internally, resetting all matrix transforms in Blender will allow Blender (or any other program you use as a final export program to BJS) to reset and somewhat unify the units of measurement, which then are used in transforming your object's centers which are set at render time - to the familiar babylon.js units of measurement. I advise finding a sequence of file formats and software in which you create your operators such as texture UVs, bones, hierarchies, etc. which will provide you with consistant results, and to use these routinely and repeatledly to maintain consistant and repeatable values in your pipeline in case you need to troubleshoot problems which invariably will arise in almost every project. Cheers, DB 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.