I'm building a physics simulator for a graphics course, and so far I have it implementing gravitational and Coulomb forces. I want to add collisions next, but I'm not exactly sure how to go about doing it.
A quick summary of how this is working so far is: All objects are spheres of a set radius, mass and charge. The mass's and charges of the spheres are treated as point charge/mass for the calculation. Every step in time (about 1/50th of a second) the forces acting on each object are calculated in a nice big nested for loop that figures out the coloumb and gravitational force between 2 objects, for every set of 2 objects, and then they are summed together. I use this net force to determine the acceleration, and the rest is fairly obvious from there.
What I want to add in is collisions. I can deteremine pretty easily if a collision is happening (if the distance between them <= radius of one + radius of other), what I am not so certain of is how I should add in the collision force (and would need to do it component wise). I want elastic collisions, though for now I'd just be happy with getting conservation of momentum
The information I have easily available are: the velocity of each object (and I mean velocity, speed and direction), the position of each object, the mass/charge (charge obviously not needed here) and the Net force calculated so far for each object for the next step in time. I dont need exact formulas (would prefer if they arent exact), just need a nudge in the right direction.