The one im using is technically working. The turrets move when an enemy is close enough, but they dont aim at the enemy. Does anyone have any formulas for me?
What is a good formula that I can use for AA turrets on a b17?
49 TheGreatLordDerptah
3.2 years ago
Look in my favorites there's at least one turret.
@LieutenantSOT That would be great, thank you.
@TheGreatLordDerptah okay
.
Hmm. Yeah, sorry. I really don't know how to help here. I might be redoing two turrets on my upcoming build to be autoaim rather than manual aiming, just to remove the need to freeze the control surfaces, but the code I have rn would act unrealistically as it doesn't apply rotational boundaries on the weapon, or account for distance from the cockpit.
.
If you'd like, I can play around with your code and see if I can get it to work?
@LieutenantSOT Yes I've got different code for roll and elevation. One formula from both pairs is elevation, and the remaining two are roll.
okay, that code was a LITTLE more complex than I expected.
Based on the trigonometry involved, I'd guess this code accounts for lead, as well as shooting on it's own? Huh. I'm not this advanced at FT yet, but maybe check capitalization. One of the codes might be spelt wrong, input wrong, or maybe the whole tag works weird
.
Also, are you putting a different code in for the roll and elevation? They should probably be slightly different from each other
@TheGreatLordDerptah ...
https://www.simpleplanes.com/a/4m4YOd/Boeing-B-17G-Nine-O-Nine
@LieutenantSOT im using someone else's b17. all im doing is adding the auto aim. i'll try and find a link to the plane
@LieutenantSOT I've got two pairs of formulas, neither of which worked.
Pair 1: clamp((deltaangle(TargetHeading,Heading) - (rate(TargetHeading) * ((TargetDistance) / 800)))/ 180,0,0.7) * clamp01(TargetDistance < 15000) * clamp01(TargetSelected)
Activate4?(atan(((pow(800,2)) - (sqrt((pow(800,4)) - (9.81 * ((9.81 * pow((cos(TargetElevation) * TargetDistance), 2)) + ((2 * ((sin(TargetElevation) * TargetDistance))) * pow(800,2)))))))/(9.81 * (cos(TargetElevation) * TargetDistance))) + rate(TargetElevation) * (TargetDistance / 800)) / 90:0
Pair 2: clamp(((atan((TargetDistance * sin(deltaangle(TargetHeading,Heading - 90))) / (TargetDistance * cos(deltaangle(TargetHeading,Heading - 90)) + 0))) - (rate(TargetHeading) * (TargetDistance / 1500)))/ 180, -0.4,0.4) * clamp01(TargetDistance < 5000) * clamp01(TargetDistance > 1) * clamp01((deltaangle(TargetHeading,Heading - 90)) < 72 & (deltaangle(TargetHeading,Heading - 90)) > -72)
clamp(inverselerp(0,90,TargetElevation + (rate(TargetElevation) * (TargetDistance / 1500))), -0.11, 0.7) * clamp01(TargetDistance < 5000) * clamp01(TargetElevation > -10 & TargetElevation < 63)
If you're using the (TargetHeading) /90 one, the cockpit is what it bases where it's aiming from, so you should move the cockpit near the center of the aircraft, and add a camera to the cockpit
What formula are you using?