I'm making a game, in the game planets orbit a central point in circular orbits, they move directly towards their targets and the vector is simply added to their orbital path. Whilst not realistic it avoids many challenges and the resultant efficiency allows me to simulate thousands of planets in real-time.
Though planets aren't affected by gravity they have a tendency to become trapped in the center when their average vectors move towards it. I want to minimize this by placing an arbitrary force outwards on the planets when they get too close to the center but to calculate the appropriate force I must determine the resultant vectors magnitude.
I created a diagram to show what I mean a bit better:
- p = planet orbiting
- o = orbit path
- t = target point
- v = orbit velocity
- V = velocity at which planet is moving to target
- d = distance from center to point
- D = orbit radius
I need to calculate D/time though I have no idea how to work it out. Thanks for reading and I really hope you guys can help out.