[ODE] Box - Cylinder collision?

Pierre Terdiman p.terdiman at wanadoo.fr
Thu Aug 29 11:16:02 2002


> ODE's cylinder primitive is indeed a capped cylinder - "capsule" is a good
> word for it.  At first I thought that was kind of silly (they make lousy
> car tires) but I'm beginning to see why that shape was chosen. :-)
>
> How should one approach box-capsule collision?  I've got no experience in
> collision detection, but I'm getting interested. It seems to me that most
> cases could be handled by testing against the line segments at the edges
> of the box.  The other cases would be covered by testing for intersections
> between the box face and the end-cap half-spheres.  Would that cover all
> cases, or am I overlooking something - or is there a better approach?

Wait, are ODE's cylinders actually capsules ? [...I admit I'm -not- using
ODE but my own physics code.... www.codercorner.com/Physics.zip for an
example]

Then it's easy, you just have to grab the segment-box distance code from
Magic, and here you go. The capsule is then defined as a segment and a
radius (which gives exactly what the "capsule" actually is : a "LSS", i.e.
Line Swept Sphere). Penetration distance is simply the difference between
the radius and computed distance, for example. While not beeing perfect, it
should work.

As always, the algorithmic issues have already been discussed on the
GD-Algorithms list, so check their archives for more details...

Pierre