Box2D swept collision roadmap

Hi Erin,

Have you found my swept collision code on the gamedev.net physics forum? I ended up giving up because I was seeing O(n^2.5) performance characteristics, but the code is clean and straightforward. http://ptymn.hopto.org/ToyBox2DCollision.zip I'm hoping that Box2D or Chipmunk gets swept collisions soon because the performance is starting to get bad when I have bullets leaking out of my levels. Its nice to see that Box2D is being resumed, since it seemed like it was idle for awhile.

-Tim Kerchmar
Hi Tim,

Thanks for the note and code. For CCD I'm planning to use conservative advancement (CA) as described in these references:

http://www.continuousphysics.com/BulletContinuousCollisionDetection.pdf
http://graphics.ewha.ac.kr/FAST/

I suspect these algorithms provide good performance, work well with systems that allow penetration, and also handle fast rotations.

Have you tried these methods?
I do nearly precisely what is described in that paper. Not quite exactly, but close.

1) I request the object's new motions, given a full frame time interval.
2) Use 2nd to 4th order polynomials to predict when a pair of boundary primitives are within EPSILON of each other, assuming constant linear and angular velocities.
3) Feed time calculated from step 2 back to step 1 until no collision is predicted within the time interval.

At the end of the frame, although different objects can have different update times that were used, only very non-linear motion will cause objects not to be *touching. Also, I used a 4th order polynomial for the case where a dialating circle is being tested against a rotating line segment.

The performance was acceptable until I was writing the physical solver part of the engine. Objects with a low angular mass were taking many iterations before they stopped rotating into the ground. My collision routines were incapable of handling penetrations, and this affects all parts of the engine, because penetrations have to be prevented and tested for each time an object is moved or even given a velocity that might cause a penetration. I was close, but when I realized what the problem was, I was already too eager to get started on writing a game instead. 🙂

*not penetrating, but within EPSILON of each other.

Original thread: https://box2d.org/forum/viewtopic.php?t=42