Angular Friction

Started by
8 comments, last by Cacks 5 years, 5 months ago

Hi,

how do I calculate angular friction between my polyhedra? I have contact points

My engine doesn't incorporate angular friction so spinning objects don't move linearly if they spin on surfaces & angular momentum doesn't decrease,

cheers

Reject the basic asumption of civialisation especially the importance of material possessions
Advertisement

Usually, for every contact point, you solve one non-penetration and two friction constraints. The friction constraints depend on the non-penetration constraint (e.g. Coloumb friction). This is all you need. Other friction models exist, but I am not sure they have been published.

@Dirk Gregorius, the constraints based methods seem complicated or am I making a mountain out of a molehill?

Reject the basic asumption of civialisation especially the importance of material possessions

Some of the friction ideas I've seen around are quite simple. At the end of the day you will want to reduce the number of constraints as possible, and go with something straightforward.

It won't be a mountain if you are comfortable formulating and solving constraints. The hard part is, in my opinion, coming up with a simple model and/or figuring out how to reduce inputs to the constraint solver.

I know this isn't very specific info... I haven't done a custom solution myself. I always just did the super cheesy Coloumb approach Dirk described.

Checked up Coloumb friction, I've implemented linear friction using this approach already

I have Erin Catto's Iterative Dynamics paper you guys mentioned before

I can see the 2 Friction Constraints equations but don't understand them yet

Reject the basic asumption of civialisation especially the importance of material possessions

The formulation is almost identical to the normal response constraint. Just change normal N to tangent T. The two tangent axis are based on the normal constraint axis. Use any function you can think of that will take a vector as input and generate an orthonormal basis. The two new axes can be treated as your friction tangents.

Erin posted a function a while ago: https://box2d.org/2014/02/computing-a-basis/

That's pretty much it. It works OK. You get sliding artifacts as one axis will converge before the other... You also get 2 extra constraints (one for each tangent axis) per normal contact -- this gets expensive and also deteriorates the solver's convergence. Two extra constraint per normal constraint is a lot. This is why Dirk was mentioning other "unpublished" strategies that are probably nicer because they use less constraints, and avoid the artifact I mentioned.

I have an example of the cheesy Coloumb stuff here: https://github.com/RandyGaul/qu3e/blob/master/src/dynamics/q3ContactSolver.cpp#L152-L175

You can still get problems though. Like a sphere spinning -- there's no way for this tangent basis approach to account for actual spinning. All the Coloumb stuff is doing, is driving a specific contact point's velocity to zero, within the contact plane, and the forces are fed with inputs from the previous tick's normal force. Nowhere in this model is the angular velocity of the *body* taken into account (except when it contributes to the *linear* velocity of a contact point).

@Randy Gaul, I had a quick go using the normal response with 1 tangent; didn't work out, I will investigate further, cheers

Reject the basic asumption of civialisation especially the importance of material possessions

The problem with friction is the coupling of the friction forces to the normal (non-penetration) force. E.g. we have

dC1/dt = (v2 + omega2 x r2 - v1 - omega1 x r1 ) * n   and  lambda1 >= 0

dC2/dt = (v2 + omega2 x r2 - v1 - omega1 x r1 ) * s   and  -mu * lambda1 <= lambda2 <= mu * lambda1

dC3/dt = (v2 + omega2 x r2 - v1 - omega1 x r1 ) * t   and  -mu * lambda1 <= lambda3 <= mu * lambda1

The problem we solve is not linear anymore. Practically it is not an LCP in the presence of friction. So all proofs about convergence don't hold anymore. There are a couple of ways to solve this thougj. The first is what Randy suggests and use the normal force from the last frame. This works pretty bad in practice. A better approach is to use the current accumulated normal force (which is changing every iteration). This is mathematically not well defined (at least I haven't seen any proofs here), but it works great in practice.

The next issue with above formulation is that you are clamping against box and not a circle. There are two ways to solve this. The first is to align the first tangent direction with the relative velocity in the friction plane. This is very simple.

v = vn + vt <=> v = (v * n) * n + vt => vt - = v - (v * n) * n

Be careful when the relative velocity is zero. You need to fall back onto a geometric approach as described in Erin's blog post. A better way to solve the friction problem is to use circular clamping. You solve the the friction constraints as a 2x2 block system and then you clamp the length of vector.

Finally what really makes the difference for friction for me is warmstarting. If your warmstarting doesn't work you will get poor friction and poor simulation quality.

 

HTH,

-Dirk

 

 

 

@Randy Gaul, I've been experimenting with your suggestion. I can get 2 normals by using the collision's reference face. I am getting linear movement due to angular momentum but the momentum doesn't decrease correctly. The linear movement of objects sliding on surfaces is impeded, the backward impulses are too large.

@Dirk Gregorius, I don't understand the equations. For linear friction I can get the current normal of the collision. For tangent normals I can get these using the collision's reference face. What is circular clamping & warm starting?

 

Reject the basic asumption of civialisation especially the importance of material possessions

This topic is closed to new replies.

Advertisement