|
template<EMotionType Type1, EMotionType Type2> |
JPH_INLINE void | TemplatedCalculateConstraintProperties (float inInvMass1, Mat44Arg inInvI1, Vec3Arg inR1PlusU, float inInvMass2, Mat44Arg inInvI2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f) |
| Templated form of CalculateConstraintProperties with the motion types baked in.
|
|
void | CalculateConstraintProperties (const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f) |
|
void | CalculateConstraintPropertiesWithMassOverride (const Body &inBody1, float inInvMass1, float inInvInertiaScale1, Vec3Arg inR1PlusU, const Body &inBody2, float inInvMass2, float inInvInertiaScale2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias=0.0f) |
|
void | CalculateConstraintPropertiesWithFrequencyAndDamping (float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inFrequency, float inDamping) |
|
void | CalculateConstraintPropertiesWithStiffnessAndDamping (float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, float inStiffness, float inDamping) |
|
void | CalculateConstraintPropertiesWithSettings (float inDeltaTime, const Body &inBody1, Vec3Arg inR1PlusU, const Body &inBody2, Vec3Arg inR2, Vec3Arg inWorldSpaceAxis, float inBias, float inC, const SpringSettings &inSpringSettings) |
| Selects one of the above functions based on the spring settings.
|
|
void | Deactivate () |
| Deactivate this constraint.
|
|
bool | IsActive () const |
| Check if constraint is active.
|
|
template<EMotionType Type1, EMotionType Type2> |
void | TemplatedWarmStart (MotionProperties *ioMotionProperties1, float inInvMass1, MotionProperties *ioMotionProperties2, float inInvMass2, 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> |
JPH_INLINE float | TemplatedSolveVelocityConstraintGetTotalLambda (const MotionProperties *ioMotionProperties1, const MotionProperties *ioMotionProperties2, Vec3Arg inWorldSpaceAxis) const |
| Templated form of SolveVelocityConstraint with the motion types baked in, part 1: get the total lambda.
|
|
template<EMotionType Type1, EMotionType Type2> |
JPH_INLINE bool | TemplatedSolveVelocityConstraintApplyLambda (MotionProperties *ioMotionProperties1, float inInvMass1, MotionProperties *ioMotionProperties2, float inInvMass2, Vec3Arg inWorldSpaceAxis, float inTotalLambda) |
| Templated form of SolveVelocityConstraint with the motion types baked in, part 2: apply new lambda.
|
|
template<EMotionType Type1, EMotionType Type2> |
bool | TemplatedSolveVelocityConstraint (MotionProperties *ioMotionProperties1, float inInvMass1, MotionProperties *ioMotionProperties2, float inInvMass2, 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 | SolveVelocityConstraintWithMassOverride (Body &ioBody1, float inInvMass1, Body &ioBody2, float inInvMass2, Vec3Arg inWorldSpaceAxis, float inMinLambda, float inMaxLambda) |
|
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, Vec3Arg inWorldSpaceAxis, float inC, float inBaumgarte) const |
|
bool | SolvePositionConstraintWithMassOverride (Body &ioBody1, float inInvMass1, Body &ioBody2, float inInvMass2, 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.