Profile image

Ship AA Gun(Auto Targeting)

30.1k BlackThuNDR  4.2 years ago
3,275 downloads

My First Funky Trees craft

Free as the successor

aa

This an Automatic targeting Anti Aircraft system

After leaning some funky trees code I try create myself n thx God I can do it.

Here the code

Vertical Driver

inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 1500)))

Horizontal drive

(((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / 1500)))/ 180) * clamp01(TargetDistance < 5000) * clamp01(TargetDistance > 1)

I happy to help n Share to other. Hope it usefull

See ya next time

Note

This is Anti aircraft system. Maybe if u remakes it into aircraft Aim assist it will doesn't Matching

Thx for the Spotlight & Upvote

Spotlights

General Characteristics

  • Successors 2 airplane(s) +63 bonus
  • Created On Android
  • Wingspan 24.6ft (7.5m)
  • Length 7.8ft (2.4m)
  • Height 5.0ft (1.5m)
  • Empty Weight 11,920lbs (5,407kg)
  • Loaded Weight 12,240lbs (5,552kg)

Performance

  • Wing Loading 439,839.3lbs/ft2 (2,147,483.6kg/m2)
  • Wing Area 0.0ft2 (0.0m2)
  • Drag Points 3980

Parts

  • Number of Parts 47
  • Control Surfaces 0
  • Performance Cost 149
  • Log in to leave a comment
  • Profile image

    @BlackThuNDR I was doing some testing with the expressions (code) given. I added them into a rotator (horizontal) and hinge rotator (vertical) and the variable expersion (box with the X in at the bottom right; add variable, input expression into expression and give it any short name). I discovered at first it didn't work but by going to the rotators I reversed it's rotation (normal settings; cog icon on right side when selected) and it worked for both ground and air aim assist. I tested it with 2 miniguns and then with 1 350mm max velocity minimal length cannon, so far it seems to work as an aim assist if all inputs are adjusted. To add the expressions to the rotator just select one then XML edit it with the "</>" option in the bottom right and go to input, changing "VTOL" to "Funky", then saving it with the checkmark at the bottom right of the UI that appears; it will allow you to click on it in the normal settings menu to add an expression such as those here.

    Also added some basic info in the above paragraph for people who also want to read. Might be useful, not 100% tested.

    Pinned 1.9 years ago
  • Profile image
    30.1k BlackThuNDR

    @NormalPioneer so used this
    Vertical(hidge or rotator)

    inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 3000)))

    Horizontal (Rotator only)

    (((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / 3000)))/ 180) * clamp01(TargetDistance < 10000) * clamp01(TargetDistance > 2)

    ======{

    -Put ur gun velocity as 3000
    -if horizontal rotator shake u, dis increase ur horizontal rotator speed(recommend 20%)
    -make sure ur horizontal rotator can spin till 180°
    -Reduce gun recoil (max reduce 0.05 i recommend)
    - it can locked enemy up to 5-6 mil

    Pinned 4.2 years ago
  • Profile image
    30.1k BlackThuNDR

    @NormalPioneer

    if wanna increase range :

    -first Increase ur gun velocity
    -then re-coding the code with
    Vertical drive

    inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / ur gun velocity)))

    horizontal drive

    (((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / ur gun velocity)))/ 180) * clamp01(TargetDistance < Trigger range 1) * clamp01(TargetDistance > trigger range 2)

    Note

    -gun velocity & trigger lock must an number

    Example:

    U already set gun velocity as 4000
    So the code is

    Vertical drive(Hidge or rotator)

    inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 4000)))

    Horizontal drive (must rotator)

    (((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / 4000)))/ 180) * clamp01(TargetDistance < 10000) * clamp01(TargetDistance > 2)

    ==============

    I recommend to double the Trigger range( if trigger 1 was "15000" the trigger 2 will be "3"

    But the trigger 1 = "10000"
    Trigger 2 = "2"
    Is enough to lock about 5mil

    Range or effective is come from The gun,

    XML the gun velocity & spread to be more focused

    This code maybe doesn't work on Simpleplane Version 1.9

    Pinned 4.2 years ago
  • Profile image
    30.1k BlackThuNDR

    If had some questions comment below

    Pinned 4.2 years ago
  • Profile image
    30.1k BlackThuNDR

    Place the code in "Input"

    Pinned 4.2 years ago
  • Profile image

    @BlackThuNDR using this I encountered a problem that I can't find a fix for the horizontal rotator only rotates if the target is within a certain radius of where the gun is facing so it turns to the right but not the left but it will turn to the left of it's already turned to the right once you switch targets any idea on how to fix this so it turns 360 degrees without issue

    +1 10 months ago
  • Profile image
    2,443 Dest20345

    I am using you aa on my Ship will come out soon I hope

    +1 1.4 years ago
  • Profile image
    2,443 Dest20345

    I am using you aa on my Ship will come out soon I hope

    +1 1.4 years ago
  • Profile image
    1,336 MrVocab

    Yoink

    +1 1.7 years ago
  • Profile image
    30.1k BlackThuNDR

    @CommanderSponge thx for further explanation and testing them

    1.9 years ago
  • Profile image

    @BlackThuNDR hey, how can you do this on simplerockets 2 rotators?

    2.2 years ago
  • Profile image

    is this specifically for machine guns only? can i use cannon?

    3.0 years ago
  • Profile image
    30.1k BlackThuNDR

    @Ilikeacecombat sure

    3.1 years ago
  • Profile image
    32.8k Cereal

    great and I can shoot anything

    3.6 years ago
  • Profile image
    30.1k BlackThuNDR

    @qwsd123 have u reverse the rotation?

    3.6 years ago
  • Profile image
    214 qwsd123

    Horizontal rotator doesnt work

    3.6 years ago
  • Profile image
    3,433 stevemc01

    @BlackThuNDR Ok thanks. I'll credit you in the final piece.

    +1 3.7 years ago
  • Profile image
    30.1k BlackThuNDR

    @stevemc01
    At Vertical

    inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 4000)))

    Horizontal

    (((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / 4000)))/ 180) * clamp01(TargetDistance < 10000) * clamp01(TargetDistance > 2)

    4000 on code is velocity for the Gun

    Also u can change the velocity as u want

    3.7 years ago
  • Profile image
    3,433 stevemc01

    Which number do you change to adjust shell velocity? I wanna make a 3'/50cal deck gun for a submarine test (yeah USS Gato).

    +1 3.7 years ago
  • Profile image
    30.1k BlackThuNDR

    @Kubol1221 It must work on 1.9, how about u update to 1.10

    3.7 years ago
  • Profile image
    1,138 Kubol1221

    @BlackThuNDR 1.9

    +1 3.7 years ago
  • Profile image
    30.1k BlackThuNDR

    @Kubol1221 what ur current sp version?

    3.8 years ago
  • Profile image
    1,138 Kubol1221

    it's not work

    3.8 years ago
  • Profile image
    30.1k BlackThuNDR

    @Superunknown010 u mean movement auto targeting yes?... Its can just for land vehicles and Naval but u need setting the code ur own (for horizontal driver, make sure it can rotate 360°)
    .
    Note: it could be hard to setting horizontal than vertical... So u need little longer to setup the function..
    .
    Tips: if the horizontal aim at target but goes wrong direction, U need to setting the invert
    .
    If they still wrong at aiming
    Then change the positive(+) sign with negative (-) sign at this code or opposite both of the sign
    (((TargetHeading - Heading) + (rate(TargetHeading) * (TargetDistance / 3000)))/ 180) * clamp01(TargetDistance < 10000) * clamp01(TargetDistance > 2)
    Note:
    - or + isnt an mathematical used to calculate the Distance, but mean for negative (-) or positive (+) to lead the direction
    .
    Sorry if u dont understand with my explanation

    In the point : it can be mobile by vehicle exept plane, but u need make it function as well as supposed

    4.0 years ago
  • Profile image

    @BlackThuNDR no I mean like the code, how do I change like the roll into this: ?inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 1500)))

    4.0 years ago
  • Log in to see more comments