Jump to content

  • Log In with Google      Sign In   
  • Create Account


Extracting box Vector3 from LPD3DXMESH box


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 20 December 2012 - 11:55 AM

I have LPD3DXMESH box that I load from .x file, I'm trying to setup physics for it.
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.

Sponsor:

#2 Ravnock   Members   -  Reputation: 286

Like
0Likes
Like

Posted 21 December 2012 - 04:18 AM

Maybe you have to compute the vertex info, getting it from ID3DXBaseMesh::GetVertexBuffer and calculate the with, length and height to pass them to the btBoxShape constructor.



#3 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

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.



#4 Ravnock   Members   -  Reputation: 286

Like
0Likes
Like

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?



#5 Steve_Segreto   Crossbones+   -  Reputation: 1512

Like
0Likes
Like

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.



#6 Paradigm Shifter   Crossbones+   -  Reputation: 5254

Like
1Likes
Like

Posted 23 December 2012 - 04:03 PM

You forgot a *bdum tish* after the "bound to be the problem" gag ;)
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#7 Ravnock   Members   -  Reputation: 286

Like
1Likes
Like

Posted 23 December 2012 - 06:48 PM

You forgot a *bdum tish* after the "bound to be the problem" gag ;)

XD

 

Sorry, I had forgotten completely how to say OBB in English, so I said non AABB



#8 Krohm   Crossbones+   -  Reputation: 3049

Like
0Likes
Like

Posted 27 December 2012 - 03:39 AM

This is bound to be the problem - Bullet documentation describes the btBoxShape as an OBB

Actually not. At least not in the documentation I remember. Could you point out the exact statement?

btBoxShape is an AABB. A btRigidBody using btBoxShape can be arbitrarly oriented, therefore making it an OBB.



#9 Steve_Segreto   Crossbones+   -  Reputation: 1512

Like
0Likes
Like

Posted 27 December 2012 - 12:25 PM

btBoxShape.h: Line 26
 
///The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
 
Thanks for the clarification
 





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS