Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
RotationEulerConstraintPart Class Reference

#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...
 

Detailed Description

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.

Member Function Documentation

◆ CalculateConstraintProperties()

void RotationEulerConstraintPart::CalculateConstraintProperties ( const Body inBody1,
Mat44Arg  inRotation1,
const Body inBody2,
Mat44Arg  inRotation2 
)
inline

Calculate properties used during the functions below.

◆ Deactivate()

void RotationEulerConstraintPart::Deactivate ( )
inline

Deactivate this constraint.

◆ GetTotalLambda()

Vec3 RotationEulerConstraintPart::GetTotalLambda ( ) const
inline

Return lagrange multiplier.

◆ IsActive()

bool RotationEulerConstraintPart::IsActive ( ) const
inline

Check if constraint is active.

◆ RestoreState()

void RotationEulerConstraintPart::RestoreState ( StateRecorder inStream)
inline

Restore state of this constraint part.

◆ SaveState()

void RotationEulerConstraintPart::SaveState ( StateRecorder inStream) const
inline

Save state of this constraint part.

◆ sGetInvInitialOrientation()

static Quat RotationEulerConstraintPart::sGetInvInitialOrientation ( const Body inBody1,
const Body inBody2 
)
inlinestatic

Return inverse of initial rotation from body 1 to body 2 in body 1 space.

◆ sGetInvInitialOrientationXY()

static Quat RotationEulerConstraintPart::sGetInvInitialOrientationXY ( Vec3Arg  inAxisX1,
Vec3Arg  inAxisY1,
Vec3Arg  inAxisX2,
Vec3Arg  inAxisY2 
)
inlinestatic

Return inverse of initial rotation from body 1 to body 2 in body 1 space.

Parameters
inAxisX1Reference axis X for body 1
inAxisY1Reference axis Y for body 1
inAxisX2Reference axis X for body 2
inAxisY2Reference axis Y for body 2

◆ sGetInvInitialOrientationXZ()

static Quat RotationEulerConstraintPart::sGetInvInitialOrientationXZ ( Vec3Arg  inAxisX1,
Vec3Arg  inAxisZ1,
Vec3Arg  inAxisX2,
Vec3Arg  inAxisZ2 
)
inlinestatic

Return inverse of initial rotation from body 1 to body 2 in body 1 space.

Parameters
inAxisX1Reference axis X for body 1
inAxisZ1Reference axis Z for body 1
inAxisX2Reference axis X for body 2
inAxisZ2Reference axis Z for body 2

◆ SolvePositionConstraint()

bool RotationEulerConstraintPart::SolvePositionConstraint ( Body ioBody1,
Body ioBody2,
QuatArg  inInvInitialOrientation,
float  inBaumgarte 
) const
inline

Iteratively update the position constraint. Makes sure C(...) = 0.

◆ SolveVelocityConstraint()

bool RotationEulerConstraintPart::SolveVelocityConstraint ( Body ioBody1,
Body ioBody2 
)
inline

Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.

◆ WarmStart()

void RotationEulerConstraintPart::WarmStart ( Body ioBody1,
Body ioBody2,
float  inWarmStartImpulseRatio 
)
inline

Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses.


The documentation for this class was generated from the following file: