samir17864 44 Posted July 22, 2023 Hello everyone, I have a script creating 2 waypoints, _wp1 and _wp2 200 meters far from each other ... I want to add a 3rd waypoint on the same vector between _wp1 and _wp2 and 200 meters far from _wp2 (in other words i want the 3 waypoints to form a straight line) ... How to do that ?? Thanks in advance 😊 wp1 ------------- 200m -------------------- wp2 ------------- 200m -------------------- wp3 (the 3 waypoints should form a straight line) Share this post Link to post Share on other sites
Harzach 2517 Posted July 22, 2023 36 minutes ago, samir17864 said: I have a script Show your code! 2 Share this post Link to post Share on other sites
pierremgi 4898 Posted July 23, 2023 position of wp3: private _pos = waypointPosition _wp2 getPos [200, waypointPosition _wp1 getDir waypointPosition _wp2]; example: group player addWaypoint [_pos,0]; 1 Share this post Link to post Share on other sites
samir17864 44 Posted July 23, 2023 _pos1 = [player, 200, 200, 5, 0, 20, 0] call BIS_fnc_findSafePos; _pos2 = [_pos1, 200, 200, 5, 0, 20, 0] call BIS_fnc_findSafePos; _wp1 = group player addWaypoint [_pos1, 0]; _wp2 = group player addWaypoint [_pos2, 1]; @Harzach: As you can see: position1 can be randomly anywhere 200m away from the player, position2 is also randomly 200m away from position1 ... I need position3 to be on the same straight line between position1 and position2. 9 hours ago, pierremgi said: position of wp3: private _pos = waypointPosition _wp2 getPos [200, waypointPosition _wp1 getDir waypointPosition _wp2]; example: group player addWaypoint [_pos,0]; @pierremgi, it worked. this is great. 💚 Share this post Link to post Share on other sites
samir17864 44 Posted July 23, 2023 9 hours ago, pierremgi said: position of wp3: private _pos = waypointPosition _wp2 getPos [200, waypointPosition _wp1 getDir waypointPosition _wp2]; example: group player addWaypoint [_pos,0]; here is the code the resulting code: _pos1 = [player, 200, 200, 5, 0, 20, 0] call BIS_fnc_findSafePos; _pos2 = [_pos1, 200, 200, 5, 0, 20, 0] call BIS_fnc_findSafePos; _wp1 = group player addWaypoint [_pos1, 0]; _wp2 = group player addWaypoint [_pos2, 1]; _pos3 = waypointPosition _wp2 getPos [200, waypointPosition _wp1 getDir waypointPosition _wp2]; _wp3 = group player addWaypoint [_pos3, 2]; Every time I run this code, it gives me 3 waypoints 200m separated from each other and they are all on straight line. Share this post Link to post Share on other sites
pierremgi 4898 Posted July 23, 2023 As side note, if you write _wp2 = group player addWaypoint [_pos2, 1]; Here, 1 doesn't mean second waypoint (0,1,2,..) but 1 m radius, as shown in BIKI link. Syntax is :groupName addWaypoint [center, radius, index, name] Index and name are optional. Usually, you can let the radius to zero (see also -1 in specific cases), and skip the index, because you add waypoints in the script order. Simple as that. Share this post Link to post Share on other sites
samir17864 44 Posted July 25, 2023 On 7/23/2023 at 4:47 PM, pierremgi said: As side note, if you write _wp2 = group player addWaypoint [_pos2, 1]; Here, 1 doesn't mean second waypoint (0,1,2,..) but 1 m radius, as shown in BIKI link. Syntax is :groupName addWaypoint [center, radius, index, name] Index and name are optional. Usually, you can let the radius to zero (see also -1 in specific cases), and skip the index, because you add waypoints in the script order. Simple as that. Yes, I did note that and fixed it ... Thanks Major pierremgi ☺️ Share this post Link to post Share on other sites