42 JPH_INLINE
bool ApplyVelocityStep(
Body &ioBody1,
Body &ioBody2,
float inLambda)
const
79 mRatio_InvM2_B = inRatio * inv_m2 * inWorldSpaceSliderAxis;
82 mEffectiveMass = 1.0f / (inWorldSpaceHingeAxis.
Dot(mInvI1_A) + inv_m2 *
Square(inRatio));
88 mEffectiveMass = 0.0f;
95 return mEffectiveMass != 0.0f;
104 mTotalLambda *= inWarmStartImpulseRatio;
105 ApplyVelocityStep(ioBody1, ioBody2, mTotalLambda);
120 mTotalLambda += lambda;
122 return ApplyVelocityStep(ioBody1, ioBody2, lambda);
146 float lambda = -mEffectiveMass * inBaumgarte * inC;
176 inStream.
Write(mTotalLambda);
182 inStream.
Read(mTotalLambda);
188 float mEffectiveMass = 0.0f;
189 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
void SubPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)
Definition Body.h:237
Vec3 GetLinearVelocity() const
Get world space linear velocity of the center of mass (unit: m/s)
Definition Body.h:109
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
void SubLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition MotionProperties.h:127
float GetInverseMass() const
Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies ha...
Definition MotionProperties.h:80
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 RackAndPinionConstraintPart.h:40
void CalculateConstraintProperties(const Body &inBody1, Vec3Arg inWorldSpaceHingeAxis, const Body &inBody2, Vec3Arg inWorldSpaceSliderAxis, float inRatio)
Definition RackAndPinionConstraintPart.h:69
bool SolveVelocityConstraint(Body &ioBody1, Vec3Arg inWorldSpaceHingeAxis, Body &ioBody2, Vec3Arg inWorldSpaceSliderAxis, float inRatio)
Definition RackAndPinionConstraintPart.h:114
float GetTotalLambda() const
Return lagrange multiplier.
Definition RackAndPinionConstraintPart.h:126
void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
Definition RackAndPinionConstraintPart.h:102
void SaveState(StateRecorder &inStream) const
Save state of this constraint part.
Definition RackAndPinionConstraintPart.h:174
bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inC, float inBaumgarte) const
Definition RackAndPinionConstraintPart.h:136
void RestoreState(StateRecorder &inStream)
Restore state of this constraint part.
Definition RackAndPinionConstraintPart.h:180
void Deactivate()
Deactivate this constraint.
Definition RackAndPinionConstraintPart.h:86
bool IsActive() const
Check if constraint is active.
Definition RackAndPinionConstraintPart.h:93
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