I am in the process of attempting to write a 3D physics engine for the first time, and am having a great deal of difficulty with understanding the impulse resolution pipeline. I understand linear impulses for the most part, but when I move on to the angular component I start getting lost. I can't code what I don't understand so I thought I would look for some advice and direction.
In the end, my goal is to have a simple physics engine that solves multiple contacts between objects largest penetration depths first and for a set number of iterations hopefully for a stable result. I'd like to try and explain as much as I understand of the impulse resolution pipeline and if anyone can point out things that are just horribly wrong with my understanding, please do. As for how I understand it:
For the contact resolver itself, I plan to iterate over a list of generated contacts and find the one with the greatest penetration. I will then resolve this contact and update all related contacts and repeat the process. Resolving the contact has two steps, penetration and velocity updates, which updates a single contact.
I think I understand most of the penetration update, using inertia to determine how much to resolve linearly versus angular. For linear inertia I just use the inverse mass of the object, and for angular I try to calculate the change in angular velocity per unit resolution along the contact normal. Then using the ratio I find, resolve position and rotation using both linear and angular components.
The velocity update uses some of the same equations as in penetration resolution to find the velocity change per unit impulse for both linear and angular components. I then find the current separating velocity of both objects (in world space or would this be in contact space?) and find a velocity that I want based on restitution values. Then I calculate and apply the impulse (p = desired / velocity per unit impulse) and I think that's it.
However what confuses me the most is the update of related contacts. What data do I need in order to do this? If I understand correctly, it's just the penetration that needs to change (also for the recently updated contact) but how can I do this with the rotation as well?
I'm sorry if I've posted in the wrong spot or if I wasn't very specific. I've never used a forum before and don't know of any unsaid rules that may apply. Please bear with me and let me know if there's anything I can do to clarify what I wrote above. Thanks.