# How to "aim ahead of" an object moving in a circle? [duplicate]

Let's say I have a GameObject A that's moving in a circular path in orbit around a central point, and I have a second GameObject B that is capable of independent movement, and can move at a higher velocity than A. B may be located at an arbitrary point, either inside or outside of A's orbit. I want to calculate the fastest route that will cause object B to intercept object A. (The problem is not exactly "I want a spaceship to arrive at a planet", but close enough for the purposes of this question.)

The obvious idea is to compute a bunch of concentric circles around B and use some sort of divide-and-conquer guesswork to narrow in on a circle that ends up touching A's orbit at exactly the point where A would be if B moved to that point at its maximum speed. But that feels a bit clunky, not to mention computationally expensive for something that I'd want to do fairly frequently, potentially multiple times per frame. Is there a better way to calculate this?

For simplicity's sake, assume that all calculations are occurring in a 2D plane.

• Just to make sure I'm understanding, B is able to travel in a straight line to intercept A?
– user111144
Oct 4, 2019 at 15:00
• @Bilkokuya Yes, that's what I'm aiming for. (No pun intended.) Oct 4, 2019 at 15:23
• is A's speed constant? may B's speed change? is B forced to move on a straight line? Oct 4, 2019 at 15:56
• I'm going to be honest, I'm pretty certain there is an analytical solution - if you create equations for A's position and B's possible positions for a given time t (they are both circles, the radius of B's is determined by it's speed and the given time), and then solve them against each other for the intersection. But I've got half way with the maths and messed up - I'll have a rethink tonight, but hopefully somebody can write up the specific solution before then.
– user111144
Oct 4, 2019 at 16:01
• You may be pleased to know that we already have two previous Q&A threads addressing exactly this! "How can I intercept an object with circular motion?", and "Determining the first future intersection possible between ships and a planet". Have you tried putting the solutions described in these answers into practice? If they're not serving your needs, please edit your question to explain where you need help, and we can re-open the question for new answers. Oct 4, 2019 at 16:43

Then, at runtime, find the distance from object A to object B, and divide that distance by B's velocity to find the time it will take B to reach A if A remained stationary. Call that time T2. To get the distance around circle, create a new Vector2 (Mathf.Cos(T2/P), Mathf.Sin(T2/P))and multiply it by R. Add the orbit's position to that vector to give you the point that A will be at when B would reach A. Call this position A'.