Lets say I have one planet of mass $m_A$ and another of mass $m_B$. Lets say the distance between each of them is $r$.
How would I calculate the initial velocity needed for each in order to make them orbit around each other (relative to a center of mass)? When I run my simulation, and do the basic equation $ v = \sqrt{\frac{G m}{r}} $ for both, they would fly away from each other.
EDIT: I should also say that I want to be able to scale this to more than 2 masses. At that point, I think I'm approaching (or have already reached) the 3-Body problem, which makes my life much more interesting.