Thread: Calculating Target Lead

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    Question Calculating Target Lead

    So, I want to know if this is the correct equation for target lead.
    Code:
    VEL=convertUnit("u/s","m/s",Target:vel())
    
    TargetIsGoingTo=Target:pos()+VEL
    
    DISTANCE=convertUnit("u","m",Gun:pos():distance(TargetIsGoingTo))
    
    DISTIME=((DISTANCE/SpeedOfProjectile))
    
    TargetFinal=TargetIsGoingTo*DISTIME
    Last edited by Jesse Richards; 09-04-2012 at 12:08 AM.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Have a look at the smart questions link below. It's very hard to come up with any meaningful answer for this question.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Target lead is a factor of target velocity, target distance and projectile velocity. If you place a pipper at targetPos + targetVelocity * timeToTarget you should be fairly close. Note this assumes the target will stay in a straight line and will not change velocity during timeToTarget. It is a good estimation of where the target will be at a time T but it is not perfect...but let's face it...none of the lead predictors in games are accurate - certainly not as accurate as those on modern military aircraft.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 09-26-2011, 02:35 PM
  2. strace can SIGSEGV lead to SIGKILL?
    By cerr in forum C Programming
    Replies: 5
    Last Post: 01-14-2010, 06:08 PM
  3. Compute target lead
    By VirtualAce in forum Game Programming
    Replies: 18
    Last Post: 10-02-2009, 09:41 AM
  4. WANTED: Lead Programmer
    By fluid_hres in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-10-2006, 07:25 PM
  5. Rookie needs a lead
    By DirtElk in forum C Programming
    Replies: 5
    Last Post: 02-18-2002, 08:27 AM

Tags for this Thread