Advertisement

Friction impulses in sequential solver

Started by March 03, 2024 02:44 PM
11 comments, last by Dirk Gregorius 9 months, 3 weeks ago

Dirk Gregorius said:

Yes, the velocity changes, but you project it onto a fixed basis. There are two tangent directions! You can align one direction with the relative velocity at the contact point when you set this up, but this is only useful if you use box clamping. Instead you can also do:

lambda_tangent1^2 + lambda_tangent2^2 ≤ (mu * lambda_normal)^2

This is consistent with Coulomb friction. But to be honest, I would not worry about these details much. You will not notice a difference anyways. There are very few use cases where this matters.

How should I clamp tangent impulses according to this formula? I clamp both directions separately.

float MaxLambda = Mu * NormalLambda;

RnVector2 DelatLambda = ...;
RnVector2 Lambda = FrictionLambda;
FrictionLambda += DeltaLambda;
float LambdaSq = rnLengthSq( FrictionLambda ); 
if ( LambdaSq > MaxLambda * MaxLambda )
	{
	FrictionLambda *= MaxLambda / rnSqrt( LambdaSq );
	}
DeltaLambda = FrictionLambda - Lambda;

This topic is closed to new replies.

Advertisement