Jump to content

Complete tutorial blender babylonjs


Achmed
 Share

Recommended Posts

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?

 
 

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!

Link to comment
Share on other sites

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.

post-8492-0-55481000-1419869694.png

Link to comment
Share on other sites

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:

 

774460bugprecisions.png

 

But when I make the ground x/y/z at the initial positions it's ok:

 

804351bugprecisions2.png

 

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.

 

929538shape.png

 

And the babylonjs option to check collisions

 

162497shape.png

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...