Ship AA Gun(Auto Targeting)
30.1k BlackThuNDR
4.2 years ago
My First Funky Trees craft
Free as the successor
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
Specifications
Spotlights
- Y 4.2 years ago
- TWDDerSharkmarine 4.2 years ago
- Y33TM33XD 4.2 years ago
- DisguisedMonkey 4.2 years ago
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
@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.
@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
@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
If had some questions comment below
Place the code in "Input"
@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
I am using you aa on my Ship will come out soon I hope
I am using you aa on my Ship will come out soon I hope
Yoink
@CommanderSponge thx for further explanation and testing them
@BlackThuNDR hey, how can you do this on simplerockets 2 rotators?
is this specifically for machine guns only? can i use cannon?
@Ilikeacecombat sure
great and I can shoot anything
@qwsd123 have u reverse the rotation?
Horizontal rotator doesnt work
@BlackThuNDR Ok thanks. I'll credit you in the final piece.
@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
Which number do you change to adjust shell velocity? I wanna make a 3'/50cal deck gun for a submarine test (yeah USS Gato).
@Kubol1221 It must work on 1.9, how about u update to 1.10
@BlackThuNDR 1.9
@Kubol1221 what ur current sp version?
it's not work
@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
@BlackThuNDR no I mean like the code, how do I change like the roll into this: ?inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 1500)))