Where to shoot to hit a moving target in 3D space Typical problem of many computer games and also reality (targeting computers of modern jets or anti-aircraft systems):
You have a target at known position and it is flying at known constant velocity. You're trying to shoot at it with a projectile, which flies at known constant speed and unknown but constant direction. Now it is needed to calculate the point at which you have to shoot (how much in front of the target), so that both target and projectile meet at the same time at this point.
So what i know:


*

*target position T = [x,y,z]

*target velocity v = (x,y,z)

*projectile speed s (scalar only)


What i want to get:


*

*position of their collision (or vector of the bullet, or time after which they collide ... any other value, which is convertible to these)


For simplification, let's forget gravity, air resistance, etc. Let's imagine this is in space far from any influences.
Although this first seemed to me as a trivial problem, i have been unable to come up with a solution even after many hours. Any advices?
 A: At time $0$ target is at position $\vec T_0$ and bullet is fired from the origin with speed $\vec s$. If $t$ is the collision time you have the equation
$$
\vec s t = \vec T_0 + \vec v t.
$$
Squaring both sides one gets $s^2t^2=T_0^2+v^2t^2+2(\vec T_0\cdot\vec v)t$, 
that is: 
$$(s^2-v^2)t^2-2(\vec T_0\cdot\vec v)t-T_0^2=0,$$
an equation which can be solved to obtain $t$.
Once $t$ is known you can compute
$
\vec s=\vec v +\vec T_0/t.
$
A: Assume you are firing your bullet from the origin with speed $s$ in the direction of the unit vector $\underline{\hat{u}}$.
The target is at position vector $\underline{r}_0$ at time $t=0$ and moves with constant velocity $\underline{v}$.
The particles collide at time $t$ given by the equation$$s\underline{\hat{u}}t=\underline{r}_0+t\underline{v}$$
For the given data, we would write $$\underline{\hat{u}}=\left(\begin{matrix}a\\b\\c\end{matrix}\right),$$
and obtain the components $a, b, c$ in terms of $t$, apply the constraint that $a^2+b^2+c^2=1$ to obtain the value of $t$, the time when they collide, and then substitute back to get the unit vector, i.e. the direction in which you fire the bullet.
