Profile image

Help with Autoaim

61.2k Sergio666  3.2 years ago

The truth is, I have already seen some constructions of another level, and I know that I could. I would like to know how to build an autoaim gun for airplanes, because I know the theory for ground guns, but I don't think it's the same for airplanes. Thanks a lot for the help!

  • Log in to leave a comment
  • Profile image
    61.2k Sergio666

    Thank you very much everyone for the help and comment, the truth is, I totally did not know the codes to configure rotators, and I think that I still do not have enough knowledge to build it, but thanks to this great community, every day I learn a lot of things. build a machingun with autoaim.A million thanks to all for the help, I am also configuring the ailerons in PID code, but I still have problems with the motor movement.

    +1 3.2 years ago
  • Profile image
    4,347 Formula350

    @AWESOMENESS360 I don't know how much help this'll be since I'm a total ignoramous when it comes to FT... Nevertheless, can't hurt to type it!


    What I found out recently when trying to get just a NON-AI auto-aim turret to work, was that everything is based off the Cockpit always facing one direction (ie: statically oriented, not dynamic). Otherwise, as it tries to re-calculate, the turret has turned the cockpit, and basically ends up having no idea where it is or how much it needs to move; thus, spazzing out.
    .
    That also was true for having it set to being inclined at all (rotated), as if I recall from my tests a few months ago, it caused issues if I had my main cockpit (not attached to the turret) angled at even X: -2 simply for aesthetical reasons -- this would also cause the Cockpit Camera's crosshairs to be off, too.
    .
    More importantly, I believe EVERY turret code I had stumbled across, ended up being configured for a TOP mount... but I was wanting it to be a BELOW mounted bubble, on my plane. As such, up became down, left became right... but it also felt like there was even more than just that, since I would try to do the obvious of setting those Rotators to be "Inverted", except it didn't fix it.
    Ultimately, I ended up having to invert it through the FT's "control output" part of the code, since it was still technically needing to TRACK with everything oriented as up-is-up/left-is-left. So it seemed that inverting just the rotator was also impacting that part, making it think the target was moving in the opposite direction.
    [msg 1 of 2]

    3.2 years ago
  • Profile image
    4,347 Formula350

    [msg 2 of 2]


    So for what it's worth, this is what I ended up with which finally worked -- again, this was on a NON-AI build, and is for an INVERSE-MOUNTED turret (under-body):
    AG 1 = Turn Off/On Auto-Aim (locks turret to default forward-facing, guns-leveled positions); even when On, requires a Target selected to actually orient it. AG 1 Enabled = Auto-Aim Off; therefore, is On by default when you spawn.
    Machinegun: rotation: 0,0,0
    . . . . . . . . . . . . . Gun:
    . . . . . . . . . . . . . . . . .muzzleVelocity: 1200
    JointRotator-1: rotation: 0,0,180
    . . . . . . . . . . . . . ControllerInput:
    . . . . . . . . . . . . . . . . .activationGroup: -Activate1 & TargetSelected = 1 & = & (because our comment system here sucks)
    . . . . . . . . . . . . . . . . .invert: true
    . . . . . . . . . . . . . . . . .min: -1
    . . . . . . . . . . . . . . . . .max: 1
    . . . . . . . . . . . . . . . . .input: ((TargetHeading - Heading + rate(TargetHeading)*(((1200 * sin(asin((TargetDistance * 9.81)/(pow(1200, 2)))/2))/9.81) * 2))/180) * -1
    . . . . . . . . . . . . . JointRotator:
    . . . . . . . . . . . . . . . . .range: 180
    . . . . . . . . . . . . . . . . .speed: 0.5
    . . . . . . . . . . . . . . . . .damperMultiplier: 0
    HingeRotator-1: rotation: 0,0,90
    . . . . . . . . . . . . . InputController:
    . . . . . . . . . . . . . . . . .activationGroup: -Activate1 & TargetSelected = 1 & = &
    . . . . . . . . . . . . . . . . .invert: false
    . . . . . . . . . . . . . . . . .min: -0.15 - - - - (depressing/elevation, prevents clipping into fuselage)
    . . . . . . . . . . . . . . . . .max: 1
    . . . . . . . . . . . . . . . . .input: clamp(((TargetElevation + rate(TargetElevation)*(((1000 * sin(asin(TargetDistance / (pow(1000, 2)))/2))) * 2)) * -1) + (asin((((TargetDistance + rate(TargetDistance)*(((1000 * sin(asin(TargetDistance / (pow(1000, 2)))/2))) * 2)))/(pow(1000, 2)))/2) * -1),-10,45)/45
    . . . . . . . . . . . . . JointRotator:
    . . . . . . . . . . . . . . . . .range: 65 - - - - (your gun's max elevation)
    . . . . . . . . . . . . . . . . .speed: 0.4
    [NOTE: The "input" code goes off screen because there's no word-wrap, and I haven't figure out how to do Code-Blocks with our system's Markdown... If you copy my whole post into notepad that should work. Otherwise, it's just the code pulled from this build: Three-Five-Zero Division's TFZ-9UFF Twin-Prop Fighter]


    Also, while looking at my notes in my txt doc, it seems that even the auto-aiming device's _location_ in respect to the Cockpit, may impact the aiming code... As my note ends by saying that the "aiming is too low", which I presume implies that even if there was no ballistic trajectory to calculate, it'd have been off... but that's only a presumption. At least when using Cannons, since my understanding is they have bullet dro

    +1 3.2 years ago
  • Profile image

    @CC1010 no no, I’m using Miniguns. My problem is that the AI doesn’t want to fire at me even when I’m directly in front of them, and when I attach the cockpit to the turret to make sure that the cockpit is always aimed at the player, the entire thing starts spazzing out and it doesn’t work at all. This is so bizarre.

    3.2 years ago
  • Profile image
    29.7k xNotDumb

    @Sergio666 I got some codes earlier but i could not place them correctly i will check if i have them now...

    3.2 years ago
  • Profile image
    106k GuyFolk

    I personally did auto aim in 2 ways.
    1. Use ground base auto aim but have a new set of rotator to stabilize the ground base turret to eliminate the limitation about tilting the turret.
    2. Use FT magic, precisely trigonometry and some vector, basically when your plane start rolling the turret's vertical axis slowly becomes horizontal axis and turret's horizontal axis slowly becomes vertical axis so for one turret's rotator I add both horizontal and vertical aiming code to it but to use value from vertical or horizontal code (or a mix of those two) is up to trigonometry.

    Take it with a grain of salt because I still can't figure out how to make turret aim full 360 deg.

    +3 3.2 years ago
  • Profile image
    3,656 Dathcha

    To get the ai to use cannons, add a missile that has instant lock, but no thrust so it doesnt do anything. Once the ai has fired the missile, they will start using cannons. @AWESOMENESS360

    +1 3.2 years ago
  • Profile image

    @goboygo1 oh

    Well the problem that I’m finding is that when I do this, the auto turret starts spazzing out even when the cockpit has zero weight, it’s as if it’s trying to track the target and counteract the cockpit’s movement simultaneously

    +1 3.2 years ago
  • Profile image
    28.3k goboygo1

    @AWESOMENESS360 Have you tried putting the cockpit on the gun? the AI only fires if the cockpit is pointed at the target.

    +1 3.2 years ago
  • Profile image

    I’m having the same issue actually, I’m making something atm that the AI is supposed to use and it will not for the life of me fire it’s guns when set to aggressive. It only uses modded Miniguns, no cannons. Weirdest thing I’ve ever seen.

    3.2 years ago
  • Profile image
    61.2k Sergio666

    @AtlasMilitaryIndustries
    @ThomasRoderick
    @GuyFolk

    3.2 years ago