spinter Posted May 22, 2013 Posted May 22, 2013 I can to help solve this problem? Point A Target Point B My Plane Direction My Plane: 90 Direction to take for the goal: 123 How can I calculate this degree to my plane? It should be about 220! ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
sobek Posted May 22, 2013 Posted May 22, 2013 (edited) What direction is it you want to know, the direction your plane has to fly to get to the target? Do you mean course with your aircraft and not a compass as reference? If so, in your picture, the direction to take for the goal is modulo(123+180, 360) = 237° if direction_goal >= direction_airplane course = direction_goal - direction_airplane else course = 360 - direction_airplane + direction_goal end This is all pseudo code because i'm not intimately familiar with lua. Edited May 22, 2013 by sobek Good, fast, cheap. Choose any two. Come let's eat grandpa! Use punctuation, save lives!
spinter Posted May 22, 2013 Author Posted May 22, 2013 Great, thanks very close but we had managed wrong my course is your right thanks! my error if ely_mia_direzione > 180 then dir_1= (360 - ely_mia_direzione) + (ely_direzione_oby) else dir_1 = ely_direzione_oby - ely_mia_direzione end ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
sobek Posted May 22, 2013 Posted May 22, 2013 You're welcome. :) Good, fast, cheap. Choose any two. Come let's eat grandpa! Use punctuation, save lives!
Headspace Posted May 22, 2013 Posted May 22, 2013 Quickest way: Take the arctangent of the result of dividing the rise over the run from the aircraft to target. Convert result to degrees and then add degrees based on quadrant.
Recommended Posts