Bullet cylinder vs. box shape behavior

Hello,

I’ve been using Panda3D for a while with ODE, and recently decided to try it with the new Bullet integration. It seems great so far! However, there is one weird error that I can’t seem to figure out, which is that my objects will fall through the BulletCylinderShape but not the BulletBoxShape.

I have a simple script which creates a cylindrical ground/pedestal and then stacks 10 blocks on top of it. I create the physical ground like so:

ground_shape = bt.BulletCylinderShape(5.0, 10.0, bt.ZUp)
#ground_shape = bt.BulletBoxShape((5.0, 5.0, 5.0))     
ground_body = bt.BulletRigidBodyNode('ground')
ground_body.addShape(ground_shape)
self.world.attachRigidBody(ground_body)
self.ground = render.attachNewNode(ground_body)

Then when I run physics, the tower of blocks will tumble down and some of the blocks will remain on the ground but some will fall right through. I’m almost positive this isn’t a CCD issue, because sometimes the blocks will slide along the ground before falling through (i.e., they don’t actually have any velocity in the z-direction).

Furthermore, if I replace the cylinder shape with an equivalent box shape (see the commented line in the code above), everything works perfectly. No blocks ever fall through the ground.

Is there something I’m totally missing here? Has anybody else encountered this problem? I can post the rest of my script if it will be helpful, but from what I can tell the problem is isolated just to the ground’s collision shape.

Thanks in advance!

EDIT: I should mention that I am running the dev version of Panda3D, specifically the panda3d1.8_1.8.0+cvs20120126~oneiric105_amd64 build (I updated yesterday from panda3d1.8_1.8.0+cvs20120106~oneiric82_amd64, which wasn’t working either).

Integresting. When enabling the debug rendering for collision shapes AND bounding boxes then you will see that the collision shape seems to be fine, but the bounding box is wrong.

I’m tempted to blame Bullet itself. But I have to investigate more first.

A workaround is to set the heading of the cylinder shape to 90.0 degrees. This seems to fix the collapsed bounding box. Don’t ask me why.

Sorry, took me some time to find the problem. It’s my fault, not the Bullet library. I did some silly things in the convenience constructor I provided (the one with radius and height).

I check in a fix this evening. Until then you could work around by simply using the native constructor (The one with Vec3). In your case this would be:

ground_shape = bt.BulletCylinderShape(Vec3(10.0, 10.0, 5.0), bt.ZUp)

Ok, checked in a fix for this bug. the next snapshot build should pick up the fix.