Jump to content

Determine airbase runway direction/heading from within script


Recommended Posts

Posted

Is it possible to determine an airbase's runway static orientation (heading) from within a script or would I have to build up a table myself based on out-of-game chart information?

 

I don't mean a bearing for an in-flight aircraft to a particular airbase.

Posted
I believe that the table data you are looking for is in /Bazar/Terrain/Beacons.lua (Airdrome).

 

That's an interesting file. If I have to, I'll just make a table in my script, but I'd prefer to use some lua script way to get that information. As I learned, I can't access the functions or databases listed in native *.lua files from my own lua script.

 

In my script, I'm getting the airbase coordinates like this:

 _spawnairdromeId = spawnIndex.id 
_spawnairbaseloc = Object.getPoint({id_=spawnIndex.id_})
_spawnairplanepos = {}
_spawnairplanepos.x = _spawnairbaseloc.x
_spawnairplanepos.z = _spawnairbaseloc.z

I was hoping to somehow get the airbase orientation, heading, or bearing so I could spawn aircraft just above the runway but headed down the runway.

 

I can't seem to control the aircraft initial heading from adding that info when I dynamically spawn. Best I can figure is to spawn the aircraft with its next waypoint at the other end of the runway. So at least it will spawn pointed the correct heading and travel over the runway.

 

But in order to do that, I'll need a list of runway angle orientations.

Posted

I had trouble setting initial heading as well. I don't know if you're doing this or not, but there is a unit parameter 'psi' that needs to be set to the reciprocal heading. I did it like this:

 

["psi"] = -heading,

  • 2 months later...
Posted

If anyone cares to know, here's the table of the beginning and ending points for each runway...

 

g_airbasePoints = 					-- These are the start and end x,z points for each airbase runway in the direction of normal take-off traffic
{								-- Use for the fly over points when spawning aircraft airborne
								-- {x1, z1, x2, z2, psi, heading}
	[12] = {-6495.7142857133,242167.42857143,-4321.7142857133,244091.42857143,-0.724468306690539,0.724468306690539},	-- Anapa-Vityazevo
	[13] = {11751.428571429,369204.85714286,11620.000000001,366703.71428572,1.62329544850684,-1.62329544850684},		-- Krasnodar-Center
	[14] = {-40248.857142856,279856.28571428,-41589.428571427,278650.57142857,2.40910735155739,-2.40910735155739},		-- Novorossiysk
	[15] = {-5579.7142857133,295210.57142857,-7585.9999999991,293555.14285714,2.45172058746978,-2.45172058746978},		-- Krymsk
	[16] = {-25197.428571427,459052.57142857,-27686.57142857,457036.28571429,2.46076441819486,-2.46076441819486},		-- Maykop-Khanskaya
	[17] = {-49706.57142857,298970.28571429,-51087.142857141,297810.85714286,2.44303961565279,-2.44303961565279},		-- Gelendzhik
	[18] = {-163750.28571428,463622.57142857,-165212.85714286,460870,2.05920616746982,-2.05920616746982},			-- Sochi-Adler
	[19] = {6652.2857142863,386738.57142858,8764.8571428577,389003.71428572,-0.820235909742805,0.820235909742805},		-- Krasnodar-Pashkovsky
	[20] = {-221401.14285714,566015.71428571,-219751.42857143,562707.14285714,1.10825468264437,-1.10825468264437},		-- Sukhumi-Babushara
	[21] = {-197811.42857143,517063.14285714,-195622.28571428,515849.42857143,0.506233740419563,-0.506233740419563},	-- Gudauta
	[22] = {-356549.42857143,618419.42857144,-355121.14285714,616421.14285715,0.95023583247859,-0.95023583247859},		-- Batumi
	[23] = {-281681.14285714,646054,-281882.28571429,648431.42857143,4.62798477132166,-4.62798477132166},			-- Senaki-Kolkhi
	[24] = {-318368,634520.57142858,-317545.42857143,636779.14285715,-1.22234030943342,1.22234030943342},			-- Kobuleti
	[25] = {-285233.71428571,682650.57142857,-284543.14285714,685056.85714286,-1.29132089859535,1.29132089859535},		-- Kutaisi
	[26] = {-52128.285714285,707572.28571429,-50388.857142856,703892.28571429,1.12925011719757,-1.12925011719757},		-- Mineralnye Vody
	[27] = {-125580.57142857,759479.14285715,-124274.85714286,761378.00000001,-0.968419584342998,0.968419584342998},	-- Nalchik
	[28] = {-83740.571428571,832212.57142857,-83294.857142857,835718.57142857,-1.44434563501146,1.44434563501146},		-- Mozdok
	[29] = {-316481.42857143,897668.85714286,-314624.28571428,895291.42857143,0.90765164013325,-0.90765164013325},		-- Tbilisi-Lochini
	[30] = {-316999.71428571,894496.57142857,-318664,896327.71428572,3.97469042602364,-3.97469042602364},			-- Soganlug
	[31] = {-318175.14285714,902274.28571429,-319966.57142857,904036.85714286,3.91887137165303,-3.91887137165303},		-- Vaziani
	[32] = {-148494.57142857,842108,-148685.42857143,845221.42857144,4.65116431906051,-4.65116431906051}			-- Beslan
}

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...