Original Post
I'm working on a linear targeting system. I have the system of equations down, but the answer I get when I solve them doesn't seem like it can possibly be right. x1 + v1 t cos a = x2 + v2 t cos b y1 + v1 t sin a = y2 + v2 t sin b (x1, y1) is the position of a bullet I need to fire. (x2, y2) is the position of the target, and b is the angle the target is moving at. The two equations above are when the bullet and target will intersect. I need to find a, the angle to shoot the bullet at. Through my own work I came up with this: t = ((y2 - y1) - (x2 - x1)) / (v2 cos b - v2 sin b) I would then take this t and use it to solve for my angle. However, it can't possibly be right. Two things jump out at me: if the target is not moving I will get a divide by zero, and if the target is at 45 or 225 degrees I will get a divide by zero. I'm not sure where I went wrong, and showing all the work this way would take forever. Can anyone point me in the right direction?