Achmed Posted December 29, 2014 Share Posted December 29, 2014 Hello guys, I have try many to make many script with babylonjs and blender, but I have always different problem. So I come to ask you if you know a good tutorial who explain how load blender file (map and object), and use the gravity and collisions, move, all at the same time? I have find how to load blender file with this tutorial :http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx, so the load it's ok. Without blender, all works fine, but with blender sometime collisions don't work, sometime gravity, so I don't undestand. Thank you very much for your help! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 29, 2014 Share Posted December 29, 2014 I agree that a tutorial putting the entire Blender to Babylon process is virtually non-existent. That link is ancient, and shows a very inferior way of installing the plug-in. You should be clicking the "Install from File..." button shown on the picture, not manually copying files. Gravity is specified on the World Object, with the "Blender Game" render in use. This value is always written into the .babylon file. Perhaps this value is not in the correct units for you. I have no experience with collisions, & do not what to do in Blender to generate the impostor. Quote Link to comment Share on other sites More sharing options...
Achmed Posted December 31, 2014 Author Share Posted December 31, 2014 I don't have gravity option because I have last version of blender and babylonjs I think, but I have mass option. Unfortunately, I don't find IntersectMesh precise option, to enable this option at true. Because by default the precise option is false and I get this problem: But when I make the ground x/y/z at the initial positions it's ok: So it's a problem for me. To create this, I enabled "rigid body" option with mass at 0 for the ground and 0.5 for the cube.And I enabled shape with box option. And the babylonjs option to check collisions Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 31, 2014 Share Posted December 31, 2014 Do you want physics? If so you have to set both objects with rigid body collisions set to Box.You also have to set the ground's mass to 0.00001 and other box's mass to 1 for instance And that's it Check collisions is for collisions between camera and meshes (for FPS game for instance) Quote Link to comment Share on other sites More sharing options...
Achmed Posted December 31, 2014 Author Share Posted December 31, 2014 Yes the physics work fine,and I have activate options like you say but I don't undestand why in my first step the ground is on property rotation 0,0,0 the cube have collision with the ground and why in my second step when I have rotate a little the ground, the cube don't touche the ground. All mesh are set in "rigid body" to Box collisions, the ground with 0.00001 mass and cube 0.5 mass for the step one and two (I have just change rotation). So I think the problem is a precision of collision, because when I don't use Blender and I make the scene with source code only (javascript), the function IntersectMesh have a option "precision" enable at true or false whose resolve the problem. Like this tutorial:https://github.com/BabylonJS/Babylon.js/wiki/10-Intersect-collision-object But maybe isn't possible directly with import Blender? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 31, 2014 Share Posted December 31, 2014 yes but physics does not use the intersectMesh function. Btw what you are trying should work Are you using oimo.js or cannon.js for physics? Quote Link to comment Share on other sites More sharing options...
Achmed Posted January 1, 2015 Author Share Posted January 1, 2015 I try to enable collisions with all meshes of my ground (for exemple ground.babylon) and an other mesh import an another file (for example a cube in cube.Babylon).The collision with the ground is enable with "check collision" option, because if I uncheck this, the cube cross the ground. So I thank, the option "check collision" is not only to the camera.But it's doesn't work for the other meshes of the ground like walls for exemple.I use actualy Oimo.js Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 1, 2015 Share Posted January 1, 2015 Check collision is not related to physics. You can uncheck it. Can you share your .babylon scene? Quote Link to comment Share on other sites More sharing options...
Achmed Posted January 2, 2015 Author Share Posted January 2, 2015 Yes of course, I can show you my project too. I have create a zip folder on my dropbox: https://www.dropbox.com/s/d5fka7hcd5ma5sj/essai.zip?dl=0I have two versions, one with the inclined ground and one without. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 3, 2015 Share Posted January 3, 2015 It would be more handy if you can create a repro on the playground Quote Link to comment Share on other sites More sharing options...
Achmed Posted January 4, 2015 Author Share Posted January 4, 2015 I don't have a finish playground because I want to know all I need to complete this.I have make more test and I found two problem. Here my two examples: https://www.dropbox.com/s/r5t01ulthxocgun/Tests.zip?dl=0 In the Example1, all work, physics and collisions but I have a problem on the center of the playground. A collision is enable like a mesh is availlible but invisible. In my blend file, I don't have mesh on the center! In the Example2, I have add move action with 'deplacement' function (whose works fine), but when I move the mesh, the Physics, maybe all the word stop, but I don't undestand why.The move function is on the runRenderLoop function. You can move with keyword Z and S (europ keyboard). Quote Link to comment Share on other sites More sharing options...
Achmed Posted January 7, 2015 Author Share Posted January 7, 2015 I have try with :var up = new BABYLON.Vector3(mesh.position.x, mesh.position.y, 0.02);mesh.moveWithCollisions(up);But it's the same, the cube move in axe Z but the physic/gravity and collisions stop.I don't understand why. Do you have any suggestions? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 8, 2015 Share Posted January 8, 2015 You must do this for gravity: var up = new BABYLON.Vector3(mesh.position.x, .-0.75, 0.02);mesh.moveWithCollisions(up); 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.