# [ODE] ODE with non-penetration constraint

Dirk Gregorius dirk at dirkgregorius.de
Thu Jul 12 12:32:21 MST 2007

```Nguyen,

I would argue that the ODE solves on the velocity level. Basically you have an DAE (for simplicity for holonom constraints):

dv/dt = W * ( F_ext + JT * lambda )
dx/dt = v

C(p,q) = 0

We use the differential quotient for the accelerations:

dv/dt ~= ( v(t+dt) - v(t) ) / dt -> v(t+dt) = v(t) + W * ( F_ext + JT * lambda ) * dt

We can find the velocity constraints through differentiation of the position constraints

dC/dt = dC/dx * dx/dt = J * v(t) = 0

Since we use the velocities of the end of the timestep (Symplectic Euler) we can require J * v(t+dt) = 0

If you combine these equations you end up with the well know LS (or MLCP in the presence of non-holonom constraints)

J*W*JT*lambda = -( v(t)/dt + W * f_ext )

You could multiply the whole equation by dt > 0 and get

J*W*JT*(lambda*dt) = -( v(t) + W * f_ext * dt )

You clearly see the forces and impulses are linear related in this model. Also I argue that in every discrete model a constraint can't break. Of course a constraint force could become zero (through clamping), but the ODE can handle this as well.

So regarding the original question. Because of the discrete collision model you can end up in penetration. This has nothing todo with hard or soft constraints. The ERP parameter basically handles how much of the error is corrected each timestep. Also note that ODE has some value that allows for some penetration before the error correction jumps in. This is in order to deal with jitter and to improve coherence. So the 0.005 you see might be the default value for the allowed penetration.

HTH,
-Dirk

```