Jolt Physics
A multi core friendly Game Physics Engine
|
#include <RotationEulerConstraintPart.h>
Public Member Functions | |
void | CalculateConstraintProperties (const Body &inBody1, Mat44Arg inRotation1, const Body &inBody2, Mat44Arg inRotation2) |
Calculate properties used during the functions below. More... | |
void | Deactivate () |
Deactivate this constraint. More... | |
bool | IsActive () const |
Check if constraint is active. More... | |
void | WarmStart (Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio) |
Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses. More... | |
bool | SolveVelocityConstraint (Body &ioBody1, Body &ioBody2) |
Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation. More... | |
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const |
Iteratively update the position constraint. Makes sure C(...) = 0. More... | |
Vec3 | 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... | |
Static Public Member Functions | |
static Quat | sGetInvInitialOrientation (const Body &inBody1, const Body &inBody2) |
Return inverse of initial rotation from body 1 to body 2 in body 1 space. More... | |
static Quat | sGetInvInitialOrientationXY (Vec3Arg inAxisX1, Vec3Arg inAxisY1, Vec3Arg inAxisX2, Vec3Arg inAxisY2) |
Return inverse of initial rotation from body 1 to body 2 in body 1 space. More... | |
static Quat | sGetInvInitialOrientationXZ (Vec3Arg inAxisX1, Vec3Arg inAxisZ1, Vec3Arg inAxisX2, Vec3Arg inAxisZ2) |
Return inverse of initial rotation from body 1 to body 2 in body 1 space. More... | |
Constrains rotation around all axis so that only translation is allowed
Based on: "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.5.1
Constraint equation (eq 129):
\[C = \begin{bmatrix}\Delta\theta_x, \Delta\theta_y, \Delta\theta_z\end{bmatrix}\]
Jacobian (eq 131):
\[J = \begin{bmatrix}0 & -E & 0 & E\end{bmatrix}\]
Used terms (here and below, everything in world space):
delta_theta_* = difference in rotation between initial rotation of bodies 1 and 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.
|
inline |
Calculate properties used during the functions below.
|
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.
|
inlinestatic |
Return inverse of initial rotation from body 1 to body 2 in body 1 space.
|
inlinestatic |
Return inverse of initial rotation from body 1 to body 2 in body 1 space.
inAxisX1 | Reference axis X for body 1 |
inAxisY1 | Reference axis Y for body 1 |
inAxisX2 | Reference axis X for body 2 |
inAxisY2 | Reference axis Y for body 2 |
|
inlinestatic |
Return inverse of initial rotation from body 1 to body 2 in body 1 space.
inAxisX1 | Reference axis X for body 1 |
inAxisZ1 | Reference axis Z for body 1 |
inAxisX2 | Reference axis X for body 2 |
inAxisZ2 | Reference axis Z for body 2 |
|
inline |
Iteratively update the position constraint. Makes sure C(...) = 0.
Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
|
inline |
Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses.