# Collisions involving friction explained (partly)

This topic is 2833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I found a possible mistake in Brian Mirtich's phd thesis, specifically his method for resolving rigid body collisions with friction.

I've written up the details and a fixed version of the collision response algorithm here:
http://www.euclidean...rianMirtich.pdf

I've also created a small C app demonstrating the simple "2D collisions with friction algorithm" at the bottom of the following page:
http://www.euclidean...tical/index.htm

I thought maybe someone on this forum might find it useful, my apologies if I've wasted everybodys time with this post.

I don't hang out on this forum (this is my first post) if you want to contact me you can do so by email (see the pdf for my address).

##### Share on other sites

I found a possible mistake in Brian Mirtich's phd thesis, specifically his method for resolving rigid body collisions with friction.

I've written up the details and a fixed version of the collision response algorithm here:
http://www.euclidean...rianMirtich.pdf

I've also created a small C app demonstrating the simple "2D collisions with friction algorithm" at the bottom of the following page:
http://www.euclidean...tical/index.htm

I thought maybe someone on this forum might find it useful, my apologies if I've wasted everybodys time with this post.

I don't hang out on this forum (this is my first post) if you want to contact me you can do so by email (see the pdf for my address).

Its good that you've gone to the effort of writing a paper and a website article on this

The way most games handle friction these days is simply by adding another impulse to oppose tangential motion in to the already existing contact solving for normal impulse.

Using impulses instead of LCP or QP allows you to do away with all worries concerning solution-less edge-cases, and even allows you to treat static friction as well as dynamic

Cheers, Paul.

##### Share on other sites
Thanks for the post

The method I describe/corrected is an impulse based method. The question is how you work out the impulse when friction is involved. The most common method I've seen is to calculate the impulse without friction lets call it J, then apply a tangential impulse of J times the coefficient of friction. However, this gives unrealistic looking simulations, and can increase the energy of the system, which even in game physics looks unacceptable.

The method I give for 3D collisions isn't particulary efficient (involves solving a differential equation numerically), but the method for 2D collisions is pretty quick it doesn't involve any loops just a series of checks to determine which case we lie in. It should be comparable to the speed of the naive approach in common use but gives much better looking results.

I thought people would be interested but so far you are the only person who's glanced at it.

Rahil

##### Share on other sites

Thanks for the post

The method I describe/corrected is an impulse based method. The question is how you work out the impulse when friction is involved. The most common method I've seen is to calculate the impulse without friction lets call it J, then apply a tangential impulse of J times the coefficient of friction. However, this gives unrealistic looking simulations, and can increase the energy of the system, which even in game physics looks unacceptable.

No problem

What i do when calculating an impulse with dynamic friction is this:

Calculate relative normal velocity, compute normal impulse.
Calculate relative tangential velocity (just the total velocity minus the the velocity in direction of normal), compute impulse.

The tangential impulse magnitude should be clamped at the normal impulse magnitude, of course, to stop it being too strong (it would still never introduce energy, though even without this). Its also scaled by the coefficient of dynamic friction (between 0 and 1)...

No energy is ever added to the system this way, since we're only ever removing velocity...

The method I give for 3D collisions isn't particulary efficient (involves solving a differential equation numerically), but the method for 2D collisions is pretty quick it doesn't involve any loops just a series of checks to determine which case we lie in. It should be comparable to the speed of the naive approach in common use but gives much better looking results.

I thought people would be interested but so far you are the only person who's glanced at it.

Rahil
[/quote]

Cheers, Paul.

##### Share on other sites
Sorry it seems it takes a while for the board or my browser to update the view counter on this post. For the past 2 days it read 0 views but it has suddenly shot up to 139.

I agree your method doesn't sound like it causes an increase in energy, though I'm not sure I completely understand it. My understanding is this:

1) find the impulse in the normal direction using "the standard" frictionless impulse equation and apply the impulse.
2) find the impulse in the tangent direction by imagining the object is colliding with an imaginary perpendicular surface (do you still use the coefficient of restitution in this impulse calculation?)
3)Scale the impulse by the coefficient of friction.
4)Check if the tangent impulse is larger then the normal impulse if so reduce the tangent impulse to the same size. Then apply the tangent impulse.

##### Share on other sites

Sorry it seems it takes a while for the board or my browser to update the view counter on this post. For the past 2 days it read 0 views but it has suddenly shot up to 139.

I agree your method doesn't sound like it causes an increase in energy, though I'm not sure I completely understand it. My understanding is this:

1) find the impulse in the normal direction using "the standard" frictionless impulse equation and apply the impulse.
2) find the impulse in the tangent direction by imagining the object is colliding with an imaginary perpendicular surface (do you still use the coefficient of restitution in this impulse calculation?)
3)Scale the impulse by the coefficient of friction.
4)Check if the tangent impulse is larger then the normal impulse if so reduce the tangent impulse to the same size. Then apply the tangent impulse.

1) is correct
2) The target is to form the tangential velocity - which is what we would like to remove some of; this is simply the total velocity minus the normal velocity. Once we have this we can compute an impulse to reduce it. I never deal with restitution in any of my physics engines over the years; games never seem to call for it....
3) is correct
4) is mostly right, there are some subtleties involved here since the solver is an iterative accumulated impulse solver...

Cheers, Paul.

##### Share on other sites
Sounds like a similar system to Box2D. Thanks for the info.

##### Share on other sites

Sounds like a similar system to Box2D. Thanks for the info.

Yes, exactly - but in 3d

To test it you don't need sequential impulses, you can just do as you say and clamp once

##### Share on other sites
Using impulses instead of LCP or QP
[color="#1C2837"]

[color="#1C2837"]Sequential impulse, like in Box2d or Bullet in 3D and quickstep in Open Dynamics Engine are all equivalent to projected gauss seidel/successive overrelaxation.
[color="#1C2837"]So sequential impulse is an iterative method to solve the LCP, and the word "instead" is not applicable.
[color="#1C2837"]When you add friction constraint rows where the clamping values depend on previous contact normal constraint rows, it becomes a non-linear complementarity problem/NCP, but let's not nitpick about that.
[color="#1C2837"]Sequential impulse differs from Brian Mirtich's 'impulse based dynamics', even though they both have the word 'impulse' in the name. Sequential impulse is in fact a constraint based formulation, but intuitively explained by Erin Catto.

[color="#1C2837"]Thanks for the long write-up rahilbaber, I hope to read it soon.
[color="#1C2837"]Thanks,
[color="#1C2837"]Erwin

##### Share on other sites
Thanks Erwin.

I doubt you'll learn much from my document if you're familar with Mirtich's thesis. The key differences are always integrate with respect to p_z (not u_z) and be aware that two compression/decompression phases can occur. The derivation becomes simpler when you don't have to worry about integrating with u_z, so I thought it would be worth rewriting also I collected the formulas in one place to make an explicit algorithm for people who aren't concerned with the technical details.

The LCP approach to sliding contacts seems really interesting as does the SI / PGS method of solving them. I hope to really understand the Bullet implementation in the very near future. Are you planning on creating any documents to explain how Bullet works for simpletons like me who are less knowledgeable of the whole LCP and PGS approach. I am aware there are slides and source code available for download but a not overly technical document fully explaining the key ideas would be great.

Rahil

1. 1
2. 2
3. 3
Rutin
25
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633650
• Total Posts
3013119
×