Sign in to follow this  

bullet : issue with convex hulls

This topic is 2843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Here's my problem :I've defined a shape representing a box, as a convex hull, and I get some troubles at first collision response. The collision is well detected but the response is not correct. So I've replace the convex hull with a simple box representing the same volume and then it works fine. Does someone know from what it comes from please ? Thanks

Share this post


Link to post
Share on other sites
I'm not clear, so say you have a box representing a convex hulll, then go on to say that is causes a problem, but when you replace it with 'a box' no more problem. So are you using a box when you have your problem or not??

In any event, I'd say if different geometry causes different collision results, the problem is with your collision geometry. Make sure you collision responsed are working good no matter what orientation they are in when they collide.

Share this post


Link to post
Share on other sites
thank you for the answer

i've problem with a convex hull representing a box (8 points convex hull).
so i replaced this convex hull with a btShapeBox object having the same dimensions.

With the convex hull : the collisions are well detected (they really occurs on contact) , but the first collision response is odd : huge angular velocity is created; however, the shape simply falls on a floor.

With the box : the collision is well detected AND the response is good.(just a small vertical bounce on the floor)

What's more I've checked the points of the convex shapes, they are correct.
(anyway if they were not, the collision would not be correctly detected)

I suppose the rigid body is correctly created because of its correct behaviour with the box shape.

Share this post


Link to post
Share on other sites
Could be a problem with the inertia matrix? If your collisions are correct, and you have the response giving you crazy angular velocities, I would check that. Although the inertia matrix should not matter if you box and convex hulls are identical.

Share this post


Link to post
Share on other sites
Thank you

If body inertia wouldn't be correctly initialized, i'd also have the same 'crazy' behaviour with the box shape version, don't you think so ?

Here's my code for adding a rigid body if you want to check this:


btRigidBody * addBody(D3DXVECTOR3 & position,float yaw,float pitch,float roll,float mass,Shape * shape)
{
if (shape==NULL) return NULL;

btTransform transform;
transform.setOrigin(btVector3(position.x,position.y,position.z));
transform.setRotation(btQuaternion(yaw,pitch,roll));

btDefaultMotionState * motionState=new btDefaultMotionState(transform);
if (motionState==NULL) return NULL;

btVector3 localInertia(0,0,0);
if (mass!=0.0f) shape->shape->calculateLocalInertia(mass,localInertia);

btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,motionState,shape->shape,localInertia);

btRigidBody * body=new btRigidBody(rbInfo);
if (body==NULL)
{
delete motionState;
return NULL;
}

dynamicsWorld->addRigidBody(body);

return body;
}

Share this post


Link to post
Share on other sites

This topic is 2843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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