[ODE] Negative penetration depths

Martin C. Martin martin at metahuman.org
Wed Sep 4 09:54:01 2002


Thomas Harte wrote:
> 
> > Although I've never tried it, the notion of a negative or zero penetration
> > depth is quite reasonable, and doesn't mean that "no penalty need be
> > applied." In fact, in a perfect simulation, when one object rests on
> > another, a constraint with zero penetration depth is what would keep it
> > from falling through. I suggest you try it and see what happens.
> 
> When I said "no penalty needs be applied", I was talking about the difference between
> penalty methods and genuine constraints in physics simulations. It is my understanding
> that a genuine constraint is modelled via an ordinary differential equation, which is
> solved in order to definitely prevent the geometry being able to break the constraints,
> whereas a penalty is something like a spring, which uses a simple feedback system to
> make the geometry 'want' not to break the constraints.

Russ, can you chime in on this, if you haven't fallen into a volcano?

My understanding doesn't involve a differential equation.  Basically,
there are two parts to a constraint.  One says "the velocity of this point
on the object needs to be at least this much in this direction."  The
other is a direction that the joint/contact can apply force to make this
happen.  The two directions are often (always?) the same.  These are then
translated into equivalent statements about the center of mass.  In other
words:

velocity += AddedForce * timestep + k1 * v1 + k2 * v2 + ... + kn * vn

AddedForce is a vector that includes gravity, timestep is the size of a
time step (in seconds), the v's are force directions, and the k's are what
the solver needs to figure out.  It needs to choose the k's so that all
the constraints come out true, or at least as close as possible.

> It is further my understanding that in the case of ODE, adding a contact constraint adds
> both a hard constraints - preventing interpenetration becoming any worse, and a penalty
> method - pushing the objects apart and hence making the penetration better.

I don't think it's either hard constraints or penalty method.  Certainly,
things can get worse: if a box is sitting on the ground, and another box
is dropped on it, the lower box will sink into the floor a bit more.  And
the penalty method the way you've described it -- apply a greater force
the more the constraint is violated -- doesn't require a solver and
doesn't work very well.

> In the case of negative penetration depth, it is my fear that ODE may still try to impose
> the penalty method, but in using a negative distance, will pull the objects together rather
> than letting them move correctly.

This would be very easy to test...

Good luck, and let us know what you discover,
Martin