Vousk-prod. Posted August 5, 2014 Share Posted August 5, 2014 Heyo, I'm trying to mix some .babylon files together in the same scene so they can interact together... The first file creates the BJS scene with SceneLoader.Load, then I would have tought that SceneLoader.ImportMesh with the second file updates the existing scene with new meshes, but in fact it creates a new BJS scene... Am I missing something or this is the expected behavior ? How can I add many new meshes from different .babylon files to one unique same (without creating 2 scenes then manually copying everything from one to other) ? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted August 5, 2014 Author Share Posted August 5, 2014 Forget that ! My fault !Due to asynchronous javascript loading, my SceneLoader.ImportMesh was called before SceneLoader.Load SceneLoader.ImportMesh does perfectly its job and updates the existing scene we provide in parameter. Quote Link to comment Share on other sites More sharing options...
gryff Posted August 5, 2014 Share Posted August 5, 2014 Vousk-prod, you might want to take a look at this example of mine: Desk and Book Here is some of the code:BABYLON.SceneLoader.Load("https://dl.dropboxusercontent.com/u/70260871/webgl/desk/", "desk_drawers3b_anim4_6retex4e.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { newScene.activeCamera.attachControl(canvas); mySkeleton[0] = newScene.getSkeletonById(0); BABYLON.SceneLoader.ImportMesh(null, "https://dl.dropboxusercontent.com/u/70260871/webgl/desk/", "newbook4_4b1.babylon", newScene, function (newMeshes, particleSystems, skeletons) { book = newMeshes[0]; mySkeleton[1] = skeletons[0];Both "Load" and "ImportMesh" use the same scene "newScene" cheers, gryff Edit: too late!! Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted August 5, 2014 Author Share Posted August 5, 2014 Yup, too late But since your answer could help others I will stick "best answer" to it. Cheers 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.