I am doing a project for a a programming class where we create AI bots for the game Xpilot. Xpilot is a space physics game where you control a ship that attempt to shoot other ships. I am attempting to create an aiming function for the ship, but cannot figure out the physics of it. The given variables are: -self coordinates, velocity, heading direction, and bullet speed -enemy coordinates, velocity, and tracking direction My question is: Given these variables, how do I calculate the angle that I must aim at in order to hit the enemy moving at a constant velocity. So, for example, my ship is at (0, 0) moving at 60 degrees and v= 10, and the enemy ship is at (100, 100) moving at 120 degrees and v = 5. If the bullet speed is 10, what angle must I shoot at to hit the enemy? Im not exactly sure what I'm looking for as the final product here. I know how to calculate the bullet's vector and the enemy's vector, but I'm not really sure how to find theta that makes this an accurate start. If someone could start me off in the right direction or give me a general idea of how to go about this it would be much appreciated.