Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
Both the text and the image plus legend are contradictory. The planets cannot at the same time follow circular orbits and move directly towards a target. Presumably this contradiction is meant to be resolved by the statement "the vector is simply added to their orbital path", but it's not clear what that means because it's not clear what "the vector" refers to or how a vector is added to a path. Please clarify this. –  joriki Apr 20 '13 at 2:15
Sorry, by directly I did mean the vectors are added. The reason I said directly was because if realistic mechanics were involved the planet would simply increase it's orbital velocity until it reached an elliptical orbit thus allowing it to reach the point via a Hohmann transfer. –  Ashton War Apr 20 '13 at 10:06
That hasn't made it any clearer to me. If a planet moves on a circular orbit, that completely fixes the direction, though not the speed, of its movement. It's not clear which vectors you're adding, and it's not clear how the result is compatible with the planets moving on a circular orbit. My best current guess of what you might mean is that you want to add two velocities, one directed towards the target and one directed along a circular orbit. This would not result in the planets moving on circular orbits. In any case, please state more explicitly what you're doing, preferably in formulas. –  joriki Apr 20 '13 at 10:10
I'm not quite sure how to explain what I mean with text so I did another quick diagram, this is what I mean by moving directly towards the point: i.imgur.com/9Fdne51.png –  Ashton War Apr 20 '13 at 10:25
Please read my comments more carefully. There's no lack of clarity about what it means to move directly towards a point. The lack of clarity results from the fact that the direction of travel on a circular orbit is fully determined, so it makes no sense to say that a planet moves on a circular orbit and then to also specify its direction of travel by a sum of two vectors. Presumably you don't mean literally that the planet moves on a circular orbit, but something like that it would move on a circular orbit if it weren't deflected towards the target. –  joriki Apr 20 '13 at 10:55

1 Answer 1

up vote 0 down vote accepted

After some clarifications in the comments, I now understand your question as follows: You have a planet, a centre, and a target. The velocity of the planet has two components, one given by the velocity it would have if it were on a circular orbit about the centre, and the other directed towards the target.

The rate $\dot D$ of the change of the planet's distance $D$ from the centre with time is the sum of the rates of the two changes corresponding to the two velocity components being added. The orbital velocity component is tangential to the orbit and thus doesn't contribute to $\dot D$. Thus $\dot D$ is determined by the velocity component directed at the target. This depends on the angle $\theta$ between the target $t$ and the planet $p$ as viewed from the centre $c$. In cartesian coordinates with the origin at the centre and the target on the positive $x$ axis, the target is at $(d,0)$ and the planet is at $(D\cos\theta,D\sin\theta)$. Thus the velocity component directed at the target is directed along $(d-D\cos\theta,-D\sin\theta)$. The radial component of this vector has magnitude

$$ \left(\pmatrix{d-D\cos\theta\\-D\sin\theta}\cdot\pmatrix{\cos\theta\\\sin\theta}\right)=d\cos\theta-D\;, $$

so a velocity in this direction with speed $V$ has radial component

$$ \dot D=\frac{d\cos\theta-D}{\sqrt{d^2+D^2-2dD\cos\theta}}V\;, $$

where the denominator is the norm of the direction vector. In your drawing you have $d\gt D$, and in this case $\dot D$ is positive for some values of $\theta$ and negative for others (as is also clear from the image).

share|improve this answer
That's great! Thankyou for taking the time out to answer this. Does the comma on the end of the equation mean anything? –  Ashton War Apr 20 '13 at 17:06
@Ashton: No, that's just punctuation; it's usual to punctuate equations like statements; in $\TeX$ the punctuation mark is preferably set off by a \; space command. And you're welcome :-) –  joriki Apr 20 '13 at 19:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.