OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Eymerich on 04 Jun 2007, 10:25:16
-
Given 2 point in a 2d space (2 marker coords)
I need a coord which is in middle distance of them and with the direction of c pointing to B.
B.
C.
A.
or
A. C. (--->) B.
In other words:
Userc can choose on the map the waypoint to give to his units. Every "click" on map creates a wp on the map itself.
I'd like to put a marker (arrow) beetwen A e B (marker coords = C) "pointing" to b.
Is there a smart way to do this?
Regards
:)
-
_distance = sqrt(((getMarkerPos "mk_2" select 0)-(getMarkerPos "mk_1" select 0))^2+((getMarkerPos "mk_2" select 1)-(getMarkerPos "mk_1" select 1))^2);
_ang = ((getMarkerPos "mk_2" select 0)-(getMarkerPos "mk_1" select 0)) atan2 ((getMarkerPos "mk_2" select 1)-(getMarkerPos "mk_1" select 1));
_middle_x = (getMarkerPos "mk_1" select 0)+sin(_ang)*_distance/2;
_middle_y = (getMarkerPos "mk_1" select 1)+cos(_ang)*_distance/2;
_middle = [_middle_x, _middle_y];
-
Wow!
Thanks for the fastest answer!
:good: