Using D3DXComputeBoundingBox()
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?
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.
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.
Merry Xmas!
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
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.