Soft Constraint Formula

Erin notes in his presentation of soft constraints that the formula in general is:

Cdot = Jv1 + Beta * x0/t + Gamma * Lambda = 0

Given the 'magic' formulae for calculating Beta and Gamma from the implicit Euler integration of a spring, as the spring stiffness and damping tend towards infinity, Beta = 1 and Gamma = 0. So a hard constraint by that definition is then:

Cdot = Jv1 + x0/t = 0

If you work this out for a distance constraint where the distance is zero, then this all comes out correctly. However, when the distance constraint has non-zero distance, the distance is never considered (I'm assuming here that x0 for two bodies a and b is calculated by xa0 - xb0).

i.e. C = Length(xa1 - xb1) - d = 0 = Length(x1) - d

Is my definition of x0 incorrect? Should I really be defining x0 = Length(xa0 - xb0) - d? Or is the x0 in the formula incorrect? Should that actually be something related to C?

Certainly when I calculate the constraint impulse with x0 = Length(xa0 - xb0) - d, it comes out as I would expect.

Thanks,

Rory
Substitute C for x0. You want to use the current position error.
Thanks!

Original thread: https://box2d.org/forum/viewtopic.php?t=8429