yerzhik Posted May 14, 2014 Share Posted May 14, 2014 As it says in tutorials, if I am using some model I can load scene by using:BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) { // Wait for textures and shaders to be ready newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); // Once the scene is loaded, just register a render loop to render it engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { // To do: give progress feedback to user});But I already have one scene and objects on it. How can I add that 3D object with several duplications to existing scene, with collisions supported? Quote Link to comment Share on other sites More sharing options...
Temechon Posted May 14, 2014 Share Posted May 14, 2014 Try this : http://www.html5gamedevs.com/topic/3200-pick-mesh-in-the-scene/?p=20710 Importmesh imports a specific mesh in an existing scene. If you want to import all meshes from an existing 3D model, your first parameter shoulod be an empty string ("") Nico 1 Quote Link to comment Share on other sites More sharing options...
yerzhik Posted May 14, 2014 Author Share Posted May 14, 2014 Try this : http://www.html5gamedevs.com/topic/3200-pick-mesh-in-the-scene/?p=20710 Importmesh imports a specific mesh in an existing scene. If you want to import all meshes from an existing 3D model, your first parameter shoulod be an empty string ("")Thank you, it worked. But how about collisions?Usually the physics is done by calling: box.setPhysicsState({ impostor: BABYLON.PhysicsEngine.BoxImpostor, mass: 2, friction: 0.4, restitution: 0.3 }); But in case of a non standard figure, is there a way to create Impostor for a 3D model? Quote Link to comment Share on other sites More sharing options...
yerzhik Posted May 14, 2014 Author Share Posted May 14, 2014 I have tried using BABYLON.PhysicsEngine.MeshImpostor, but its so slow and finally it freezes. Could someone tell me what can be done here?Using BoxImpostor = its is not natural when moving, rotating. Quote Link to comment Share on other sites More sharing options...
Temechon Posted May 14, 2014 Share Posted May 14, 2014 I would try to create a compound impostor : http://blogs.msdn.com/b/eternalcoding/archive/2013/12/19/create-wonderful-interactive-games-for-the-web-using-webgl-and-a-physics-engine-babylon-js-amp-cannon-js.aspx It depends of your 3D model, but try to get several simple impostors (box or sphere) attached to your model.For example, a character can have a sphere impostor linked to its head, a box character linked to its body, ... It won't be pixel perfect (as you said, very time-consuming) but it will do the trick. You can check this too : http://www.andybeaulieu.com/Home/tabid/67/EntryID/238/Default.aspx 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.