Profile image

No, You do NOT need 'TargetVelocity' to properly lead your target. [Auto Turrets]

161k spefyjerbf  3.7 years ago

A provocative, but true, title. We actually have all we need to properly lead, or "future", a moving target without necessarily knowing its speed.

Knowing a target's velocity is next to useless when used in an auto turret

Yes, you read that right, and you probably want an explanation. Simply put, using the target's velocity complicates the problem. If we were to use a target's velocity in an auto-turret's FT code, then we would need to ask the following questions:

  1. What direction is the target moving in?
  2. What is the target's velocity relative to? Our vehicle's turret, or the ground?
  3. How do we account for our vehicle's velocity?
  4. How do we account for our vehicle's orientation?
  5. How do we translate the results of our calculations into an angle lead?

These questions are incredibly difficult to answer. In fact, a method using TargetVelocity would require us to solve a university-level rigid-body dynamics problem that would take hours to complete.

Therefore, knowing the target's velocity is next to useless if it were to actually be added into FT. Thankfully, there is another way.

Heading and elevation rates are the key to a leading auto-turret

If we were to do all of the proper calculations, our results would come in the form of a rate of change of heading and elevation. Let me repeat that:

The target's motion is best described by using rates of change of heading and elevation.

Thankfully, we have this information. We can use rate(TargetHeading) and rate(TargetElevation) to lead the target. This approach should account for reference frames, too! Now all we need is the speed of our bullets (which we can find through overload), and the distance to our target, TargetDistance.

Therefore, you need the following information to properly lead or "future" your target:

  1. rate(TargetHeading)
  2. rate(TargetElevation)
  3. TargetDistance
  4. bulletSpeed of your guns

General methodology

Here's an overview of how to use this information. We will use a step-by-step description here.

  1. Calculate the time it will take your bullet to reach the target. You can do so by using your bullet's speed and your target's distance.
  2. Use rate(TargetElevation) and rate(TargetHeading) to get angular rates of the target, relative to your vehicle
  3. Use the aforementioned angular rates and the time to calculate an angle offset for the turret
  4. Combine this angle offset with TargetHeading and TargetElevation to properly lead the target

In my opinion, this is the best way to lead a target. I would do it myself, but I'm busy. I am certain that it is possible to lead your target properly by using this information. I am leaving you, the reader, to actually do it yourself. Feel free to ask me questions!

  • Log in to leave a comment
  • Profile image
    161k spefyjerbf

    Note that I have not tried out the beta. I have heard some descriptions of the TargetElevation and TargetHeading parameters that would require some extra steps to this basic method.

    Pinned 3.7 years ago
  • Profile image

    Ryan for the information

    2.5 years ago
  • Profile image
    161k spefyjerbf

    @Tristanmusic It should, but it requires some complicated geometry that I don’t have time to do at the moment. Sorry about that

    3.2 years ago
  • Profile image

    @spefyjerbf yea but like, what direction the target is moving in...

    3.2 years ago
  • Profile image
    161k spefyjerbf

    @Tristanmusic It should output degrees by default then

    3.2 years ago
  • Profile image

    @spefyjerbf rather degrees

    3.2 years ago
  • Profile image
    161k spefyjerbf

    @Tristanmusic It should be. Does the variable default to radians?

    3.2 years ago
  • Profile image

    hey @spefyjerbf is it possible to output the targets heading direction to degrees?

    3.2 years ago
  • Profile image
    161k spefyjerbf

    @FuriousChicken Not sure yet. Feel free to make some recommendations!

    3.6 years ago
  • Profile image

    When will your next build be @spefyjerbf ?

    3.6 years ago
  • Profile image
    2,355 PvPSky

    Edit: scratch that, found the announcement. Took a while.

    3.7 years ago
  • Profile image

    There are going to be so many B-17's in the next few months... I just hope the Brit bombers get some love, especially the Lancaster and the Sunderland.

    +1 3.7 years ago
  • Profile image
    161k spefyjerbf

    @Dad Depends on the sort of turn. Something sudden cannot be predicted.

    3.7 years ago
  • Profile image

    Here’s a question: can you make the turret predict the location that an aircraft will be in if it’s turning?

    3.7 years ago
  • Profile image

    Great

    3.7 years ago
  • Profile image
    161k spefyjerbf

    @NumbersNumbersTheMan Looks like they beat me to it. I can't look at the code, but I've heard that it works pretty well!

    3.7 years ago