Page 1 of 1

Sphere Box collisions

Posted: Mon Sep 26, 2011 4:39 pm
by Laurent Coulon
The Sphere Box collision algorithm has been disabled in Bullet for several releases. I found some old posts in the forum saying that there was a bug in the code and since Sphere Box could use GJK instead there was no plan to fix it.
However if your application has a lot of basic collision primitives, using GJK for sphere box is needlessly expensive and can lead to contact inaccuracies (specifically it tends to introduce parasite rotations).

After digging into it a bit it turns out the current collision algorithm indeed had some logic issues with the way the margin was used.

I would like to propose the following code (see attached file) as a replacement for the sphere box collision algorithm. This new algorithm also takes the separation distance into account for generating contacts to improve rolling contact situations. It is quite easy to remove that extra distance if you want an exact contact trigger.

Any feedback would be appreciated.

Re: Sphere Box collisions

Posted: Tue Sep 27, 2011 4:24 pm
by Laurent Coulon
Here is the matching .h to make integration easier. Of course you will also need to remove the USE_BUGGY_SPHERE_BOX_ALGORITHM #define in the rest of the code.

Re: Sphere Box collisions

Posted: Fri Oct 07, 2011 4:50 pm
by Laurent Coulon
Hi Erwin,
I never got any feedback on this code but I have been testing it in my engine for a while now with no issues. Would it be OK to submit it to integrate it to the main Bullet code branch?

Re: Sphere Box collisions

Posted: Fri May 25, 2012 1:44 pm
by alex-weej
Out of interest, did anything come of this?

Re: Sphere Box collisions

Posted: Mon May 28, 2012 7:02 pm
by pico
Hi Laurent,

thanks for your work.

I would suggest to post such issues/patches here:

So you can make sure Erwin actually notices them and integrates them into the main branch when possible.