[ODE] Tips on collision detection

Nolan J. Darilek nolan at thewordnerd.info
Thu Aug 28 14:40:02 2003


I've been integrating ODE's collision detection into my environment a
bit more thoroughly. I have a few questions, however, and was
wondering if any of you might be able to advise.

I currently have collision detection code that sends a
per-object-customizable message into the environment. I've arbitrarily
chosen a penetration depth of 0.1, and any collisions of depths less
than that result in no message being sent. Messages are sent by
collide and collide_with methods which, eventually, will be overridden
to actually cause damage.

I want to talk about the arbitrary value I've chosen, however, and how
I might go about eliminating it. I'm thinking about dividing
collisions into four broad categories, which I'll illustrate using the
example of a car crash. The most extreme represents totaling. The car
is destroyed, the people inside are destroyed, nobody is happy
(unless, of course, you were the one who destroyed the car in the
first place. :) The second most extreme category represents heavy
damage. The car isn't destroyed, but it is in need of intense
repairs. The third is much lighter. Some damage may be sustained,
though it is also quite possible to escape unharmed. The lowest
category is merely a grazing impact. You've hit hard enough to notice
the impact, but no damage is done.

Now, the thresholds for these values will be configurable on
individual game objects--the most extreme level of damage will be much
easier to achieve with a glass vase than with a steel ball
bearing. I'm thinking about representing them with percentiles of
penetration depth vs. "object depth," for lack of a better term. It is
this concept of "object depth" that confuses me, though. At the moment
i'm modeling balls bouncing on flat planes, so this can be equated
with the object's radius, but this quickly falls apart when cylinders,
boxes, etc. enter the picture. As this is only a MUD and probably
won't be graphical for quite some time, if at all, I'm not necessarily
concerned with determining exactly WHERE a body has been hit, only how
BADLY it has been hit.

Am I even remotely on the right track with this idea? Can anyone else
offer perspectives on how to map collision penetration depths into
actual game terms, determining the non-physics game effects of a
particular impact?