• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
rahilbaber

Collisions involving friction explained (partly)

10 posts in this topic

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:
[url="http://www.euclideanspace.com/physics/dynamics/collision/practical/RahilBaberCorrectionToBrianMirtich.pdf"]http://www.euclidean...rianMirtich.pdf[/url]

I've also created a small C app demonstrating the simple "2D collisions with friction algorithm" at the bottom of the following page:
[url="http://www.euclideanspace.com/physics/dynamics/collision/practical/index.htm"]http://www.euclidean...tical/index.htm[/url]

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).
0

Share this post


Link to post
Share on other sites
[quote name='rahilbaber' timestamp='1299355469' post='4782183']
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:
[url="http://www.euclideanspace.com/physics/dynamics/collision/practical/RahilBaberCorrectionToBrianMirtich.pdf"]http://www.euclidean...rianMirtich.pdf[/url]

I've also created a small C app demonstrating the simple "2D collisions with friction algorithm" at the bottom of the following page:
[url="http://www.euclideanspace.com/physics/dynamics/collision/practical/index.htm"]http://www.euclidean...tical/index.htm[/url]

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).
[/quote]

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.
0

Share this post


Link to post
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
0

Share this post


Link to post
Share on other sites
[quote name='rahilbaber' timestamp='1299501767' post='4782787']
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.
[/quote]

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... :)

[quote]

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]

People do read these threads, just takes time :)

Cheers, Paul.


0

Share this post


Link to post
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.

Is this your algorithm?
0

Share this post


Link to post
Share on other sites
[quote name='rahilbaber' timestamp='1299514187' post='4782858']
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.

Is this your algorithm?
[/quote]


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.

0

Share this post


Link to post
Share on other sites
[quote name='rahilbaber' timestamp='1299522169' post='4782910']
Sounds like a similar system to Box2D. Thanks for the info.
[/quote]

Yes, exactly - but in 3d :)

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

Share this post


Link to post
Share on other sites
[quote name='wildbunny']
[color="#1C2837"][size="2"]Using impulses instead of LCP or QP[/size][/color]
[size="2"][color="#1C2837"][/quote][/color][/size]
[size="2"][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][/size]
[size="2"][color="#1C2837"]So sequential impulse is an iterative method to solve the LCP, and the word "instead" is not applicable.[/color][/size]
[color="#1C2837"][size="2"]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.[/size][/color]
[size="2"][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][/size]
[size="2"] [/size]
[size="2"][color="#1C2837"]Thanks for the long write-up rahilbaber, I hope to read it soon.
[/color][/size][size="2"][color="#1C2837"]Thanks,[/color][/size]
[size="2"][color="#1C2837"]Erwin[/color][/size]

0

Share this post


Link to post
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
0

Share this post


Link to post
Share on other sites
[quote name='erwincoumans' timestamp='1299543501' post='4783047']
[size="2"][color="#1C2837"]So sequential impulse is an iterative method to solve the LCP, and the word "instead" is not applicable.[/color][/size]
[/quote]

It is applicable when the traditional way to solve a system of constraints using LCP or QP involves generating a giant, inefficient matrix of constraints and sending this off to a memory hungry 'solver' which knows nothing about the problem domain and can quite easily 'die' with an infeasible solution.

Using impulses as the work-horse tool to solve a problem that can be expressed as an LCP is to me a very different thing than solving a general LCP :)

Cheers, Paul.


0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0