Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
SpringPart Class Reference

Class used in other constraint parts to calculate the required bias factor in the lagrange multiplier for creating springs. More...

#include <SpringPart.h>

Public Member Functions

void CalculateSpringPropertiesWithBias (float inBias)
 
void CalculateSpringPropertiesWithFrequencyAndDamping (float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inFrequency, float inDamping, float &outEffectiveMass)
 
void CalculateSpringPropertiesWithStiffnessAndDamping (float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inStiffness, float inDamping, float &outEffectiveMass)
 
bool IsActive () const
 Returns if this spring is active. More...
 
float GetBias (float inTotalLambda) const
 Get total bias b, including supplied bias and bias for spring: lambda = J v + b. More...
 

Detailed Description

Class used in other constraint parts to calculate the required bias factor in the lagrange multiplier for creating springs.

Member Function Documentation

◆ CalculateSpringPropertiesWithBias()

void SpringPart::CalculateSpringPropertiesWithBias ( float  inBias)
inline

Turn off the spring and set a bias only

Parameters
inBiasBias term (b) for the constraint impulse: lambda = J v + b

◆ CalculateSpringPropertiesWithFrequencyAndDamping()

void SpringPart::CalculateSpringPropertiesWithFrequencyAndDamping ( float  inDeltaTime,
float  inInvEffectiveMass,
float  inBias,
float  inC,
float  inFrequency,
float  inDamping,
float &  outEffectiveMass 
)
inline

Calculate spring properties based on frequency and damping ratio

Parameters
inDeltaTimeTime step
inInvEffectiveMassInverse effective mass K
inBiasBias term (b) for the constraint impulse: lambda = J v + b
inCValue of the constraint equation (C). Set to zero if you don't want to drive the constraint to zero with a spring.
inFrequencyOscillation frequency (Hz). Set to zero if you don't want to drive the constraint to zero with a spring.
inDampingDamping factor (0 = no damping, 1 = critical damping). Set to zero if you don't want to drive the constraint to zero with a spring.
outEffectiveMassOn return, this contains the new effective mass K^-1

◆ CalculateSpringPropertiesWithStiffnessAndDamping()

void SpringPart::CalculateSpringPropertiesWithStiffnessAndDamping ( float  inDeltaTime,
float  inInvEffectiveMass,
float  inBias,
float  inC,
float  inStiffness,
float  inDamping,
float &  outEffectiveMass 
)
inline

Calculate spring properties with spring Stiffness (k) and damping (c), this is based on the spring equation: F = -k * x - c * v

Parameters
inDeltaTimeTime step
inInvEffectiveMassInverse effective mass K
inBiasBias term (b) for the constraint impulse: lambda = J v + b
inCValue of the constraint equation (C). Set to zero if you don't want to drive the constraint to zero with a spring.
inStiffnessSpring stiffness k. Set to zero if you don't want to drive the constraint to zero with a spring.
inDampingSpring damping coefficient c. Set to zero if you don't want to drive the constraint to zero with a spring.
outEffectiveMassOn return, this contains the new effective mass K^-1

◆ GetBias()

float SpringPart::GetBias ( float  inTotalLambda) const
inline

Get total bias b, including supplied bias and bias for spring: lambda = J v + b.

◆ IsActive()

bool SpringPart::IsActive ( ) const
inline

Returns if this spring is active.


The documentation for this class was generated from the following file: