Profile image

Auto-Aim Turret Tutorial

95.0k ReinMcDeer  1.9 years ago

Auto-Aim Turret Tutorial

I've been seeing a lot of players here asking how to do auto-aim and not being able to figure it out, so I wanted to make a definitive tutorial since it is actually not that hard.


I may or may not also be using this for a current project.

This uses the turret FT made by SenSkysh, so all credits go to them. They also have a video tutorial in the comments of the linked post, but it can be a bit hard to follow.

NOTE: THIS TUTORIAL IS DESIGNED FOR COMPUTER USERS, BUT IT SHOULD BE POSSIBLE ON MOBILE AS LONG AS YOU CAN USE GOOGLE SHEETS.

Step 1
Go to this spreadsheet. Then, click File/Make a copy. Name your new file autoaim or whatever you fancy. A new window will open with your new spreadsheet. Once you have done this once, you can skip this step, as you now have the spreadsheet.

Step 2
In SimplePlanes, create your turret. You need a rotator for your heading (horizontal traverse) and elevation (vertical traverse). IMPORTANT: Change your rotators to 10 degrees rotation!


Here is what mine looks like. I have colored the rotators yellow.

Step 3

Now, we have to do some funky trees. I have named my turret Turret1, but you can name it whatever you want.


Funky Trees inputs: Please refer to this as you go. This is an image since the website still doesn't support less than or greater than in the code text. Plus, hopefully, you'll learn better by actually typing this out.

[VARIABLES]
Open your variables tab and add these variables.

[PART : ROTATOR : HEADING]
Put this into your heading rotator input.

[PART : ROTATOR : ELEVATION]
Put this into your elevation rotator input.

The purple text is required to ensure that the turret returns to zero when there is no target or the target is outside the turret's range. If you still want the turret aim at a target outside its range to the best of its ability, remove the blue text in Turret1Range.

Notice that we have a 0.1 multiplier because our rotator is 10 degree rotation, which will translate an input of 1 into a rotator output of 1 degree. This is required because the turret code will output the degrees of required rotation.

[VARIABLE : TURRET1RANGE]
In the variables tab, put this into the variable Turret1Range. The blue text will disable the turret when a target is outside its range. The angles should match your minimum/maximum heading/elevation and the distance is arbitrary and optional.

[PART : GUN]
Put this into your wing gun/gatling gun/cannon activationGroup. The green text is optional and will make your gun start shooting when it has been on target for a certain amount of time. A smaller smooth value will increase this time.

The red text is optional and will make your turret activate with an activation group (in this case, AG2).

Step 4

Now, lets refer back to the spreadsheet.

First, we must input the XYZ coordinates of our cockpit. We then input the XYZ coordinates of the turret. IMPORTANT: Use a comma for the decimal!

Then, check the boxes if you want the turret to lead the target (you probably do) and if your turret is a cannon. Then, input the velocity of your turret's projectiles.

Input the Left Angle, Right Angle, Up Angle, and Down Angle. These are the minimum/maximum heading/elevation in degrees. IMPORTANT: Left Angle and Down Angle should be negative. Then, input your start heading. 0 is forward-facing, 90 is right-facing, 180 is rear-facing, and so on. You can also input the roll position if necessary.

Using these values, the spreadsheet will spit out the code you need.

Step 5

Now, we input the actual turret code. In the spreadsheet, click the cell containing the elevation code and copy the text using RMB/Copy or Ctrl+C. Now, go to SimplePlanes, open the variables tab, and paste this code into the Turret1Elev variable with Ctrl+V. Repeat for heading and Turret1Hdg.

Now, if you have done everything correctly, you should have a turret!

IMAGE REPOSTED HERE SINCE DISCORD STOPPED IMAGE HOSTING

  • Log in to leave a comment
  • Profile image
    95.0k ReinMcDeer

    Please no T's in the comments. This is a tutorial and I don't want comments related to the tutorial to get pushed down by unnecessary stuff.

    Pinned 1.9 years ago
  • Profile image
    95.0k ReinMcDeer

    @Kenzar If it's the code from the spreadsheet, you have to input your own values into the spreadsheet and get the code from there

    6 months ago
  • Profile image
    10.6k Kenzar

    @ReinMcDeer Yes but I am sure the code I'd from here

    6 months ago
  • Profile image
    95.0k ReinMcDeer

    @Kenzar Was the code you borrowed for a rear facing turret?

    6 months ago
  • Profile image
    10.6k Kenzar

    @ReinMcDeer hi, I want to use this and the turret is on front of the aircraft. It only tracks targets behind. I'm using some of your code that may be different than the tutorial as I borrowed it from someone else. How do I fix this?

    6 months ago
  • Profile image
    1,700 Mk1Els

    @ReinMcDeer I don't see any image here in this post

    6 months ago
  • Profile image
    95.0k ReinMcDeer

    @SiBangsatYa @DimitriIqbal91 Image is reposted at the bottom now

    +2 6 months ago
  • Profile image
    15.7k SiBangsatYa

    Yo the images error @ReinMcDeer

    6 months ago
  • Profile image

    Le images gone don't know how to do this no more :(

    6 months ago
  • Profile image
    8,845 Yish42

    How am i supposed to remember all what i have to write?

    9 months ago
  • Profile image
    95.0k ReinMcDeer

    @FOXHOUND26 click the cockpit and open the nudge editor to see the xyz coordinates
    And then do the same for the turret

    one year ago
  • Profile image

    how do i input the xyz

    1.1 years ago
  • Profile image

    For anyone who gets an error about an invalid variable or something, clicking "Make a copy" created a broken copy of the spreadsheet that gave me that error.

    To get the correct version I needed to right-click the blue square at the bottom, then select "Copy to > New spreadsheet".

    +4 1.5 years ago
  • Profile image
    2,264 GlowGlow03

    How do you make it aim accurately when flying? I'm trying to use this for a gunner

    +1 1.5 years ago
  • Profile image

    what xyz values do i put into where my turret is if its a whole bunch of scattered parts? do i use just the heading rotator's values? also, the lead angle is never correct.

    +1 1.6 years ago
  • Profile image
    135 Sundown

    thanks man

    +1 1.6 years ago
  • Profile image
    95.0k ReinMcDeer

    @Sundown You should have variables Turret1Elev, Turret1Hdg, and Turret1Range, which is where the elevation, heading, and range FT go.

    In the rotators, you should have Turret1Elev and Turret1Hdg as your inputs. The FT for the gun goes into the activation group.

    +1 1.6 years ago
  • Profile image
    135 Sundown

    where do i put everything from the funky trees input?

    +1 1.6 years ago
  • Profile image

    okay, thank you! i will try to figure out the rest on my own :)

    +2 1.7 years ago
  • Profile image
    95.0k ReinMcDeer

    @idiotace5000 Type Turret1Hdg into the menu for the horizontal rotator and Turret1Elev into the menu for the vertical rotator.

    +1 1.7 years ago
  • Profile image

    @ReinMcDeer i know what it saying funky means, but, i dont know what to/how to type what your telling me to type into the menu

    +1 1.7 years ago
  • Profile image
    95.0k ReinMcDeer

    @idiotace5000 The inputs for your rotators being Funky means that it will allow you to type your own FT code into the input, which is the menu you are seeing.
    The inputs should be Turret1Elev and Turret1Hdg.

    +1 1.7 years ago
  • Profile image

    @ReinMcDeer

    +1 1.7 years ago
  • Profile image

    i think i might be figuring it out but i would still appreciate help.. i just set the input in InputController to FunkyTrees in overload, was i supposed to do that? it has now opened a different menu when i click on the "funky" input button

    +1 1.7 years ago
  • Profile image

    hey im not sure how to use the variable editor.. like.. what name do i set and where do you tell me what the expressions to put in are

    +1 1.7 years ago
  • Log in to see more comments