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.

  • $\begingroup$ 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. $\endgroup$ – joriki Apr 20 '13 at 2:15
  • $\begingroup$ 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. $\endgroup$ – Ashton War Apr 20 '13 at 10:06
  • $\begingroup$ 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. $\endgroup$ – joriki Apr 20 '13 at 10:10
  • $\begingroup$ 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 $\endgroup$ – Ashton War Apr 20 '13 at 10:25
  • $\begingroup$ 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. $\endgroup$ – joriki Apr 20 '13 at 10:55

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).

  • $\begingroup$ That's great! Thankyou for taking the time out to answer this. Does the comma on the end of the equation mean anything? $\endgroup$ – Ashton War Apr 20 '13 at 17:06
  • $\begingroup$ @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 :-) $\endgroup$ – joriki Apr 20 '13 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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