1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Intersecting Vectors(python programming)

  1. Nov 16, 2012 #1
    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.
     
  2. jcsd
  3. Nov 16, 2012 #2
    If you are not sure which way to go a good drawing my get you headed in the right direction.
     

    Attached Files:

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Intersecting Vectors(python programming)
Loading...