massive_boner
❔ Unity deltaTime error
this is my code, when I multiply the damping by deltaTime it breaks the spring but without timeDelta the spring still breaks at lower framerates. what can I do?
public (float, float) Spring(float current, float velocity, float goal,float powerConst, float dampingConst)
{
float damping = velocity * dampingConst;
velocity += (goal - current) * powerConst;
current += (velocity - damping) * Time.deltaTime;
return(current, velocity);
}
2 replies