42 JPH_INLINE
bool ApplyVelocityStep(
Body &ioBody1,
Body &ioBody2,
float inLambda)
const
81 mEffectiveMass = 1.0f / (inWorldSpaceHingeAxis1.
Dot(mInvI1_A) + inWorldSpaceHingeAxis2.
Dot(mInvI2_B) *
Square(inRatio));
87 mEffectiveMass = 0.0f;
94 return mEffectiveMass != 0.0f;
103 mTotalLambda *= inWarmStartImpulseRatio;
104 ApplyVelocityStep(ioBody1, ioBody2, mTotalLambda);
119 mTotalLambda += lambda;
121 return ApplyVelocityStep(ioBody1, ioBody2, lambda);
145 float lambda = -mEffectiveMass * inBaumgarte * inC;
175 inStream.
Write(mTotalLambda);
181 inStream.
Read(mTotalLambda);
187 float mEffectiveMass = 0.0f;
188 float mTotalLambda = 0.0f;
#define JPH_NAMESPACE_END
Definition Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
constexpr T Square(T inV)
Square a value.
Definition Math.h:52
const MotionProperties * GetMotionProperties() const
Access to the motion properties.
Definition Body.h:205
bool IsDynamic() const
Check if this body is dynamic, which means that it moves and forces can act on it.
Definition Body.h:56
void AddRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Update rotation using an Euler step (using during position integrate & constraint solving)
Definition Body.inl:75
Quat GetRotation() const
World space rotation of the body.
Definition Body.h:187
Vec3 GetAngularVelocity() const
Get world space angular velocity of the center of mass (unit: rad/s)
Definition Body.h:118
Definition GearConstraintPart.h:40
float GetTotalLambda() const
Return lagrange multiplier.
Definition GearConstraintPart.h:125
void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
Definition GearConstraintPart.h:101
bool SolveVelocityConstraint(Body &ioBody1, Vec3Arg inWorldSpaceHingeAxis1, Body &ioBody2, Vec3Arg inWorldSpaceHingeAxis2, float inRatio)
Definition GearConstraintPart.h:113
bool IsActive() const
Check if constraint is active.
Definition GearConstraintPart.h:92
void CalculateConstraintProperties(const Body &inBody1, Vec3Arg inWorldSpaceHingeAxis1, const Body &inBody2, Vec3Arg inWorldSpaceHingeAxis2, float inRatio)
Definition GearConstraintPart.h:69
void Deactivate()
Deactivate this constraint.
Definition GearConstraintPart.h:85
void RestoreState(StateRecorder &inStream)
Restore state of this constraint part.
Definition GearConstraintPart.h:179
bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inC, float inBaumgarte) const
Definition GearConstraintPart.h:135
void SaveState(StateRecorder &inStream) const
Save state of this constraint part.
Definition GearConstraintPart.h:173
JPH_INLINE Vec3 MultiplyWorldSpaceInverseInertiaByVector(QuatArg inBodyRotation, Vec3Arg inV) const
Multiply a vector with the inverse world space inertia tensor ( ). Zero if object is static or kinema...
Definition MotionProperties.inl:90
void AddAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition MotionProperties.h:128
Definition StateRecorder.h:15
void Read(T &outT)
Read a primitive (e.g. float, int, etc.) from the binary stream.
Definition StreamIn.h:27
void Write(const T &inT)
Write a primitive (e.g. float, int, etc.) to the binary stream.
Definition StreamOut.h:24
JPH_INLINE float Dot(Vec3Arg inV2) const
Dot product.
Definition Vec3.inl:637
JPH_INLINE bool IsNormalized(float inTolerance=1.0e-6f) const
Test if vector is normalized.
Definition Vec3.inl:737