|
void | CalculateConstraintProperties (const Body &inBody1, Mat44Arg inRotation1, Vec3Arg inR1PlusU, const Body &inBody2, Mat44Arg inRotation2, Vec3Arg inR2, Vec3Arg inN1, Vec3Arg inN2) |
|
void | Deactivate () |
| Deactivate this constraint. More...
|
|
bool | IsActive () const |
| Check if constraint is active. More...
|
|
void | WarmStart (Body &ioBody1, Body &ioBody2, Vec3Arg inN1, Vec3Arg inN2, float inWarmStartImpulseRatio) |
|
bool | SolveVelocityConstraint (Body &ioBody1, Body &ioBody2, Vec3Arg inN1, Vec3Arg inN2) |
|
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, Vec3Arg inU, Vec3Arg inN1, Vec3Arg inN2, float inBaumgarte) const |
|
void | SetTotalLambda (const Vec2 &inLambda) |
| Override total lagrange multiplier, can be used to set the initial value for warm starting. More...
|
|
const Vec2 & | GetTotalLambda () const |
| Return lagrange multiplier. More...
|
|
void | SaveState (StateRecorder &inStream) const |
| Save state of this constraint part. More...
|
|
void | RestoreState (StateRecorder &inStream) |
| Restore state of this constraint part. More...
|
|
Constrains movement on 2 axis
- See also
- "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.3.1
Constraint equation (eq 51):
\[C = \begin{bmatrix} (p_2 - p_1) \cdot n_1 \\ (p_2 - p_1) \cdot n_2\end{bmatrix}\]
Jacobian (transposed) (eq 55):
\[J^T = \begin{bmatrix}
-n_1 & -n_2 \\
-(r_1 + u) \times n_1 & -(r_1 + u) \times n_2 \\
n_1 & n_2 \\
r_2 \times n_1 & r_2 \times n_2
\end{bmatrix}\]
Used terms (here and below, everything in world space):
n1, n2 = constraint axis (normalized).
p1, p2 = constraint points.
r1 = p1 - x1.
r2 = p2 - x2.
u = x2 + r2 - x1 - r1 = p2 - p1.
x1, x2 = center of mass for the bodies.
v = [v1, w1, v2, w2].
v1, v2 = linear velocity of body 1 and 2.
w1, w2 = angular velocity of body 1 and 2.
M = mass matrix, a diagonal matrix of the mass and inertia with diagonal [m1, I1, m2, I2].
\(K^{-1} = \left( J M^{-1} J^T \right)^{-1}\) = effective mass.
b = velocity bias.
\(\beta\) = baumgarte constant.