LPD3DXMESH box; btBoxShape *box = new btBoxShape(btVector3(???));
How can I get btBoxShape Vector3 in order to create a box with the same length, width, height in bullet physics?
Basically, I am trying to convert LPD3DXMESH to btBoxShape.
Posted 20 December 2012 - 11:55 AM
LPD3DXMESH box; btBoxShape *box = new btBoxShape(btVector3(???));
Posted 21 December 2012 - 11:30 AM
Hi,
I'm able to get the width, length and height by using D3DXComputeBoundingBox()
float width = max.x - min.x; float length = max.y - min.y; float height = max.z - min.z;
The problem is that I'm not sure how can I pass the values to btBoxShape, I tried:
btBoxShape* box = new btBoxShape(btVector3(width / 2.0f, length / 2.0f, height / 2.0f));
But, I'm not getting a box with the same size.
Posted 23 December 2012 - 07:49 AM
Hi,
I'm able to get the width, length and height by using D3DXComputeBoundingBox()
float width = max.x - min.x; float length = max.y - min.y; float height = max.z - min.z;The problem is that I'm not sure how can I pass the values to btBoxShape, I tried:
btBoxShape* box = new btBoxShape(btVector3(width / 2.0f, length / 2.0f, height / 2.0f));But, I'm not getting a box with the same size.
Maybe you are getting an AABB and you are expecting a not axis aligned bounding box?
Posted 23 December 2012 - 02:06 PM
Hi,
I'm able to get the width, length and height by using D3DXComputeBoundingBox()
float width = max.x - min.x; float length = max.y - min.y; float height = max.z - min.z;The problem is that I'm not sure how can I pass the values to btBoxShape, I tried:
btBoxShape* box = new btBoxShape(btVector3(width / 2.0f, length / 2.0f, height / 2.0f));But, I'm not getting a box with the same size.
Maybe you are getting an AABB and you are expecting a not axis aligned bounding box?
This is bound to be the problem - Bullet documentation describes the btBoxShape as an OBB and MSDN describes D3DXComputeBoundingBox as returning an AABB.
Love DAOC? Tryout my DAOC clone: https://dl.dropboxusercontent.com/u/8974528/VON_Dist.zip
Posted 27 December 2012 - 03:39 AM
Actually not. At least not in the documentation I remember. Could you point out the exact statement?This is bound to be the problem - Bullet documentation describes the btBoxShape as an OBB
btBoxShape is an AABB. A btRigidBody using btBoxShape can be arbitrarly oriented, therefore making it an OBB.
Posted 27 December 2012 - 12:25 PM
Love DAOC? Tryout my DAOC clone: https://dl.dropboxusercontent.com/u/8974528/VON_Dist.zip