I've started playing with Bullet Physics for just 2 days, but so far I've successfully integrated it to my voxel engine, but sometimes the objects suffer from tunneling and fall from the terrain.
Basically what I have is an grid of chunks, each chunk being an 3D array of 16x16x16, which defines what kind of block is in the local, so the chunk transforms it in an mesh which is what I'm using to fill an btBvhTriangleMeshShape. So each chunk generates it own btBvhTriangleMeshShape and register it with Bullet world.
For testing the collision I'm creating a lot of btSphereShape, the collision works as expected until the sphere move so fast that it will fall from the world.
To ilustrate it better I've made an video showing the problem: http://www.youtube.com/watch?v=l3JS0ACIOZc
reading about it in this forum and in google the solution I've found was activating Ccd, I've tried it using these 2 line for each sphere:
Code: Select all
sphere_->setCcdMotionThreshold(radius);
sphere_->setCcdSweptSphereRadius(radius * 0.9f);
http://imagebin.org/242083 (Every ball floating in this screenshot is actually stuck)
http://imagebin.org/242084
Fell free to ask for any other information regarding the problem.
Thanks a lot!