Sign in to follow this  

Complex Lead Calculation

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this