• FEATURED
• FEATURED
• FEATURED
• FEATURED
• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Contact force situation

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

10 replies to this topic

### #1Mr_Nick  Members

Posted 10 August 2012 - 09:15 AM

Hi, since no one has replied (though Im greatful for the number of views), I thought I'd clarify the situation.

A ball is in contact with a plane. At the contact point, the relative velocity along the contact normal is zero. The ball's centre of mass (COM) has accn of -g. The ball is spinning at such a rate that at the contact point, the centripetal accn cancels out the gravitational accn. So the calculated contact force to prevent penetration of the point is zero.

Obviously, this will not prevent the ball penetrating the plane.

I've now looked at the equations by Baraff, Eberly and Coutinho and all get this result of zero contact force.

What am I doing wrong? Do I ignore centripetal accn (even though the above authors don't)? Is it simply an unavoidable situation that I'll to code for?
Could anyone do an example calculation for me?

### #2Inferiarum  Members

Posted 10 August 2012 - 10:01 AM

I guess the authors use convex polyhedra in their algorithms. A ball has an infinite number of extremal points. The point of the ball actually touching the plane is not the point which is penetrating it in the next time step. If you approximate the ball with a polyhedron your algorithm should notice that there is a new point of contact and calculate the appropriate impulses to prevent penetration.

### #3Mr_Nick  Members

Posted 10 August 2012 - 10:54 AM

Hey Inferiarum,
wow thats a really good point they do use convex polyhedra whereas I was using a perfect sphere. Guess Ill have to bite the bullet and implement a general intersection test for trimeshes. Im thinking either V-clip or GJK.. any recommendations?
Still, even if it were a polytope, the force required still wouldn't be enough in one go, it would take 1 or more iterations of the response algorithm to prevent penetration. Does that sound right? (I was previously under the impression that once the force was calculated, it would at least prevent penetration until the end of the time step).

Anyway thanks alot Inferiarum

### #4Inferiarum  Members

Posted 10 August 2012 - 11:35 AM

You do not have to do any iterations. In the case you described, you do not need a force preventing penetration, because the point will never penetrate the plane. If it was a polytope with only the one extremal point touching the plane, the center of mass would accelerate towards the plane, but the one point would stay on the plane because of the rotation. Your algorithm should then detect when the 'next' point would penetrate the plane and adjust the momenta accordingly. This would have the side effect of slowing down the rotation.

edit: concerning the algorithms I cannot really help you. Implement something you find easy to understand i guess.

Edited by Inferiarum, 10 August 2012 - 02:14 PM.

### #5bpj1138  Members

Posted 10 August 2012 - 12:17 PM

I think one of those authors you mentioned admitted that with the inclusion of friction into these LCP problems, the system may be "unsolvable". I got as far as checking out a book on the "Simplex" method, then promptly gave up on the whole thing. What I'd like to see is a solution similar to the Verlet which would work with classic RBD. Good luck with your quest, and keep us posted on your progress.
--bart

### #6Mr_Nick  Members

Posted 10 August 2012 - 12:45 PM

Thanks for you're reply. Think I understand. It was just that in Coutinho's book, it said that after contact forces had been resolved, you can integrate to the end of the time step and no interpenetration will have occured. I guess he meant to add 'at that particular point on the body'? If that's the case I can see also why its necessary to use polytopes, as with the smooth sphere it would seem that in the above mentioned case that the simulation would be stuck in an infinite loop (because in the above case no state changes are made, the ball goes on to penetrate the plane, exactly as in the previous step, and then the system backs up the ball to the time of contact, and repeats the resolution - if that makes sense?). Either way thanks a lot think Ive had a big conceptual spoon up.

### #7Mr_Nick  Members

Posted 10 August 2012 - 12:49 PM

Hi bpj1138, yes it says that there should always be a solution in the frictionless case (which Im currently [trying] to implement) but not always for the friction case.

### #8wildbunny  Members

Posted 11 August 2012 - 01:07 PM

I strongly urge you to discard the force/acceleration model in favour of impulse/velocity. The later is a million times easier to implement and to find up to date tutorials / example code.

Have you seen my 'Physics engines for dummies' article?

http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/

It should give you some pointers

Cheers, Paul.

### #9Inferiarum  Members

Posted 11 August 2012 - 05:26 PM

I strongly urge you to discard the force/acceleration model in favour of impulse/velocity. The later is a million times easier to implement and to find up to date tutorials / example code.

Have you seen my 'Physics engines for dummies' article?

http://www.wildbunny...es-for-dummies/

It should give you some pointers

Cheers, Paul.

I guess each physics simulator works with impulses implicitly because of the discrete nature of the simulations. The forces under consideration are used to keep bodies in resting contact.

### #10wildbunny  Members

Posted 12 August 2012 - 05:09 AM

I guess each physics simulator works with impulses implicitly because of the discrete nature of the simulations. The forces under consideration are used to keep bodies in resting contact.

Certainly it used to be the case that most simulators would treat collisions via impulses and then resting contacts via a force/acceleration model, but things have come a long way since then - these days its popular to treat collision and resting contact via impulses only - if handled correctly they are just visually stable, handle stacking very nicely, can treat friction without having to linearise and are numerically stable and you'll never end up in a situation where your LCP solver suddenly explodes due to an 'infeasible solution'.

For research, I suggest googling 'sequential impulses' ref Erin Catto.

Cheers, Paul.

### #11bpj1138  Members

Posted 12 August 2012 - 03:21 PM

I guess each physics simulator works with impulses implicitly because of the discrete nature of the simulations. The forces under consideration are used to keep bodies in resting contact.

I suppose you could integrate the equations symbolicly inside the time step. In classic RBD, you almost have to do this in order to conserve angular momentum properly, otherwise the system will leak energy. You can see this clearly when an object is nutating. A first order integrator will not work, or only work for a few seconds.

As far as stability, I haven't seen an LCP engine, so I can't say one way or another. I do know that adhoc methods have problems, because they have no concept that the solution depends on the entire system, rather work on pairs of objects separately from all the others.

This leads to impulses applied in opposite directions that grow in strength in order to componsate for the impulses working in the opposite directions. To use an analogy, think of people talking at a party, and having to talk louder and louder in order to be heard, meanwhile all the other people also start talking louder and louder so they can be heard, and so forth.
--bart

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.