Working ILS
Using the power of trigonometry, a working ILS dial is possible in SimplePlanes!
It is designed so you can change where the code thinks the runway threshold is in the map. Currently it only works in Wright, runway 00. It has both localizer and glideslope
If you think you understand this, here is the code:
Wright Runway 00 Activation Parameters:
Latitude > -15522 & Latitude < -5522 & Longitude > -3981 & Longitude < 16019 & Altitude < 10072.5424
Wright Runway 00 Localizer Code:
0.1 * (clamp01(Longitude > 6019) * 10 + (80 + (clamp((atan(clamp((Latitude + 5522), -10000, 0) / (clamp((Longitude - 6019), -1763, 1763)))), -89.9999, -80))) + -clamp01(Longitude < 6019) * 10 - (80 - (clamp((atan(clamp((Latitude + 5522), -10000, 0) / (clamp((Longitude - 6019), -1763, 1763)))), 80, 90))))
Wright Runway 00 Glideslope Code:
0.5 * clamp((80 - (-1 * (clamp((atan(clamp((Latitude + 5522), -10000, 0) / (clamp((Altitude - 72.5424), -1763, 1763)))), -89.9999, -70)))), -2, 2)
Generic Activation Parameters Code:
Latitude > ThresholdLatitude - 10000 & Latitude < ThresholdLatitude & Longitude > ThresholdLongitude - 10000 & Longitude < ThresholdLongitude + 10000 & Altitude < ThresholdAltitude + 10000
Generic Glideslope Code:
0.5 * clamp((80 - (-1 * (clamp((atan(clamp((Latitude + ThresholdLatitude), -10000, 0) / (clamp((Altitude - ThresholdAltitude), -1763, 1763)))), -89.9999, -70)))), -2, 2)
Generic Localizer Code:
0.1 * (clamp01(Longitude > ThresholdLongitude) * 10 + (80 + (clamp((atan(clamp((Latitude ThresholdLatitude), -10000, 0) / (clamp((Longitude ThresholdLongitude), -1763, 1763)))), -89.9999, -80))) + -clamp01(Longitude < ThresholdLongitude) * 10 - (80 - (clamp((atan(clamp((Latitude ThresholdLatitude), -10000, 0) / (clamp((Longitude ThresholdLongitude), -1763, 1763)))), 80, 90))))
Instructions:
Replace ThresholdLongitude with the longitude of the threshold. If the value is greater than zero, subtract it. Add it if it's less than zero. For the longitudes after the two "clamp01"s, don't add or subtract. Replace ThresholdLatitude with the latitude of the threshold. If the value is greater than zero, subtract it. Add it if it's less than zero. Replace ThresholdAltitude with the altitude of the threshold.
Note
It doesn't work on runways which don't have a heading of 0. I have plans to fix this in the future.