btBvhTriangleMeshShape only collides at slow speed

r_bewick
Posts: 8
Joined: Sat Nov 13, 2010 2:58 am

btBvhTriangleMeshShape only collides at slow speed

Post by r_bewick »

Hi, when I create a btBvhTriangleMeshShape, it works perfectly, and I can bounce a sphere on it. But if I make the sphere go fast it just goes right through the Mesh shape. (I don't mean extremely fast, just not slow)
I am only doing one iteration of my world, is this the problem? but if I increase this, my program goes too slow.
m_dynamicsWorld->stepSimulation(_fDeltaTick,1);
Can someone help me fix this?

thanks,
r_bewick
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: btBvhTriangleMeshShape only collides at slow speed

Post by Dirk Gregorius »

What means fast/not slow? If the sphere travels more than twice its radius between two frames it tunnels through the triangle. If Bullet implements two sided collison (I am not sure about this) the object will already tunnel if the sphere travels more than its radius per frame. This is because once the sphere center is "below" the triangle it will be corrected to the wrong side. As I said, I am not so much into Bullet implementation details so you need to check yourself. Anyway, note that this is a usual problem with discrete rigid body simulation and the solution is eiter to clamp the speed, reduce the timestep or use continuous collision detection.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: btBvhTriangleMeshShape only collides at slow speed

Post by mi076 »

"Bullet 2.x only has double-sided collisions with triangle meshes, but we could consider adding single sided triangle meshes in the future."

... from http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=5455

See also about CCD :

http://bulletphysics.org/mediawiki-1.5. ... n_Clamping
r_bewick
Posts: 8
Joined: Sat Nov 13, 2010 2:58 am

Re: btBvhTriangleMeshShape only collides at slow speed

Post by r_bewick »

thanks for the replies Dirk Gregorius and mi076 :D
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: btBvhTriangleMeshShape only collides at slow speed

Post by mi076 »

... and
I am only doing one iteration of my world, is this the problem? but if I increase this, my program goes too slow.
m_dynamicsWorld->stepSimulation(_fDeltaTick,1);
It is "simulation substeps"... wonder why it slows down your program...
See also http://bulletphysics.org/mediawiki-1.5. ... _the_World

To reduce tunneling you may also increase simulation rate ... (more work for CPU, not sure how good this approach is, but my old 3 GHz CPU seems to have no problem with it)

Code: Select all

m_dynamicsWorld->stepSimulation( _fDeltaTick, 7 , btScalar(1.0f/120.0f) );