fn_distance2D.sqf 448 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Name: cTab_fnc_distance2D
  3. Author(s):
  4. Gundy
  5. Description:
  6. Calculate the 2D distance between two positions
  7. Parameters:
  8. 0: ARRAY - 2D or 3D position
  9. 1: ARRAY - 2D or 3D position
  10. Returns:
  11. FLOAT - Distance
  12. Example:
  13. [getPosATL player, [0,0,0]] call cTab_fnc_distance2D;
  14. */
  15. private ["_pos1","_pos2"];
  16. _pos1 = _this select 0;
  17. _pos2 = _this select 1;
  18. // set height to 0;
  19. _pos1 set [2,0];
  20. _pos2 set [2,0];
  21. _pos1 distance _pos2