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.
Sphere Box collisions
-
- Posts: 29
- Joined: Tue Oct 05, 2010 9:36 pm
Sphere Box collisions
- Attachments
-
- btSphereBoxCollisionAlgorithm.cpp
- (7.37 KiB) Downloaded 526 times
-
- Posts: 29
- Joined: Tue Oct 05, 2010 9:36 pm
Re: Sphere Box collisions
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 477 times
-
- Posts: 29
- Joined: Tue Oct 05, 2010 9:36 pm
Re: Sphere Box collisions
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?
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
Out of interest, did anything come of this?
Re: Sphere Box collisions
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.
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.