|
@@ -76,6 +76,10 @@ public:
|
|
|
/// Get inverse mass (1 / mass). Should only be called on a dynamic object (static or kinematic bodies have infinite mass so should be treated as 1 / mass = 0)
|
|
|
inline float GetInverseMass() const { JPH_ASSERT(mCachedMotionType == EMotionType::Dynamic); return mInvMass; }
|
|
|
inline float GetInverseMassUnchecked() const { return mInvMass; }
|
|
|
+
|
|
|
+ /// Set the inverse mass (1 / mass).
|
|
|
+ /// Note that mass and inertia are linearly related (e.g. inertia of a sphere with mass m and radius r is \f$2/5 \: m \: r^2\f$).
|
|
|
+ /// If you change mass, inertia should probably change as well. See MassProperties::ScaleToMass.
|
|
|
void SetInverseMass(float inInverseMass) { mInvMass = inInverseMass; }
|
|
|
|
|
|
/// Diagonal of inverse inertia matrix: D. Should only be called on a dynamic object (static or kinematic bodies have infinite mass so should be treated as D = 0)
|
|
@@ -84,7 +88,9 @@ public:
|
|
|
/// Rotation (R) that takes inverse inertia diagonal to local space: \f$I_{body}^{-1} = R \: D \: R^{-1}\f$
|
|
|
inline Quat GetInertiaRotation() const { return mInertiaRotation; }
|
|
|
|
|
|
- /// Set the inverse inertia tensor in local space by setting the diagonal and the rotation: \f$I_{body}^{-1} = R \: D \: R^{-1}\f$
|
|
|
+ /// Set the inverse inertia tensor in local space by setting the diagonal and the rotation: \f$I_{body}^{-1} = R \: D \: R^{-1}\f$.
|
|
|
+ /// Note that mass and inertia are linearly related (e.g. inertia of a sphere with mass m and radius r is \f$2/5 \: m \: r^2\f$).
|
|
|
+ /// If you change inertia, mass should probably change as well. See MassProperties::ScaleToMass.
|
|
|
void SetInverseInertia(Vec3Arg inDiagonal, QuatArg inRot) { mInvInertiaDiagonal = inDiagonal; mInertiaRotation = inRot; }
|
|
|
|
|
|
/// Get inverse inertia matrix (\f$I_{body}^{-1}\f$). Will be a matrix of zeros for a static or kinematic object.
|