8#ifndef JPH_PLATFORM_DOXYGEN
16 JPH_INLINE
void CalculateSpringPropertiesHelper(
float inDeltaTime,
float inInvEffectiveMass,
float inBias,
float inC,
float inStiffness,
float inDamping,
float &outEffectiveMass)
28 mSoftness = 1.0f / (inDeltaTime * (inDamping + inDeltaTime * inStiffness));
33 mBias = inBias + inDeltaTime * inStiffness * mSoftness * inC;
64 outEffectiveMass = 1.0f / (inInvEffectiveMass + mSoftness);
88 outEffectiveMass = 1.0f / inInvEffectiveMass;
90 if (inFrequency > 0.0f)
93 float omega = 2.0f * JPH_PI * inFrequency;
96 float k = outEffectiveMass *
Square(omega);
97 float c = 2.0f * outEffectiveMass * inDamping * omega;
99 CalculateSpringPropertiesHelper(inDeltaTime, inInvEffectiveMass, inBias, inC, k, c, outEffectiveMass);
118 if (inStiffness > 0.0f)
120 CalculateSpringPropertiesHelper(inDeltaTime, inInvEffectiveMass, inBias, inC, inStiffness, inDamping, outEffectiveMass);
124 outEffectiveMass = 1.0f / inInvEffectiveMass;
133 return mSoftness != 0.0f;
137 inline float GetBias(
float inTotalLambda)
const
161 return mSoftness * inTotalLambda + mBias;
166 float mSoftness = 0.0f;
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_MSVC_SUPPRESS_WARNING(w)
Definition Core.h:286
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
JPH_INLINE constexpr T Square(T inV)
Square a value.
Definition Math.h:52
Class used in other constraint parts to calculate the required bias factor in the lagrange multiplier...
Definition SpringPart.h:14
void CalculateSpringPropertiesWithFrequencyAndDamping(float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inFrequency, float inDamping, float &outEffectiveMass)
Definition SpringPart.h:86
void CalculateSpringPropertiesWithStiffnessAndDamping(float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inStiffness, float inDamping, float &outEffectiveMass)
Definition SpringPart.h:116
float GetBias(float inTotalLambda) const
Get total bias b, including supplied bias and bias for spring: lambda = J v + b.
Definition SpringPart.h:137
void CalculateSpringPropertiesWithBias(float inBias)
Definition SpringPart.h:71
bool IsActive() const
Returns if this spring is active.
Definition SpringPart.h:131