Profile image

Auto-Aim Turret Tutorial

82.4k ReinMcDeer  1.4 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
    82.4k 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.4 years ago
  • Profile image
    82.4k ReinMcDeer

    @SiBangsatYa @DimitriIqbal91 Image is reposted at the bottom now

    6 hours ago
  • Profile image
    14.9k SiBangsatYa

    Yo the images error @ReinMcDeer

    2 days ago
  • Profile image

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

    7 days ago
  • Profile image
    8,362 Yish42

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

    3 months ago
  • Profile image
    82.4k ReinMcDeer

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

    6 months ago
  • Profile image
    2,276 FOXHOUND26

    how do i input the xyz

    7 months 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 11 months ago
  • Profile image
    1,729 GlowGlow03

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

    11 months 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 one year ago
  • Profile image
    60 Sundown

    thanks man

    +1 one year ago
  • Profile image
    82.4k 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 one year ago
  • Profile image
    60 Sundown

    where do i put everything from the funky trees input?

    +1 one year ago
  • Profile image

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

    +2 1.2 years ago
  • Profile image
    82.4k ReinMcDeer

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

    +1 1.2 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.2 years ago
  • Profile image
    82.4k 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.2 years ago
  • Profile image

    @ReinMcDeer

    +1 1.2 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.2 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.2 years ago
  • Profile image
    82.4k ReinMcDeer

    @MinXie I don't see why it wouldn't work for mobile. I would try looking at the turrets on my B-26 and reverse engineering them. I could also help if it still doesn't work.

    +1 1.2 years ago
  • Profile image
    0 MinXie

    @ReinMcDeer Idk at this point, I do the guide step by step and the rotors just dont do anything, I do my own thing and they do something but not what even close to being useable, and anything else I try is the same as the first problem, is this not supposed to work at all for mobile?

    +1 1.2 years ago
  • Profile image
    82.4k ReinMcDeer

    @MinXie Turret1Range disables the turret if a target is outside its range, so make sure you set it up how you need it. The way it is here is also set up to not track targets outside 2.5 km, so it could also be that.
    It's pretty hard to say what could be going on without seeing the craft

    +1 1.2 years ago
  • Profile image
    0 MinXie

    Doesnt work, pretty sure it has to do with the turret1range variable, inputting the code directly into input works but using the variables doesn’t

    +1 1.2 years ago
  • Profile image
    82.4k ReinMcDeer

    @JustMiko I'm not sure how you're getting that error since none of the FT here uses a variable named TargetLatitude. However, I do know that error means that somewhere in your variables tab, your FT is using the variable TargetLatitude, but that variable hasn't been created.

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