82#ifdef JPH_DEBUG_RENDERER
149 inline Vec3 GetTotalLambdaMotor()
const {
return Vec3(mMotorConstraintPart[0].GetTotalLambda(), mMotorConstraintPart[1].GetTotalLambda(), mMotorConstraintPart[2].GetTotalLambda()); }
158 Vec3 mLocalSpacePosition1;
159 Vec3 mLocalSpacePosition2;
162 Quat mConstraintToBody1;
163 Quat mConstraintToBody2;
166 float mNormalHalfConeAngle;
167 float mPlaneHalfConeAngle;
168 float mTwistMinAngle;
169 float mTwistMaxAngle;
172 float mMaxFrictionTorque;
185 Vec3 mWorldSpaceMotorAxis[3];
EConstraintSpace
Certain constraints support setting them up in local or world space. This governs what is used.
Definition Constraint.h:58
@ WorldSpace
All constraint properties are specified in world space.
EConstraintSubType
Enum to identify constraint sub type.
Definition Constraint.h:34
#define JPH_NAMESPACE_END
Definition Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:29
EMotorState
Definition MotorSettings.h:16
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(class_name)
Definition SerializableObject.h:100
Definition AngleConstraintPart.h:36
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
Simple triangle renderer for debugging purposes.
Definition DebugRenderer.h:25
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
static JPH_INLINE Mat44 sRotationTranslation(QuatArg inR, Vec3Arg inT)
Get matrix that rotates and translates.
Definition Mat44.inl:149
Definition MotorSettings.h:25
Definition PointConstraintPart.h:41
Vec3 GetTotalLambda() const
Return lagrange multiplier.
Definition PointConstraintPart.h:199
static JPH_INLINE Quat sIdentity()
Definition Quat.h:93
JPH_INLINE Quat Conjugated() const
The conjugate [w, -x, -y, -z] is the same as the inverse for unit quaternions.
Definition Quat.h:168
Definition Reference.h:101
Definition StateRecorder.h:15
Simple binary input stream.
Definition StreamIn.h:11
Simple binary output stream.
Definition StreamOut.h:11
Definition SwingTwistConstraint.h:68
void SetPlaneHalfConeAngle(float inAngle)
Definition SwingTwistConstraint.h:104
void SetSwingMotorState(EMotorState inState)
Controls if the motors are on or off.
Definition SwingTwistConstraint.cpp:153
float GetNormalHalfConeAngle() const
Definition SwingTwistConstraint.h:101
void SetTwistMinAngle(float inAngle)
Definition SwingTwistConstraint.h:106
float GetTotalLambdaSwingY() const
Definition SwingTwistConstraint.h:147
float GetTwistMaxAngle() const
Definition SwingTwistConstraint.h:107
virtual EConstraintSubType GetSubType() const override
Get the sub type of a constraint.
Definition SwingTwistConstraint.h:76
virtual Mat44 GetConstraintToBody2Matrix() const override
Calculates the transform that transforms from constraint space to body 2 space. The first column of t...
Definition SwingTwistConstraint.h:92
float GetTotalLambdaSwingZ() const
Definition SwingTwistConstraint.h:148
void SetTargetAngularVelocityCS(Vec3Arg inAngularVelocity)
Set the target angular velocity of body 2 in constraint space of body 2.
Definition SwingTwistConstraint.h:129
Vec3 GetTotalLambdaMotor() const
Definition SwingTwistConstraint.h:149
EMotorState GetTwistMotorState() const
Definition SwingTwistConstraint.h:126
Quat GetConstraintToBody1() const
Definition SwingTwistConstraint.h:97
virtual bool SolvePositionConstraint(float inDeltaTime, float inBaumgarte) override
Definition SwingTwistConstraint.cpp:384
void SetTwistMaxAngle(float inAngle)
Definition SwingTwistConstraint.h:108
virtual void SetupVelocityConstraint(float inDeltaTime) override
Definition SwingTwistConstraint.cpp:194
void SetNormalHalfConeAngle(float inAngle)
Definition SwingTwistConstraint.h:102
Vec3 GetLocalSpacePosition1() const
Definition SwingTwistConstraint.h:95
const MotorSettings & GetSwingMotorSettings() const
Definition SwingTwistConstraint.h:111
float GetPlaneHalfConeAngle() const
Definition SwingTwistConstraint.h:103
float GetMaxFrictionTorque() const
Definition SwingTwistConstraint.h:118
JPH_OVERRIDE_NEW_DELETE SwingTwistConstraint(Body &inBody1, Body &inBody2, const SwingTwistConstraintSettings &inSettings)
Construct swing twist constraint.
Definition SwingTwistConstraint.cpp:89
Quat GetConstraintToBody2() const
Definition SwingTwistConstraint.h:98
virtual void DrawConstraint(DebugRenderer *inRenderer) const override
Definition SwingTwistConstraint.cpp:400
Vec3 GetTargetAngularVelocityCS() const
Definition SwingTwistConstraint.h:130
virtual void DrawConstraintLimits(DebugRenderer *inRenderer) const override
Definition SwingTwistConstraint.cpp:433
Vec3 GetTotalLambdaPosition() const
Definition SwingTwistConstraint.h:145
void SetTargetOrientationBS(QuatArg inOrientation)
Definition SwingTwistConstraint.h:138
void SetTargetOrientationCS(QuatArg inOrientation)
Set the target orientation in constraint space (drives constraint to: GetRotationInConstraintSpace() ...
Definition SwingTwistConstraint.cpp:180
Vec3 GetLocalSpacePosition2() const
Definition SwingTwistConstraint.h:96
Quat GetTargetOrientationCS() const
Definition SwingTwistConstraint.h:134
virtual void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inDeltaCOM) override
Definition SwingTwistConstraint.cpp:127
virtual Mat44 GetConstraintToBody1Matrix() const override
Calculates the transform that transforms from constraint space to body 1 space. The first column of t...
Definition SwingTwistConstraint.h:91
virtual void RestoreState(StateRecorder &inStream) override
Restoring state for replay.
Definition SwingTwistConstraint.cpp:459
void SetMaxFrictionTorque(float inFrictionTorque)
Definition SwingTwistConstraint.h:117
virtual void WarmStartVelocityConstraint(float inWarmStartImpulseRatio) override
Definition SwingTwistConstraint.cpp:315
virtual Ref< ConstraintSettings > GetConstraintSettings() const override
Debug function to convert a constraint to its settings, note that this will not save to which bodies ...
Definition SwingTwistConstraint.cpp:474
MotorSettings & GetSwingMotorSettings()
Definition SwingTwistConstraint.h:112
Quat GetRotationInConstraintSpace() const
Definition SwingTwistConstraint.cpp:135
float GetTwistMinAngle() const
Definition SwingTwistConstraint.h:105
const MotorSettings & GetTwistMotorSettings() const
Definition SwingTwistConstraint.h:113
void SetTwistMotorState(EMotorState inState)
Definition SwingTwistConstraint.cpp:167
virtual bool SolveVelocityConstraint(float inDeltaTime) override
Definition SwingTwistConstraint.cpp:324
MotorSettings & GetTwistMotorSettings()
Definition SwingTwistConstraint.h:114
virtual void SaveState(StateRecorder &inStream) const override
Saving state for replay.
Definition SwingTwistConstraint.cpp:444
float GetTotalLambdaTwist() const
Definition SwingTwistConstraint.h:146
EMotorState GetSwingMotorState() const
Definition SwingTwistConstraint.h:124
Definition SwingTwistConstraintPart.h:26
float GetTotalSwingYLambda() const
Return lagrange multiplier for swing.
Definition SwingTwistConstraintPart.h:394
float GetTotalSwingZLambda() const
Definition SwingTwistConstraintPart.h:399
float GetTotalTwistLambda() const
Return lagrange multiplier for twist.
Definition SwingTwistConstraintPart.h:405
Definition SwingTwistConstraint.h:21
RVec3 mPosition2
Definition SwingTwistConstraint.h:40
float mTwistMinAngle
See image. Angle in radians. Rotation will be limited between [mLimitsMin, mLimitsMax] where mLimitsM...
Definition SwingTwistConstraint.h:49
Vec3 mPlaneAxis1
Definition SwingTwistConstraint.h:37
RVec3 mPosition1
Definition SwingTwistConstraint.h:35
MotorSettings mSwingMotorSettings
Definition SwingTwistConstraint.h:56
float mNormalHalfConeAngle
See image. Angle in radians.
Definition SwingTwistConstraint.h:45
virtual void SaveBinaryState(StreamOut &inStream) const override
Saves the contents of the constraint settings in binary form to inStream.
Definition SwingTwistConstraint.cpp:38
MotorSettings mTwistMotorSettings
Definition SwingTwistConstraint.h:57
EConstraintSpace mSpace
This determines in which space the constraint is setup, all properties below should be in the specifi...
Definition SwingTwistConstraint.h:32
float mTwistMaxAngle
See image. Angle in radians.
Definition SwingTwistConstraint.h:50
Vec3 mPlaneAxis2
Definition SwingTwistConstraint.h:42
float mPlaneHalfConeAngle
See image. Angle in radians.
Definition SwingTwistConstraint.h:46
Vec3 mTwistAxis2
Definition SwingTwistConstraint.h:41
virtual void RestoreBinaryState(StreamIn &inStream) override
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition SwingTwistConstraint.cpp:58
virtual TwoBodyConstraint * Create(Body &inBody1, Body &inBody2) const override
Create an an instance of this constraint.
Definition SwingTwistConstraint.cpp:78
float mMaxFrictionTorque
Maximum amount of torque (N m) to apply as friction when the constraint is not powered by a motor.
Definition SwingTwistConstraint.h:53
Vec3 mTwistAxis1
Definition SwingTwistConstraint.h:36
Base class for all constraints that involve 2 bodies. Body1 is usually considered the parent,...
Definition TwoBodyConstraint.h:27
Base class for settings for all constraints that involve 2 bodies.
Definition TwoBodyConstraint.h:16
static JPH_INLINE Vec3 sAxisX()
Vectors with the principal axis.
Definition Vec3.h:51
static JPH_INLINE Vec3 sAxisY()
Definition Vec3.h:52
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107