Newsgroups: comp.ai.games
Subject: Re: bullet aiming AI
Followup-to: mor30578@delta.obu.edu
From: MOR30578@DELTA.obu.edu (Alexey A. Morozov)
Organization: Ouachita Baptist University
X-Newsreader: WinVN 0.99.7
References: <32cd29d0.0@204.91.49.12>
MIME-Version: 1.0
Content-Type: Text/Plain; charset=US-ASCII
NNTP-Posting-Host: 150.208.242.30
Message-ID: <32dfd4c4.0@ntserv.obu.edu>
Date: 17 Jan 97 19:36:36 GMT
Lines: 28
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!newsxfer3.itd.umich.edu!howland.erols.net!netnews.com!mr.net!news.mid.net!news.uark.edu!ntserv.obu.edu!150.208.242.30

In article <32cd29d0.0@204.91.49.12>, Howard Uman says...
>
>Okay....  I know how to aim a bullet without the target moving, but....
>How do I calculate the "lead" when the target is moving???

It depends on the complexity of the model.
If your model is 3D and bullet's speed is constant =v_b and target's position 
vector can be approximated to be
   pos_t=<f(t), g(t), h(t)>
where t is time, then bullet's position vector will be given by
   pos_b=<C_1*t+x_0, C_2*t+y_0, C_3*t+z_0>
where
   (C_1)^2+(C_2)^2+(C^3)^2=(v_b)^2
and (x_0, y_0, z_0) is the firing point
To find the firing vector <C_1, C_2, C_3>, you will need to solve the system 
of equations:
   f(t)=C_1*t+x_0
   g(t)=C_2*t+y_0
   h(t)=C_3*t+z_0
   (C_1)^2+(C_2)^2+(C^3)^2=(v_b)^2
for C_1, C_2, C_3, where t will be the time of impact.

If any force is acting on the bullet while in flight, the system will be more 
complex, and I believe, will include some differential equations.

Sincerely,
          Alexey.

