Dad72 Posted October 28, 2016 Share Posted October 28, 2016 Hello, I have a small problem that I do not understand with addMeshTask(). If I do this, it does not work. (I have no error in the console and I get out the value of 'key') // Not Work $.getJSON(global.game.nameProjet, function(json) { $.each(json, function (key, val) { addTask(key); }); }); function addTask(key) { global.game.meshTask = global.game.assetsManager.addMeshTask(key, "", "../../scene/"+key+"/", key+".babylon"); global.game.meshTask.onSuccess = function(task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); } } But if I do this, it works: // Work function addTask(key) { global.game.meshTask = global.game.assetsManager.addMeshTask(key, "", "../../scene/"+key+"/", key+".babylon"); global.game.meshTask.onSuccess = function(task) { task.loadedMeshes[0].position = new BABYLON.Vector3(0, 0, 0); } } addTask("scene_name"); I would like to load multiple scene with addMeshTask() from a list of json file, but it does not work. Why ? Thank you for your help. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted October 28, 2016 Author Share Posted October 28, 2016 Ok, I solved the problem with a setTimeout before using assetsManager.load(); GameMonetize 1 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.