Jump to content
Sign in to follow this  
ashram 1-1

Waypoint sometimes not placed where expected when using addWaypoint

Recommended Posts

Hi Folks, couldn't find any mention of this problem elsewhere.

Any ideas why 3 out of 6 waypoints are created in a different position to the markers, even though the same position _pos is used when creating both?

http://imgur.com/U1bPzSw

I noticed it with an ArmA II script i was reworking last night and decided best to do a simple test today. (code below)

Seems i was not going crazy from scripting into the small hours... the waypoints are often placed quite inaccurately.

Don't recall this ever happening in A2.

Adding

_wp setWaypointPosition [_pos, 0];

doesn't subsequently snap the waypoint to the desired position.

It's like the engine is "refusing" to place the waypoint there for some reason unknown to me.

Strange... :raisebrow:

Thanks for any insights, Sam

//testwp.sqf
//p1: group

private["_grp","_mrk","_pos","_wp"];

_grp=_this select 0;

{

//get random position
_pos=[getPos leader _grp,(random 150) + 50,random 360]call BIS_fnc_RelPos;


//draw marker
_mrk = createMarker ["Marker_"+str(_pos select 0),_pos];
_mrk setMarkerAlpha 0.5;
_mrk setMarkerType "mil_circle_NoShadow";
_mrk setMarkerColor "ColorRed";
_mrk setMarkerText str _x;

//add waypoint
_wp = _grp addWaypoint [_pos, 0];
_wp setWaypointSpeed "LIMITED";
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "AWARE";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointDescription "Patrol";
_wp setWaypointFormation "STAG COLUMN";

}forEach [1,2,3,4,5,6];

Share this post


Link to post
Share on other sites

I just tried it half a dozen time and it's working 100% for for me.

I know markers can be a little off when used on moving vehicles but even that is working ok.

It would be interesting to know the actual locations of the Waypoints and compare them to the marker position to see if it's difference or just a visual difference.

Share this post


Link to post
Share on other sites
I just tried it half a dozen time and it's working 100% for for me.

I know markers can be a little off when used on moving vehicles but even that is working ok.

It would be interesting to know the actual locations of the Waypoints and compare them to the marker position to see if it's difference or just a visual difference.

Hi, Thanks a lot for taking the time to check this and your reply.

The reason i noticed this was because i was not checking waypoint completion, or distance of the team(leader) from the waypoint to see if they had reached their goal, but checking distance from the position variable.

Admittedly in retrospect, a strange way to go about it, but the script worked fine this way in A2. Team would always reach their goal and be allocated a new destination because the waypoint was aligned with the generated destination.

However, in A3 the script "broke" for me because team's movement will sometimes never be judged completed with that method due to these placement discrepancies i described; they don't get to _pos, they reach the nearby waypoint and just sit there with no new orders being issued.

So I can say from that it's not just a visual issue.

I will output the waypoint and marker positions to see if there is an actual difference in the x,y,z co-ordinates.

It was very simple to fix by adding an extra check to see if waypoint itself is reached/completed, which to be honest is probably how i should have done it in the first place!

I just was and remain curious about it really. Maybe some impurity in the Belgian electricity supply making my PC act strangely, if it's fine for you... ;)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×