gromit190 Posted November 8, 2016 Share Posted November 8, 2016 Hello, The "addGroup" function takes a "heading" as an argument to position the unit when spawning it. I need this heading to be the same as heading as a previously spawned unit. I reckon I get the heading of the previously spawned unit from this function. But how do I convert it to a single number "heading" needed for the addgroup function? Best regards, gromit190 Autonomous ground AI project Link to comment Share on other sites More sharing options...
sea2sky Posted November 8, 2016 Share Posted November 8, 2016 (edited) function getHeading(unitpos, northCorrection) if unitpos then local Heading = math.atan2(unitpos.x.z, unitpos.x.x) if northCorrection then Heading = Heading + northCorrection end if Heading < 0 then Heading = Heading + 2*math.pi -- convert to rad end return Heading end end You may want to provide northCorrection for a true north heading. Edited November 8, 2016 by sea2sky i5-9600K@4.8GHz ★ 32Gb DDR4 ★ Asus TUF rtx3080 OC ★ Quest Pro ★ Warthog on Virpil base Link to comment Share on other sites More sharing options...
gromit190 Posted December 20, 2016 Author Share Posted December 20, 2016 Thank you! Can you please eloborate on why I need correction for a "true" north heading? Autonomous ground AI project Link to comment Share on other sites More sharing options...
ESAc_matador Posted December 20, 2016 Share Posted December 20, 2016 Thank you! Can you please eloborate on why I need correction for a "true" north heading? In F10 map, you have geographic North... In aircrafts, usually you have magnetic North... the correction depends on where are you flying. The game gives you Geographic, usually, since it is based on map. Caucasus magnetic = geographic - 6° Nevada magnetic = geographic - 11° Link to comment Share on other sites More sharing options...
gromit190 Posted December 20, 2016 Author Share Posted December 20, 2016 (edited) I see, thanks :-) Edited January 11, 2017 by gromit190 Autonomous ground AI project Link to comment Share on other sites More sharing options...
Recommended Posts