Jolt Physics
A multi core friendly Game Physics Engine
|
#include <SwingTwistConstraintPart.h>
Public Member Functions | |
void | SetSwingType (ESwingType inSwingType) |
Override the swing type. | |
ESwingType | GetSwingType () const |
Get the swing type for this part. | |
void | SetLimits (float inTwistMinAngle, float inTwistMaxAngle, float inSwingYMinAngle, float inSwingYMaxAngle, float inSwingZMinAngle, float inSwingZMaxAngle) |
Set limits for this constraint (see description above for parameters) | |
void | ClampSwingTwist (Quat &ioSwing, Quat &ioTwist, uint &outClampedAxis) const |
Clamp twist and swing against the constraint limits, returns which parts were clamped (everything assumed in constraint space) | |
void | CalculateConstraintProperties (const Body &inBody1, const Body &inBody2, QuatArg inConstraintRotation, QuatArg inConstraintToWorld) |
void | Deactivate () |
Deactivate this constraint. | |
bool | IsActive () const |
Check if constraint is active. | |
void | WarmStart (Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio) |
Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses. | |
bool | SolveVelocityConstraint (Body &ioBody1, Body &ioBody2) |
Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation. | |
bool | SolvePositionConstraint (Body &ioBody1, Body &ioBody2, QuatArg inConstraintRotation, QuatArg inConstraintToBody1, QuatArg inConstraintToBody2, float inBaumgarte) const |
float | GetTotalSwingYLambda () const |
Return lagrange multiplier for swing. | |
float | GetTotalSwingZLambda () const |
float | GetTotalTwistLambda () const |
Return lagrange multiplier for twist. | |
void | SaveState (StateRecorder &inStream) const |
Save state of this constraint part. | |
void | RestoreState (StateRecorder &inStream) |
Restore state of this constraint part. | |
Static Public Member Functions | |
static JPH_INLINE bool | sDistanceToMinShorter (float inDeltaMin, float inDeltaMax) |
Helper function to determine if we're clamped against the min or max limit. | |
Static Public Attributes | |
static constexpr uint | cClampedTwistMin = 1 << 0 |
Flags to indicate which axis got clamped by ClampSwingTwist. | |
static constexpr uint | cClampedTwistMax = 1 << 1 |
static constexpr uint | cClampedSwingYMin = 1 << 2 |
static constexpr uint | cClampedSwingYMax = 1 << 3 |
static constexpr uint | cClampedSwingZMin = 1 << 4 |
static constexpr uint | cClampedSwingZMax = 1 << 5 |
Quaternion based constraint that decomposes the rotation in constraint space in swing and twist: q = q_swing * q_twist where q_swing.x = 0 and where q_twist.y = q_twist.z = 0
(q_swing.y / sin(inSwingYHalfAngle / 2))^2 + (q_swing.z / sin(inSwingZHalfAngle / 2))^2 <= 1
Which roughly corresponds to an elliptic cone shape with major axis (inSwingYHalfAngle, inSwingZHalfAngle).
In case inSwingYHalfAngle = 0, the rotation around Y will be constrained to 0 and the rotation around Z will be constrained between [-inSwingZHalfAngle, inSwingZHalfAngle]. Vice versa if inSwingZHalfAngle = 0.
|
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 |
inConstraintRotation | The current rotation of the constraint in constraint space |
inConstraintToWorld | Rotates from constraint space into world space |
|
inline |
Clamp twist and swing against the constraint limits, returns which parts were clamped (everything assumed in constraint space)
|
inline |
Deactivate this constraint.
|
inline |
Get the swing type for this part.
|
inline |
Return lagrange multiplier for swing.
|
inline |
|
inline |
Return lagrange multiplier for twist.
|
inline |
Check if constraint is active.
|
inline |
Restore state of this constraint part.
|
inline |
Save state of this constraint part.
|
inlinestatic |
Helper function to determine if we're clamped against the min or max limit.
|
inline |
Set limits for this constraint (see description above for parameters)
|
inline |
Override the swing type.
|
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 |
inConstraintRotation | The current rotation of the constraint in constraint space |
inConstraintToBody1,inConstraintToBody2 | Rotates from constraint space to body 1/2 space |
inBaumgarte | Baumgarte constant (fraction of the error to correct) |
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.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Flags to indicate which axis got clamped by ClampSwingTwist.