You could experiment a little. Take two masses and draw them traveling at some random velocity (this implies direction too). Have a toggle button that either skips the gravitational force calculations or turns it on. When the button is toggled off all objects should continue in a straight line from their last computed velocity. This is an example of one of Newton's laws, an object at rest tends to stay at rest, an object in motion tends to stay in motion unless they are acted upon by an outside force. In particular this motion is linear. Then, click the toggle button to start computing gravitational force on each of the objects and soon they should be moving on a curved trajectory, assuming their velocity has some tangential component relative to the other.
Bacterius is correct. You have to supply the correct tangential velocity.
Already did something similar to that a while back lol.
[quote name='Muzzy A' timestamp='1350625985' post='4991689']
I may have to look up tangential velocity then
Calculating the tangential velocity based on orbit parameters like distance/eccentricity:
http://www.gamedev.n...58#entry3961958
Periapsis velocity:
v = sqrt((G*M/a)*(1 + e)/(1 - e)).
The planet Mercury's semi-major axis a = 57909176e3 metres, and has an orbit eccentricity e = 0.20563069:
v = sqrt((6.6742e-11 * 1.988435e30 / 57909176e3) * (1 + 0.20563069) / (1 - 0.20563069)),
v = 58976.3015.
That's very close to the maximum orbit speed of Mercury, as 58980 m/s on wikipedia.org.
(Note, 1.988435e30 == Sun's mass)
Oppositely, for the apoapsis velocity:
v = sqrt((G*M/a)*(1 - e)/(1 + e)),
v = 38858.47.
For a circular orbit, the eccentricity is 0.
These calculations help you find the length of the tangential velocity vector. As for finding the direction of the tangential velocity vector, the cross product operation will help you (if your orbit plane is nice and aligned with the coordinate system, it's very straightforward).
[/quote]
you're going into orbital elements, which was what i was trying to avoid lol. But i see your logic.