Suggest adding ILS instrument landing and VOR navigation
FightingPickles opened this issue ยท 4 comments
I think the ability fly and land by instrument navigation would significantly expand the flight capabilities of MTS/IV. Navigation points could potentially be stored in a json file which contains information on location and navigation frequency. I'm down to tackle making the cockpit instruments if needed. Requires addition of a couple variables for instruments to reference. Here's the basic code in Python ( I don't know java so this was the fastest way I could check the code), though this certainly isn't the only or even best way of doing it.
import math
navX = input("nav x")
navY = input("nav y")
navZ = input("nav z")
playerX = input("player x")
playerY = input("player y")
playerZ = input("player z")
vector = input("vector")
navType = input("type")
navX = float(navX)
navY = float(navY)
navZ = float(navZ)
playerX = float(playerX)
playerY = float(playerY)
playerZ = float(playerZ)
vector = float(vector)
navDistance = math.sqrt((playerX - navX)**2 + (playerZ - navZ)**2) #distance formula
navAngle = (math.atan2((navZ - playerZ),(navX - playerX)) * -180/3.1415926565 + 90) % 360 # lateral bearing from player to nav point
glideslopeAngle = math.atan((playerY - navY)/navDistance) * 180/3.1415926535 # vertical angle from nav point to player
deviationAngle = navAngle - vector # number of degrees difference between intended heading and bearing to nav point
if ((-90 < deviationAngle) and (deviationAngle < 90)): #set to or from flag for course deviation indicator
ToFrom = "TO"
else:
ToFrom = "FROM"
if ((navType == "VOR") and (ToFrom == "FROM")):
if (((navAngle-vector+180) % 360) >180):
deviationAngle = ((navAngle - vector + 180) % 360) - 360
else:
deviationAngle = (navAngle - vector + 180) % 360
elif (navType == "ILS"): #increase lateral sensitivity for ILS
deviationAngle = deviationAngle*4
print("Distane = " , navDistance)
print("Angle to nav point = " , navAngle)
print("Deviation from intended course = " , deviationAngle)
print("Glideslope to nav point = " , glideslopeAngle)
print("You are headed " , ToFrom , " the nav point")
Shouldn't be too hard to get this to work code-wise. The only issue I see is how to select the ILS/VOR markers. Thoughts?
My thought would be include a frequency tag in each ILS/VOR record (and possibly a broadcast range too) then there is a nav radio on the HUD, with a dial or button (could be a text box but that's probably more work and less realistic) to change the frequency. To make the VOR navigation 100% realistic there also needs to be a dial to select what your intended radial on the VOR. But I also want the implementation to be friendly and easy to use for people who play the mod, so I'm open to help brainstorm other ideas. That's pretty much how it works in a real plane. A cheapie solution would be to just lock onto the closest one within a certain radius. Here is a pretty good video about using VOR navigation
https://www.youtube.com/watch?v=iCCk2ch-xL4
Another more "minecrafty" solution would be to make a "navigational chart" item which held in the active hand (or left hand) selects a specific nav point. That would also provide a solution for storing the data in a world save. That might require the addition of a new flight planning gui bench where you would prepare a navigational chart by telling it where the point is located and what approach you want, then hit the green button and it spits out a new nav chart for you. Then while flying you put that chart in your active hand and the instruments come alive.