Using D3DXComputeBoundingBox()

Started by
20 comments, last by Medo Mex 11 years, 3 months ago
I think the problem has nothing to do with 3Ds Max, since I tried to create a box by writing its dimensions according to 3Ds Max instead of loading .x file.

How can I convert 3Ds Max box dimensions to Bullet box dimensions?

I tried:
float 3dsMaxBoxWidth = 800.0f;
float 3dsMaxBoxHeight = 800.0f;
float 3dsMaxBoxDepth = 800.0f;

btVector3 boxHalfExtents(3dsMaxBoxWidth/2.0, 3dsMaxBoxHeight/2.0, 3dsMaxBoxDepth/2.0); // Not working

I guess that's not the correct way to convert 3Ds max box dimensions to Bullet box dimensions, perhaps I should convert 3Ds Max measuring unit to Bullet measuring unit?
Advertisement

What if you create the box entirely through code? For something as simple as a box it is easy to just fill out the vertex and index buffers by hand. Make its size (1, 1, 1). Then, create a physics box in bullet with the same size. Do they now align correctly? If that is the case you know that the problem is with importing stuff from 3DS Max. If not, then make sure you fix the problems before even thinking about 3DS Max.

If the engine now works as it should but importing from 3DS Max still produces too large objects you can always scale the data down by hand. Though I would think that with a little bit of searching you'll find the problem there too.

Yes, I tried that as well.

In 3Ds Max (It will be used for rendering only):
Box size: 10, 10, 10

In physics, I set the numbers by writing them manually instead of extracting them from LPD3DXMESH, so I write:
btBoxShape* boxShape = new btBoxShape(btVector3(10/2, 10/2, 10/2));

The box is not on the ground which means the physics box is larger than the visual box.

BTW, the measuring unit is set to "Generic Units" in 3Ds Max.
So you created the box in 3DS Max? I told you not to do that, but instead fill in the buffers yourself through code. That is the easiest way to tell if the problem is in the max import or not.

Merry Xmas!
Okay, I tried using D3DXCreateBox() to create the box instead of loading it from external file and it's working perfectly.

Now, I'm not sure how to resolve the issue when using 3Ds Max .x file, maybe I should change 3Ds Max measuring unit?

Merry Christmas and Happy New Year!

Because the D3DXComputeBoundingBox has a limitation: it can only computes a bounding box align to the coordinate-axis. When you use D3DXCreateBox or use 3ds max to create a box not align to the coordinate-axis you will find that the bounding box always align to the coordinate-axis, not align to the object axis, so the size is much larger than the size of the box.

Alin

D3DXCreateBox() works perfectly with bullet.

3Ds Max box doesn't work and the box created with bullet btBoxShape after loading it from box.x is not the same size.

Should I change the settings in 3Ds Max to resolve the issue?

Any idea how to solve this problem?

I'm trying to create the box in 3Ds Max instead of D3DXCreateBox() and load its information using bullet.

Change the size of the box in 3d max export then check box size repeat until you get the correct size then that is the scale you need to creat all you 3dsmax boxes.

@ankhd: That's not a good idea, I will be working on dozens of boxes and doing that will be a total waste of time and won't even get the exact size.

This topic is closed to new replies.

Advertisement