I thought I would expand (let's see if my memory serves me right)
You are probably useing an equation for the force between 2 objects is F=g(M1)(M2)/D^2. I think that is the equation for force between 2 objects. Then you use F=MA to determine acceleration, ect.
Now let's say you have 2 objects one at point (x1,y1,z1) and another at point (x2,y2,z2).
Calculate the Force on each axis by doing this
Fx=g(M1)(M2)/(x2-x1)^2
Fy=g(M1)(M2)/(y2-y1)^2
Fz=g(M1)(M2)/(z2-z1)^2
from there calculate acceleration one each axis followed by velocity followed by the new position. Never compile the forces/accel/velocity into the combined force (there is no reason to do it)
|