Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get_orientation = {
- _pos_1 = _this select 0;
- _pos_2 = _this select 1;
- _x1 = (_pos_1) select 0;
- _x2 = (_pos_2) select 0;
- _y1 = (_pos_1) select 1;
- _y2 = (_pos_2) select 1;
- _good_x_op = (_x1) - (_x2);
- _good_y_op = (_y1) - (_y2);
- _good_orientation = (_good_x_op atan2 _good_y_op);
- if (_good_orientation > 0) then {
- _good_orientation = 180 - _good_orientation;
- }
- else {
- if (_good_orientation < 0) then {
- _good_orientation = (abs _good_orientation) + 180;
- }
- else {
- _good_orientation = 0;
- };
- };
- if (_good_orientation >= 270.125) then {
- _good_orientation = _good_orientation - 270.125;
- }
- else {
- if (_good_orientation < 270.125) then {
- _temp_val = 270.125 - _good_orientation;
- _good_orientation = 360 - _temp_val;
- };
- };
- _good_orientation;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement