There are three DOF in the contact joint. A generic constraint equation is written as

Jv = c |
(1) |

The first DOF is in the normal direction. The LHS of Eq. (1) is

where *r*_{1} = cp – *p*_{1} and *r*_{2} = cp – *p*_{2}. The RHS of Eq. (1) is

*c* = erp/*h*â‹…depth

But *c* is limited by maxvel, so

if (c > maxvel) c = maxvel

Since cfm is associated with the constraint DOF, a specific cfm can be entered here. There are 3 possible cfm, which are set up by soft_cfm, slip1, and slip2, respectively.

cfm(1) = soft_cfm

The impact has a direct effect on *c*

pick the larger value between contact and impact

if(c_i > c) c = c_i

The lower and upper bounds are

lo(1) = 0 hi(1) = infinity

The second DOF is the first tangent direction. Let *t*_{1} and *t*_{2} be the tangent directions to normal *n*

c = motion1 (so motion1 and motion2 are velocities) lo(2) = -mu (if mu=0, the friction force is practically set to zero) hi(2) = mu cfm(2) = slip1

The LHS of the constraint equation in the second tangent direction is

The RHS of the constraint equation is

c = motion2 lo(3) = -mu2 hi(3) = mu2 cfm(3) = slip2