Large convex/concave collision tolerance.

steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

Large convex/concave collision tolerance.

Post by steveh »

Hello all.
I've come to a bit of a cross-roads with regards to using bullet for our 360/PS3 title. The collision margin needed by Bullet is too large for our pool game. The ball to ball (sphere/sphere) collision is fine. But the sphere to concave collision we are using for the ball to table collision means the balls are hovering above the table and being pushed in from the sides of the table. This is due to the collision margins used in the convex/concave routines (0.04). This can be show by droping a sphere onto a TriMesh consisting of 2 tris. If you make the ball 0.05 (5 cm), it will hover almost a balls height above the table.

Is there any way we can make this more accurate / have a smaller margin? I thought of going down the "scale everything up" route, but was advised against it. I'd really like to use Bullet in this commercial game, so I'd really appreciate any help.

Many thanks,

Steve.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

You should be able to set the collision margin of the concave mesh to zero. The sphere uses its entire radius for 'margin' so you don't need to worry/set the margin for the sphere. That should solve the gap.

It would be useful to reproduce the basic setup (triangle mesh + small spheres) in a Bullet Demo, and check the issues.

Hope this helps,
Erwin
steveh
Posts: 22
Joined: Mon Dec 19, 2005 3:15 pm

Post by steveh »

Hi Erwin, thanks for the speedy response.

I've tried setting the collision margin to 0.0, this has no effect:
pCollShape->setMargin(0.0f);

So I changed CONVEX_DISTANCE_MARGIN in btCollisionMargin.h, this fixed it and the gap is gone. Does this need to become a variable at some point, as I'll lose my changes if I update to a new version of Bullet.

Thanks again,

Steve.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

There might be an issue with collision margin for triangle meshes. If so, perhaps you can track down why it 'setMargin' doesn't work, it would save me some time.

Then we apply this fix, and you should be fine.

Thanks!
Erwin
ledvinap
Posts: 1
Joined: Wed Jul 02, 2008 4:50 pm

Re: Large convex/concave collision tolerance.

Post by ledvinap »

sim->getCollisionDetection ()->setTolerance (0.0001); works fine, but it affects only existing collision geometry ... so you must call it AFTER creating collision objects ...

Maybe this should be documented somewhere