![]()  | 
  
    Jolt Physics
    
   A multi core friendly Game Physics Engine 
   | 
 
#include <GearConstraintPart.h>
Public Member Functions | |
| void | CalculateConstraintProperties (const Body &inBody1, Vec3Arg inWorldSpaceHingeAxis1, const Body &inBody2, Vec3Arg inWorldSpaceHingeAxis2, float inRatio) | 
| void | Deactivate () | 
| Deactivate this constraint.  More... | |
| bool | IsActive () const | 
| Check if constraint is active.  More... | |
| void | WarmStart (Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio) | 
| bool | SolveVelocityConstraint (Body &ioBody1, Vec3Arg inWorldSpaceHingeAxis1, Body &ioBody2, Vec3Arg inWorldSpaceHingeAxis2, float inRatio) | 
| float | GetTotalLambda () const | 
| Return lagrange multiplier.  More... | |
| bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, float inC, float inBaumgarte) const | 
| void | SaveState (StateRecorder &inStream) const | 
| Save state of this constraint part.  More... | |
| void | RestoreState (StateRecorder &inStream) | 
| Restore state of this constraint part.  More... | |
Constraint that constrains two rotations using a gear (rotating in opposite direction)
Constraint equation:
C = Rotation1(t) + r Rotation2(t)
Derivative:
d/dt C = 0 <=> w1 . a + r w2 . b = 0
Jacobian:
\[J = \begin{bmatrix}0 & a^T & 0 & r b^T\end{bmatrix}\]
Used terms (here and below, everything in world space):
a = axis around which body 1 rotates (normalized).
b = axis along which body 2 slides (normalized).
Rotation1(t) = rotation around a of body 1.
Rotation2(t) = rotation around b of body 2.
r = ratio between rotation for body 1 and 2.
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.
 \(\beta\) = baumgarte constant. 
      
  | 
  inline | 
Calculate properties used during the functions below
| inBody1 | The first body that this constraint is attached to | 
| inBody2 | The second body that this constraint is attached to | 
| inWorldSpaceHingeAxis1 | The axis around which body 1 rotates | 
| inWorldSpaceHingeAxis2 | The axis around which body 2 rotates | 
| inRatio | The ratio between rotation and translation | 
      
  | 
  inline | 
Deactivate this constraint.
      
  | 
  inline | 
Return lagrange multiplier.
      
  | 
  inline | 
Check if constraint is active.
      
  | 
  inline | 
Restore state of this constraint part.
      
  | 
  inline | 
Save state of this constraint part.
      
  | 
  inline | 
Iteratively update the position constraint. Makes sure C(...) == 0.
| ioBody1 | The first body that this constraint is attached to | 
| ioBody2 | The second body that this constraint is attached to | 
| inC | Value of the constraint equation (C) | 
| inBaumgarte | Baumgarte constant (fraction of the error to correct) | 
      
  | 
  inline | 
Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
| ioBody1 | The first body that this constraint is attached to | 
| ioBody2 | The second body that this constraint is attached to | 
| inWorldSpaceHingeAxis1 | The axis around which body 1 rotates | 
| inWorldSpaceHingeAxis2 | The axis around which body 2 rotates | 
| inRatio | The ratio between rotation and translation | 
      
  | 
  inline | 
Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
| ioBody1 | The first body that this constraint is attached to | 
| ioBody2 | The second body that this constraint is attached to | 
| inWarmStartImpulseRatio | Ratio of new step to old time step (dt_new / dt_old) for scaling the lagrange multiplier of the previous frame |