Sphere Box collisions

Post Reply
Laurent Coulon
Posts: 29
Joined: Tue Oct 05, 2010 9:36 pm

Sphere Box collisions

Post 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.
Attachments
btSphereBoxCollisionAlgorithm.cpp
(7.37 KiB) Downloaded 512 times
Laurent Coulon
Posts: 29
Joined: Tue Oct 05, 2010 9:36 pm

Re: Sphere Box collisions

Post 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.
Attachments
btSphereBoxCollisionAlgorithm.h
(3.46 KiB) Downloaded 459 times
Laurent Coulon
Posts: 29
Joined: Tue Oct 05, 2010 9:36 pm

Re: Sphere Box collisions

Post 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?
alex-weej
Posts: 7
Joined: Thu Mar 01, 2012 10:07 pm

Re: Sphere Box collisions

Post by alex-weej »

Out of interest, did anything come of this?
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: Sphere Box collisions

Post by pico »

Hi Laurent,

thanks for your work.

I would suggest to post such issues/patches here:
http://code.google.com/p/bullet/issues/list

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