• Advertisement
Sign in to follow this  

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

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement