Bullet 2.58 Capsule/ConvexShape problem

ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Bullet 2.58 Capsule/ConvexShape problem

Post by ola »

Hi again,

I might have found another issue, the collision for btCapsuleShape and btConvexHullShape doesn't work properly anymore.

btCapsule: only one sphere is included in the collision testing. So in my case, my avatar sinks to the neck into the ground, and hangs there, from his head.. :-)
btConvexHullShape: it's been a bit harder to test, but it seems only one vertex is tested for collision, so mostly these bodies just fall through the other bodies (or get stuck, in a few cases).

I've tested collision against static btBvhTriangleMeshShapes and other static meshes, as well as cubes, cones, spheres and cylinders, using both the btSimpleBroadphase and the bt32BitAxisSweep (I recon this isn't about broadphase anymore, though..)

Best regards,
Ola
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet 2.58 Capsule/ConvexShape problem

Post by Erwin Coumans »

Hi,

Can you reproduce this problem in one of the Bullet demos?

I tried to reproduce it in the ConcaveDemo, but it just works fine.

Can you test the ConcaveDemo, and see if that works with a capsule?

Code: Select all

{
//bullet\Demos\ConcaveDemo\ConcavePhysicsDemo.cpp

		for (int i=0;i<10;i++)
		{
			//btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
			btCollisionShape* colShape = new btCapsuleShape(0.5,2.0);//boxShape = new btSphereShape(1.f);
			startTransform.setOrigin(btVector3(2*i,10,1));
			localCreateRigidBody(1, startTransform,colShape);
		}
	}
Thanks for the feedback,
Erwin

ps: I split the topic, it is a new issue
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Bullet 2.58 Capsule/ConvexShape problem

Post by ola »

Hi Erwin,

I just tried this using the new 2.59 version, replacing the boxes in the ConcaveDemo with capsules and convex hull shapes. It still fails.

The capsules only collide on one of the spheres (the bottom ones, so they flip over when hitting the ground).
The convex hull shapes just fall through the ground.

I tried using both single and double precision, it doesn't seem to have any influence on the result.

I'm using Linux, maybe that's got something to do with this?

I used the following code (the rest unmodified):

Code: Select all

	{
		for (int i=0;i<10;i++)
		{
// 			btCollisionShape* boxShape = new btBoxShape(btVector3(1,1,1));
			//btCollisionShape* boxShape = new btSphereShape(1.f);
//          btCollisionShape* boxShape = new btCapsuleShape(0.2, 1.43);
			
            btCollisionShape* boxShape = new btConvexHullShape();
         btConvexHullShape* hullshape = dynamic_cast<btConvexHullShape*>(boxShape);
         hullshape->addPoint( btPoint3( 2.5, 0.0, 0.0) );
         hullshape->addPoint( btPoint3( 2.0,-1.0, 0.0) );
         hullshape->addPoint( btPoint3( 2.0, 1.0, 0.0) );
         hullshape->addPoint( btPoint3(-1.0,-1.0, 0.0) );
         hullshape->addPoint( btPoint3(-1.0, 1.0, 0.0) );
         hullshape->addPoint( btPoint3( 1.0, 0.0,-1.0) );
         hullshape->addPoint( btPoint3(-1.0, 0.0,-1.0) );
      
      startTransform.setOrigin(btVector3(2*i,10,1));
			localCreateRigidBody(1, startTransform,boxShape);
		}
	}
For comparison I just tried this with a fresh 2.56 Bullet version which does not have this problem. I've mostly been keeping up to date using the svn version, and I think the problem was introduced during the last few days, maybe last Friday or so.

Best regards,
Ola
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet 2.58 Capsule/ConvexShape problem

Post by Erwin Coumans »

Not sure why, but for some reason the union in the quadword/vector doesn't work under some gcc versions, although under Windows visual studio, and Mac OSX gcc 4.0.1 it works fine.

I removed the union in LinearMath/btQuadWord.h, and the problem is gone. Please try Bullet 2.60, it should fix the issue.
Thanks for the report!
Erwin
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway

Re: Bullet 2.58 Capsule/ConvexShape problem

Post by ola »

Hi Erwin,

yes that solved it! Thank you!

Best regards,
Ola