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

# How to find the net normal force acting on all object?

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.

4 replies to this topic

### #1pizza123  Members

Posted 07 January 2013 - 07:37 PM

Hi,

So I'm making a physics engine and I'm having trouble calculating the net normal force of an object that is in touch with many other objects (it works for 2 but doesn't work for more). The scenario is a circle is between two other circles (ontop of them, in the middle) and there are more circles on top of that circle. There's also gravity acting on the circle. Right now the way im calculating the net force on the object is first I apply gravity to it, then I apply the normal force from the first object in contact and get a new net force, then I apply the normal force from the second object to the net force and get a new net force, and etc... However I'm not sure if what I'm doing is correct. Is this the way to do it or is it wrong?

Thank you

### #2Sepii  Members

Posted 08 January 2013 - 03:41 AM

The net force on an object is just the sum of all the forces. So I think what you are doing is correct.<br />Just make sure that applying a force means adding the force to the net force.

### #3EWClay  Members

Posted 08 January 2013 - 04:34 AM

The 'correct' way would be to use a contact solver.

This is quite a complex topic but in essence you first find a list of all contacts, then you calculate the force for all of them at once using an iterative method.

Two common techniques are treating each contact as a collision and accumulating impulses, or forming a linear system of equations and solving, using for example the Gauss-Seidel method.

### #4pizza123  Members

Posted 08 January 2013 - 05:57 PM

I read about impulses, but the only thing I don't understand about them is when to apply them (right at the collision, or at the beginning of the loop? if it is in the beginning of the loop I would have to store them at collision?). Also, what should I apply them to, the current velocity or a temporary velocity that I will later apply to the current velocity? Also, currently I implemented a discrete system, and there is a lot of jittering (especially when objects are supposed to be at rest), is there any way around that?

Thank you

### #5EWClay  Members

Posted 09 January 2013 - 10:36 AM

First apply gravity, then loop over all the contacts. You can apply impulses directly to the objects, but keep track of the total impulse for each contact. This is because you might need to apply a negative impulse if the initial estimate was too large. This is fine, as long as the total is positive. Stop after a fixed number of iterations, or if all the impulses are small enough.

As for jitter, my experience (which may or may not be universally true) is that it will only go away if you have a stable set of contacts, and you use the previous frame's solution as a starting point.

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.