Jump to content

Mission Editor Bearing Bug Fix


Case
 Share

Recommended Posts

The Problem

The ruler tool in the Flaming Cliffs 2.0 and Black Shark mission editors returns the wrong bearings. Due to the difference between the map in the editor, which is spherical, and the map in the game, which is flat, the bearing measured in the editor can be off by as much as 4 to 7 degrees. This will makes lining up units with features on the map very tedious.

 

bearing.png

 

The Solution

Replace BlackShark\modules\me_map_window.lua for LockOn Flaming Cliffs 2.0 and/or DCS:Black Shark with the file in the attachment below.

 

The attachment changes the code in BlackShark\modules\me_map_window.lua from

--local x1,z1 = Roads.xz(tape.points[1][1].x, tape.points[1][1].y)
--local x2,z2 = Roads.xz(tape.points[1][2].x, tape.points[1][2].y)
--local dist = base.math.floor(base.math.sqrt((x1-x2)*(x1-x2)+(z1-z2)*(z1-z2))+0.5)
local lat1 = tape.points[1][1].x
local long1 = tape.points[1][1].y
local lat2 = tape.points[1][2].x
local long2 = tape.points[1][2].y
local dist = base.math.floor(db.getDist(lat1, long1, lat2, long2))
--local ang = base.math.mod(base.math.floor(360+90-base.math.atan2(lat2-lat1, long2-long1)*180/base.math.pi), 360)
local cos = base.math.cos;
local sin = base.math.sin;
local atan2 = base.math.atan2;
local pi  = base.math.pi;
       
local dl = long2 - long1;
ang = atan2(sin(dl)*cos(lat2), cos(lat1)*sin(lat2) - sin(lat1)*cos(lat2)*cos(dl));		

to

local x1,z1 = Roads.xz(tape.points[1][1].x, tape.points[1][1].y)
local x2,z2 = Roads.xz(tape.points[1][2].x, tape.points[1][2].y)
local dist = base.math.floor(base.math.sqrt((x1-x2)*(x1-x2)+(z1-z2)*(z1-z2))+0.5)
--local lat1 = tape.points[1][1].x
--local long1 = tape.points[1][1].y
--local lat2 = tape.points[1][2].x
--local long2 = tape.points[1][2].y
--local dist = base.math.floor(db.getDist(lat1, long1, lat2, long2))
--local ang = base.math.mod(base.math.floor(360+90-base.math.atan2(lat2-lat1, long2-long1)*180/base.math.pi), 360)
--local cos = base.math.cos;
--local sin = base.math.sin;
local atan2 = base.math.atan2;
local pi  = base.math.pi;
       
--local dl = long2 - long1;
--ang = atan2(sin(dl)*cos(lat2), cos(lat1)*sin(lat2) - sin(lat1)*cos(lat2)*cos(dl));		
ang = atan2(z2-z1,x2-x1)

 

Essentially, the bug was that the bearing was calculated for the spherical mission editor map, not on the flat game map.

me_map_window.rar

  • Like 6

There are only 10 types of people in the world: Those who understand binary, and those who don't.

Link to comment
Share on other sites

+1

 

That's great! Any idea if there's a fix for the LAT/LONG coordinates as well?

[sigpic]http://www.virtualthunderbirds.com/Signatures/sig_LD.jpg[/sigpic]

Virtual Thunderbirds, LLC | Sponsored by Thrustmaster

 

Corsair 750D Case | Corsair RM850i PSU | ASUS ROG MAXIMUS X CODE | 32GB Corsair DDR4 3200 |

Intel i7-8086K | Corsair Hydro H100i v2 Cooler | EVGA GTX 1080 Ti FTW | Oculus Rift |

X-Fi Titanium Fatal1ty | Samsung SSD 970 EVO 1TB NVMe | Samsung SSD 850 EVO 1TB | WD Caviar Black 2 x 1TB |

TM HOTAS Warthog | TM Pendular Rudder | TM MFD Cougar Pack | 40" LG 1080p LED | Win10 |

Link to comment
Share on other sites

+1

 

That's great! Any idea if there's a fix for the LAT/LONG coordinates as well?

 

The mapping from Lat/Long to in-game x,y is complicated. This is because an Gnomonic projection is used to project the spherical surface onto a flat plane. The formulae for the projection (and its inverse) can be found in the following thread:

 

http://forums.eagle.ru/showthread.php?t=44427

 

For the working Java code I wrote for LEAVU2 (including a bugfix by Yoda) see the MapProjection class in the LEAVU2 source code at:

 

http://kenai.com/projects/leavu2/sources/subversion/content/LeavuGeneralClasses/src/nav/MapProjection.java

Link to comment
Share on other sites

Brilliant mate - now about the babies ... I was pi**ed when I said it and I have this no womb problem ... can we negotiate.
At the moment I have no need for babies, so it's your lucky day :D
  • Like 1

There are only 10 types of people in the world: Those who understand binary, and those who don't.

Link to comment
Share on other sites

  • 3 weeks later...
Brilliant mate - now about the babies ... I was pi**ed when I said it and I have this no womb problem ... can we negotiate.

 

At the moment I have no need for babies' date=' so it's your lucky day :D[/quote']

 

Dont let the whole no-womb thing be a problem guys. Arnie got round that one ! :megalol:

 

picture.php?albumid=333&pictureid=2689

[sIGPIC][/sIGPIC]

i7 9700k | 32gb DDR4 | Geforce 2080ti | TrackIR 5 | Rift S | HOTAS WARTHOG | CH PRO Pedals

Link to comment
Share on other sites

Is this already part of Blindspot'sME from version 1.6?

If it is not, if I install this modman file on top of Blindspot'sME will I break something? Since Blindspot'sME comes with own me_map_window.lua.

Do you have any information how the mission plays when copied to computers without the mod? Any misalignment then? Or over multiplayer?

51PVO Founding member (DEC2007-)

100KIAP Founding member (DEC2018-)

 

:: Shaman aka [100☭] Shamansky

tail# 44 or 444

[sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer

Link to comment
Share on other sites

This fix does not affect multiplayer and missions made with a ME using the fix will play perfectly on machines with the ME without the fix.

There are only 10 types of people in the world: Those who understand binary, and those who don't.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 years later...

Unfortunately I have to reopen this old topic of FC2 for a problem that I'm experiencing between editor and cdu entries in the A-10C ...

 

If you try to measure the distance and the bearing of the editor to reach a target starting from the bullseye when I insert data in the CDU by Oset of my A-10C, they lead me off course ... I get the impression that the problem detected in FC2 is also transferred to the DCS World ... Can someone test how to mè exposed and see if it is my problem or the simulator?

 

thanks

[sIGPIC]index.php?action=dlattach;topic=17112.0;attach=7646;image[/sIGPIC]

 

www.36stormovirtuale.net

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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