This topic is 5082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've got this little piece of well known code for calculating lead on a target:
Vector2D LeadTarget( Vector2D sp, float bs, Vector2D tp, Vector2D tv )
{
Vector2D D = tp - sp;
float E = D.Dot( D );
float F = 2 * tv.Dot( D );
float G = bs * bs - tv.Dot( tv );
float t = ( F + sqrt( F * F + 4 * G * E) ) / ( G * 2 );

return D / t + tv;
}

This, quite naturally, only works for targets travelling in a straight line at constant velocity. What I would like to know is, how would you do it for targets on curved tragectories that also have acceleration?? (If it can be done without resorting to numerical methods). Cheers, arm

##### Share on other sites
Well, your lead calculation could actually be looked at as a first order Taylor approximation of the path of the target on the screen. All you have to do is add more terms (a t2 term, t3 term etc.) and evaluate it as you evaluate the first order approximation.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 9
• 9
• 14
• 12
• 10
• ### Forum Statistics

• Total Topics
633271
• Total Posts
3011162
• ### Who's Online (See full list)

There are no registered users currently online

×