|
template<EMotionType Type1, EMotionType Type2> |
JPH_INLINE void | TemplatedCalculateConstraintProperties (float inDeltaTime, const MotionProperties *inMotionProperties1, Mat44Arg inInvI1, Vec3Arg inR1PlusU, const MotionProperties *inMotionProperties2, Mat44Arg inInvI2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f, float inC=0.0f, float inFrequency=0.0f, float inDamping=0.0f) |
| Templated form of CalculateConstraintProperties with the motion types baked in.
|
|
void | CalculateConstraintProperties (float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f, float inC=0.0f, float inFrequency=0.0f, float inDamping=0.0f) |
|
void | Deactivate () |
| Deactivate this constraint.
|
|
bool | IsActive () const |
| Check if constraint is active.
|
|
template<EMotionType Type1, EMotionType Type2> |
void | TemplatedWarmStart (MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio) |
| Templated form of WarmStart with the motion types baked in.
|
|
void | WarmStart (Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inWarmStartImpulseRatio) |
|
template<EMotionType Type1, EMotionType Type2> |
bool | TemplatedSolveVelocityConstraint (MotionProperties *ioMotionProperties1, MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda) |
| Templated form of SolveVelocityConstraint with the motion types baked in.
|
|
bool | SolveVelocityConstraint (Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda) |
|
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const |
|
void | SetTotalLambda (float inLambda) |
| Override total lagrange multiplier, can be used to set the initial value for warm starting.
|
|
float | 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.
|
|
Constraint that constrains motion along 1 axis
- See also
- "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.1.1 (we're not using the approximation of eq 27 but instead add the U term as in eq 55)
Constraint equation (eq 25):
\[C = (p_2 - p_1) \cdot n\]
Jacobian (eq 28):
\[J = \begin{bmatrix} -n^T & (-(r_1 + u) \times n)^T & n^T & (r_2 \times n)^T \end{bmatrix}\]
Used terms (here and below, everything in world space):
n = 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.