42 JPH_INLINE
bool ApplyVelocityStep(
Body &ioBody1,
Body &ioBody2,
Vec3Arg inLambda)
const
88 float summed_inv_mass;
89 Mat44 inv_effective_mass;
98 inv_effective_mass = r1x.
Multiply3x3(inv_i1).Multiply3x3RightTransposed(r1x);
104 summed_inv_mass = 0.0f;
116 inv_effective_mass += r2x.
Multiply3x3(inv_i2).Multiply3x3RightTransposed(r2x);
138 return mEffectiveMass(3, 3) != 0.0f;
147 mTotalLambda *= inWarmStartImpulseRatio;
148 ApplyVelocityStep(ioBody1, ioBody2, mTotalLambda);
160 mTotalLambda += lambda;
161 return ApplyVelocityStep(ioBody1, ioBody2, lambda);
178 Vec3 lambda = mEffectiveMass * -inBaumgarte * separation;
221 inStream.
Write(mTotalLambda);
227 inStream.
Read(mTotalLambda);
235 Mat44 mEffectiveMass;
#define JPH_IF_DEBUG(...)
Definition Core.h:510
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
const MotionProperties * GetMotionProperties() const
Access to the motion properties.
Definition Body.h:285
RVec3 GetCenterOfMassPosition() const
Gets the world space position of this body's center of mass.
Definition Body.h:273
bool IsDynamic() const
Check if this body is dynamic, which means that it moves and forces can act on it.
Definition Body.h:63
void AddRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Update rotation using an Euler step (used during position integrate & constraint solving)
Definition Body.inl:81
void SubPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)
Definition Body.h:320
Vec3 GetLinearVelocity() const
Get world space linear velocity of the center of mass (unit: m/s)
Definition Body.h:146
void SubRotationStep(Vec3Arg inAngularVelocityTimesDeltaTime)
Definition Body.inl:100
Vec3 GetAngularVelocity() const
Get world space angular velocity of the center of mass (unit: rad/s)
Definition Body.h:157
void AddPositionStep(Vec3Arg inLinearVelocityTimesDeltaTime)
Update position using an Euler step (used during position integrate & constraint solving)
Definition Body.h:319
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 sZero()
Zero matrix.
Definition Mat44.inl:30
static JPH_INLINE Mat44 sCrossProduct(Vec3Arg inV)
Get matrix that represents a cross product .
Definition Mat44.inl:179
static JPH_INLINE Mat44 sNaN()
Matrix filled with NaN's.
Definition Mat44.inl:40
JPH_INLINE bool SetInversed3x3(Mat44Arg inM)
*this = inM.Inversed3x3(), returns false if the matrix is singular in which case *this is unchanged
Definition Mat44.inl:767
static JPH_INLINE Mat44 sScale(float inScale)
Get matrix that scales uniformly.
Definition Mat44.inl:163
JPH_INLINE Vec3 Multiply3x3(Vec3Arg inV) const
Multiply vector by only 3x3 part of the matrix.
Definition Mat44.inl:316
The Body class only keeps track of state for static bodies, the MotionProperties class keeps the addi...
Definition MotionProperties.h:29
void AddLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition MotionProperties.h:195
void SubLinearVelocityStep(Vec3Arg inLinearVelocityChange)
Definition MotionProperties.h:196
float GetInverseMass() const
Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies ha...
Definition MotionProperties.h:95
void SubAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition MotionProperties.h:198
Mat44 GetInverseInertiaForRotation(Mat44Arg inRotation) const
Get inverse inertia matrix ( ) for a given object rotation (translation will be ignored)....
Definition MotionProperties.inl:69
void AddAngularVelocityStep(Vec3Arg inAngularVelocityChange)
Definition MotionProperties.h:197
Definition PointConstraintPart.h:41
void RestoreState(StateRecorder &inStream)
Restore state of this constraint part.
Definition PointConstraintPart.h:225
bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte) const
Definition PointConstraintPart.h:168
bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)
Definition PointConstraintPart.h:154
Vec3 GetTotalLambda() const
Return lagrange multiplier.
Definition PointConstraintPart.h:213
void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
Definition PointConstraintPart.h:145
void Deactivate()
Deactivate this constraint.
Definition PointConstraintPart.h:129
bool IsActive() const
Check if constraint is active.
Definition PointConstraintPart.h:136
void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, Vec3Arg inR1, const Body &inBody2, Mat44Arg inRotation2, Vec3Arg inR2)
Definition PointConstraintPart.h:80
void SaveState(StateRecorder &inStream) const
Save state of this constraint part.
Definition PointConstraintPart.h:219
Definition StateRecorder.h:105
void Read(T &outT)
Read a primitive (e.g. float, int, etc.) from the binary stream.
Definition StreamIn.h:29
void Write(const T &inT)
Write a primitive (e.g. float, int, etc.) to the binary stream.
Definition StreamOut.h:26
JPH_INLINE Vec3 Cross(Vec3Arg inV2) const
Cross product.
Definition Vec3.inl:594
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107