btBvhTriangleMeshShape suffering from tunneling
Posted: Tue Jan 08, 2013 4:26 am
Hello,
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:
It almost works, It actually makes the tunneling disapear, but it creates another behavior that if a lot of balls are too near each other (kinda inside, or penetrating), it will stuck the balls in the place, and every new ball I create near it gets stuck inside it too, I've a screenshot of it happening, if an video is needed just tell me and I will make one:
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!
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!