|
void | CalculateConstraintProperties (const Body &inBody1, Mat44Arg inRotation1, Vec3Arg inWorldSpaceHingeAxis1, const Body &inBody2, Mat44Arg inRotation2, Vec3Arg inWorldSpaceHingeAxis2) |
| Calculate properties used during the functions below.
|
|
void | Deactivate () |
| Deactivate this constraint.
|
|
void | WarmStart (Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio) |
| Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses.
|
|
bool | SolveVelocityConstraint (Body &ioBody1, Body &ioBody2) |
| Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
|
|
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, float inBaumgarte) const |
| Iteratively update the position constraint. Makes sure C(...) = 0.
|
|
const Vec2 & | GetTotalLambda () const |
| Return lagrange multiplier.
|
|
void | SaveState (StateRecorder &inStream) const |
| Save state of this constraint part.
|
|
void | RestoreState (StateRecorder &inStream) |
| Restore state of this constraint part.
|
|
Constrains rotation around 2 axis so that it only allows rotation around 1 axis
Based on: "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.4.1
Constraint equation (eq 87):
\[C = \begin{bmatrix}a_1 \cdot b_2 \\ a_1 \cdot c_2\end{bmatrix}\]
Jacobian (eq 90):
\[J = \begin{bmatrix}
0 & -b_2 \times a_1 & 0 & b_2 \times a_1 \\
0 & -c_2 \times a_1 & 0 & c2 \times a_1
\end{bmatrix}\]
Used terms (here and below, everything in world space):
a1 = hinge axis on body 1.
b2, c2 = axis perpendicular to hinge axis on body 2.
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.
E = identity matrix.