find a formula to cacluate if a moving object goes to a target

40 Views Asked by At

I am struggling to find a formula to calculate if a moving object goes towards a certain direction. I have $P_1$, which is the current position $(x_1, y_1)$, and its direction angle. I also have the position of a target $(x_2, y_2)$. How can I calculate if the currently moving object goes toward the target position?

1

There are 1 best solutions below

2
On

More information is necessary to answer this question. If object is moving in a vacuum with no external forces pressing on it, then it will simply keep moving in a straight line in the direction given by the direction angle (which I will call $\theta$).

It will hit the target if the vector (x2,y2)-(x1,y1) is proportional (by a positive constant!) to the vector $(\cos(\theta),\sin(\theta)).$

If the object is subject to gravity, drag, etc... then the problem becomes more complicated and we need more information (if nothing else we would need the initial velocity of the object). One could solve the problem:

Given initial object (x1,y1) subject only to gravity, target position (x2,y2), the mass of the moving object and the direction angle, how much force is necessary to hit (x2,y2) although this places constraints on the possible initial angle (e.g. we could not shoot the object downward or backward and have it hit the target).