Search code examples
physicsgame-physicsbulletbulletphysics

Bullet Physics Problems


For those of you who have used bullet physics...

I read and ran the hello world example http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Hello_World, and I am confused where to go next.

The hello world tutorial consisted of a btStaticPlaneShape and a btSphereShape, both rigid bodies. The sphere bounced on the static plane shape no problem.

However, I when I make another sphere at a different position, Bullet does not record collisions between the two sphere shapes, but it both automatically bounce off of btStaticPlaneShape. What kind of internal magic causes the btStaticPlaneShape to automatically bounce objects that collide with it?

Is there a setting in Bullet that automatically bounces objects off of each other after colliding? Or do you have to manually test for collisions and apply the resulting forces yourself?

Thanks.


Solution

  • You may have inadvertently created the spheres in a state where Bullet doesn't think they're supposed to be able to collide with each other. If you stick mostly to the defaults, and just add another sphere to the Hello World program, Bullet should notice and react to their collisions. They won't actually bounce unless you also modify Hello World to set their restitution to something greater than zero, but they will collide. For example, I added a second sphere directly above the first (by putting a for loop around the code block that creates the sphere, and using the loop variable to determine the origin y value) and extended the simulation so it runs long enough for them both to reach the plane. The first lands on the plane and rests there, the second lands on the first and rests there.

    If this doesn't help, then posting some of your code is probably a good next step.