Jump to content

getMagneticDeclination(vec2) - please allow us access to this data


cfrag

Recommended Posts

While we know that in Caucasus the mag declination is evenly around +6.5 across the entire map and eternity, this is very different for other maps (for example SA has very different magnetic declination for different locations, Normandy has different declinations for different years). In order for mission designers to create long-lasting (server) or far-reaching missions, it sometimes would be helpful if mission designers could access a location's magnetic declination much like they can access a terrains height via land.getHeight(vec2)

So I would propose a sister-method 

land.getMagDeclination(vec2)

for mission scripters to access a map's current local magnetic declination. The information itself seems present for each map, just not accessible for Lua scripts, so I'm hoping for an API extension in this regard.

Thank you very much

-ch


Edited by cfrag
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Addendum: 

It appears that most of the pieces are in place already, but access to the magVar API is currently walled off. To access it, people must de-sanitize 'require', which places it out of bounds for most missions. So my request is to bridge magvar.init() and magvar.get_mag_decl() for normal mission scripting.

Here's the relevant thread from 2022:

 

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

I don't know if it helps, but you can get the magnetic variation (some contries call this declination) for an aircraft (mod) using true heading minus magnetic heading.

 

	local true_hdg = (360-(sensor_data.getHeading()*degrees_per_radian)) -- true heading
	local mag_hdg = (sensor_data.getMagneticHeading()*degrees_per_radian) -- magnetic heading
	local mvar = true_hdg - mag_hdg 
	current_hdg:set(mag_hdg) -- magnetic heading
	current_mvar:set(mvar) -- magnetic Variation

 

Link to comment
Share on other sites

  • 2 months later...
On 1/11/2024 at 12:57 PM, Fresh said:

I don't know if it helps, but you can get the magnetic variation (some contries call this declination) for an aircraft (mod) using true heading minus magnetic heading.

 

	local true_hdg = (360-(sensor_data.getHeading()*degrees_per_radian)) -- true heading
	local mag_hdg = (sensor_data.getMagneticHeading()*degrees_per_radian) -- magnetic heading
	local mvar = true_hdg - mag_hdg 
	current_hdg:set(mag_hdg) -- magnetic heading
	current_mvar:set(mvar) -- magnetic Variation

 

Does this require MOOSE or MIST? 

Does this work in MP and SP?

Also why do you give the qualifier (mod) ? 


Edited by Elphaba
Link to comment
Share on other sites

@Exorcet @BIGNEWY Hi again. Do you think you can get this as a high priority fix please? I can't use scripting to set a ship into wind on multiple maps because the variation is so high (e.g. the South Atlantic map completely breaks this).

I think it's really wrong we'd have to de-sanitise DCS on servers / player's PC's just to get the variation amount, especially as you already show it on the moving compass rose on the F10 map.


Edited by Elphaba
Link to comment
Share on other sites

  • ED Team
8 minutes ago, Elphaba said:

Do you think you can get this as a high priority fix please?

I am sorry but no, I can mention it to the team, but can not promise anything. We have much higher priority bugs, tweaks and wishes in the queue. 

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

On 3/22/2024 at 1:46 PM, BIGNEWY said:

I am sorry but no, I can mention it to the team, but can not promise anything. We have much higher priority bugs, tweaks and wishes in the queue. 

Hi

That's totally fair, but perhaps, someone could just stop the requirement to desanitise DCS to be able to 'require "magvar"' and just put the magvar stuff into the core libraries where it should really be. I can see no reason why that most basic of piloting information (mag variation) is walled off behind sanitisation... 

Thanks

 

  • Like 1
Link to comment
Share on other sites

On 3/22/2024 at 2:29 PM, Elphaba said:

Does this require MOOSE or MIST? 

Does this work in MP and SP?

Also why do you give the qualifier (mod) ? 

 

Hi Elphaba,

the code I posted was code I used in an aircraft mod (VNAO T-45C), in the cockpit/scripts folder. I didn't realise the OP was referring to missions scripts. Sorry for getting your hopes up.

Are you trying to make the ship turn into wind? Have you tried the AirBoss Moose script?

Fresh

Link to comment
Share on other sites

4 hours ago, Fresh said:

Hi Elphaba,

the code I posted was code I used in an aircraft mod (VNAO T-45C), in the cockpit/scripts folder. I didn't realise the OP was referring to missions scripts. Sorry for getting your hopes up.

Are you trying to make the ship turn into wind? Have you tried the AirBoss Moose script?

Fresh

I am writing my own library, I won't use MOOSE.

I'm not just doing it for aircraft carriers, but for any ship that can take a helo.

I've worked it out too thank, both sanitised and de-sanitised. (Sanitised has a 2 degree error but I think that's and ED engine issue. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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