Advertisement
RamireDu06

Untitled

Nov 17th, 2020
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. get_orientation = {
  2. _pos_1 = _this select 0;
  3. _pos_2 = _this select 1;
  4.  
  5. _x1 = (_pos_1) select 0;
  6. _x2 = (_pos_2) select 0;
  7.  
  8. _y1 = (_pos_1) select 1;
  9. _y2 = (_pos_2) select 1;
  10.  
  11. _good_x_op = (_x1) - (_x2);
  12. _good_y_op = (_y1) - (_y2);
  13.  
  14. _good_orientation = (_good_x_op atan2 _good_y_op);
  15.  
  16. if (_good_orientation > 0) then {
  17. _good_orientation = 180 - _good_orientation;
  18. }
  19. else {
  20. if (_good_orientation < 0) then {
  21. _good_orientation = (abs _good_orientation) + 180;
  22. }
  23. else {
  24. _good_orientation = 0;
  25. };
  26. };
  27.  
  28. if (_good_orientation >= 270.125) then {
  29. _good_orientation = _good_orientation - 270.125;
  30. }
  31. else {
  32. if (_good_orientation < 270.125) then {
  33. _temp_val = 270.125 - _good_orientation;
  34. _good_orientation = 360 - _temp_val;
  35. };
  36. };
  37.  
  38. _good_orientation;
  39. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement