Sign in to follow this  
Zim

[Blender] submesh behavior dependent on model bounding box shape?

Recommended Posts

Hello everyone!

I've been strugoogling with the following behavior I get importing a Blender model into Babylon, which it is still about importing a LDraw model (see my previous and first thread), and I still don't know whether it's a problem with Blender, BJS or Cannon.js.

In Blender, on my imported LDraw vehicle model, I set an origin on each geometrical wheel center in order to be able to make them rotate along the x axis (when the vehicle is moving forward or backwards) and along the y axis (for the steering).
Then, I create a wired cube with the same origin as the origin of all the vehicle parts (except the wheels which has been changed) - which roughly corresponds to the geometric center of the vehicle.
This cube is meant to be the vehicle's bounding box. So I resize it to fit the vehicle, and make all other parts children of it.

On load in BJS, I set the cube's visibility to false, set a BoxImpostor on it, and everything look fine: the vehicle is visible and stays successfully on the ground.

The problem is when pressing the directional controls to make the wheels rotate, they become squeezed (they are no more "round" (oval section instead of circular section)).

I noticed that when the wheel are squeezed (when they are set a rotation value along any axis), their bounding box actually get the shape of the vehicle bounding box (which is the parent of every meshes).
Consequently, when I create a cubic instead of a cuboid vehicle bounding box in Blender (the surplus volume being put above the vehicle), the wheels behave as expected and run smoothly (but the vehicle bounding box is far too big!)

Does anyone know what is happening? Is it an expected behavior and the mistake is mine?

Any help will be greatly appreciated!

Kind regards,
Zim

Share this post


Link to post
Share on other sites

My mistake, I haven't already familiarized myself with the 3D modelling vocabulary. Wheels are subparts (children) of the bounding box objet. But there are only two depth levels (the parent box and all the vehicle parts which are its children).

Share this post


Link to post
Share on other sites

I know little about collisions, but for reference, this is how it is supported in Blender exporter.

When you select a mesh the last property tag, physics, needs some stuff.  Rigid Body must be checked, then one of the imposter shapes must be checked (Box, sphere, mesh, Capsule, Cone, cylinder, or Convex Hull).  Maybe try 'mesh'.  This probably does not solve whatever your problem is, but at least now you know that you can actually put the imposter into the .babylon file.

Share this post


Link to post
Share on other sites

Hi JC, thanks for the tip and your time making a screenshot !

Unfortunately, it does not solve my problem. As an alternative to the cubic bounding box, using empty axes as parent also works (wheels keep their shape), but it cannot apply physics to it.

Since modelling a car with animated wheels is something essentially common, there are probably good practices that I could refer to, if you know any?

I find out this futuristic car which behaves as expected, but I can't figure out what differed in the modelling process. I wish the author made time-lapse videos rather than WIP...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.