Jump to content

Recommended Posts

I have a Darter that I'm giving a waypoint through scripting commands. I need the waypoint to be very precise (i.e. I need it to reach those coordinates exactly). I'm using the addWaypoint scripting command for this. I've noted that in the comments for that scripting page, it says "The waypoint may not be created exactly at the center position even if radius is zero. The position will be moved away if there are e.g. rocks at the center position or if it is placed at the edge of water on a shore." Since I'm using a UAV, I don't really care about rocks or water and I want it to just go to the proper waypoint. However, the game is adjusting the waypoint when I create it, by as much as 50 meters. Here's the code I'm using:

_waypointPos = [3800, 13000, 30];_wp = (group _vehicle) addWaypoint [_waypointPos, 0];
_wp setWaypointType "HOLD";
_wp setWaypointCompletionRadius 0;
_vehicle flyInHeight (_waypointPos select 2);
But if I do that, and then run the following code:
systemChat format["Actual waypoint pos: %1", waypointPosition _wp];
it shows that the new waypoint has actually been set at [3779,12989,30]. I have tried everything I can think of to force it to the correct position, including setWaypointPosition, setWPPos, and trying different waypoint types other than "HOLD". Nothing seems to be working. Does anyone have an idea of how to force it to use the specified waypoint and not let it make any adjustments? I'm going crazy here.

Share this post


Link to post
Share on other sites

What about setPos ? Why do you need it to be exactly at this position.

Share this post


Link to post
Share on other sites

setPos will place it at the exact position, yes. But it will just "jump" to that position, whereas I need it to fly there smoothly.

Share this post


Link to post
Share on other sites

Cool idea, but unfortunately I need to be able to set dynamic waypoints (I can't pre-record them because I don't know where they'll be).

Share this post


Link to post
Share on other sites

All vehicles in Arma have a config value called 'precision'. If a vehicle is given a waypoint, no matter if you set the completion radius smaller than this value, the waypoint will always complete at a 2D distance of 'precision'. If its the last waypoint the vehicle may come to a stop closer than this dependant on its current velocity when the waypoint completes.

I believe this is a fail safe so doing things like giving a fast moving plane a waypoint with 0 radius stops it from circling forever because the pilot is unable to hit the tiny waypoint area.

Even units have a default precision of 1m, most ground vehicles range between 5-15m, helicopters 100m and planes 200m.

 

The UAV has a precision 15m, you can see this by giving one a waypoint somewhere and in its waypoint statement hinting its distance to destination on completion...

wp = group driver uav1 addWaypoint [getposatl h1,0];

wp setWaypointStatements ["true","hint str ( [ uav1, h1 ] call BIS_fnc_distance2D ) "];

The hint will usually be around 14.##m depending on the UAVs speed as it enters it and usually comes to a stop around 8-9m out from its destination.

 

 

Even doing something like..

waypointPos = getPosATL h1 vectorAdd [ 0, 0, 30 ];

wp = (group uav1) addWaypoint [waypointPos, 0];

wp setWaypointStatements ["true","

    h = this spawn {

        while { [ _this, waypointPos ] call BIS_fnc_distance2D > 0 } do {

            _this doMove waypointPos;

            hint str ( [ _this, waypointPos ] call BIS_fnc_distance2D );

            waitUntil { unitReady _this };

        };

    };

"];

uav1 flyInHeight (waypointPos select 2);

Will show it, sometimes wildly, repositioning but always coming back as ready when its within the 15m radius (concluding that precision is also relevant to doMove aswell) and never settling on the precise position.

 

 

If it must be pinpoint accurate to the position i think your only option is once it has completed its waypoint and reports as ready to setpos its position. May look ugly but otherwise i think you are out of luck.

Share this post


Link to post
Share on other sites

All vehicles in Arma have a config value called 'precision'. If a vehicle is given a waypoint, no matter if you set the completion radius smaller than this value, the waypoint will always complete at a 2D distance of 'precision'. If its the last waypoint the vehicle may come to a stop closer than this dependant on its current velocity when the waypoint completes.

I believe this is a fail safe so doing things like giving a fast moving plane a waypoint with 0 radius stops it from circling forever because the pilot is unable to hit the tiny waypoint area.

Even units have a default precision of 1m, most ground vehicles range between 5-15m, helicopters 100m and planes 200m.

 

The UAV has a precision 15m, you can see this by giving one a waypoint somewhere and in its waypoint statement hinting its distance to destination on completion...

wp = group driver uav1 addWaypoint [getposatl h1,0];

wp setWaypointStatements ["true","hint str ( [ uav1, h1 ] call BIS_fnc_distance2D ) "];

The hint will usually be around 14.##m depending on the UAVs speed as it enters it and usually comes to a stop around 8-9m out from its destination.

 

 

Even doing something like..

waypointPos = getPosATL h1 vectorAdd [ 0, 0, 30 ];

wp = (group uav1) addWaypoint [waypointPos, 0];

wp setWaypointStatements ["true","

    h = this spawn {

        while { [ _this, waypointPos ] call BIS_fnc_distance2D > 0 } do {

            _this doMove waypointPos;

            hint str ( [ _this, waypointPos ] call BIS_fnc_distance2D );

            waitUntil { unitReady _this };

        };

    };

"];

uav1 flyInHeight (waypointPos select 2);

Will show it, sometimes wildly, repositioning but always coming back as ready when its within the 15m radius (concluding that precision is also relevant to doMove aswell) and never settling on the precise position.

 

 

If it must be pinpoint accurate to the position i think your only option is once it has completed its waypoint and reports as ready to setpos its position. May look ugly but otherwise i think you are out of luck.

 

I think you're discussing a different issue here. You're saying that the UAV will report as waypoint completed even if it isn't specifically at its waypoint. This issue I can fix (I think) by just changing the "precision" for that vehicle in an addon/mod from 15 down to 0.1 or something.

 

The issue I'm asking about is how to prevent the waypoint itself from being placed in a different location than I want. i.e. regardless of when the UAV decides the waypoint has been completed, the following code should return exactly the same coordinates as the ones I specified in "addWaypoint":

systemChat format["Actual waypoint pos: %1", waypointPosition _wp];

Whereas by default it returns a slightly different position.

Share this post


Link to post
Share on other sites

Oh ok lol, you know i read your OP several times thinking why does he say 50m yet the precision for a UAV is 15m, I put it down to not enough coffee at 5am :) .

 

Is there a reason you are using a waypoint? are there chained waypoints after this one or things that need syncing to the waypoint?

If not (not including the precision complication of doMove) then it may be easier to script it.

If it does need to be a waypoint due to further waypoints or syncing, maybe look into scripted waypoints. examples of which can be found in "CfgWaypoints" and "\a3\functions_f\waypoints" which are available when placing a waypoint by changing the dropdown category to Advanced.

 

Your own do not necessarily need to be config defined, a script can be called by placing a waypoint of type 'scripted' and filling the script box with the script filename and an array of upto 4 arguments (all of which can be accomplished through setWaypointType and setWaypointScript). This could give you finer control over what you need to accomplish. Ignore the note on the Wiki - 'Note the On Activation script code block can be used to execute any script at any waypoint, making this waypoint type somewhat redundant.' as a scripted waypoint is how the waypoint is accomplished NOT what it does once you get there which is what the activation is.

 

Just an idea that maybe a valid solution, as i cannot think of another way to precisely pinpoint a waypoint position.

Share this post


Link to post
Share on other sites

Oh ok lol, you know i read your OP several times thinking why does he say 50m yet the precision for a UAV is 15m, I put it down to not enough coffee at 5am :) .

 

Is there a reason you are using a waypoint? are there chained waypoints after this one or things that need syncing to the waypoint?

If not (not including the precision complication of doMove) then it may be easier to script it.

If it does need to be a waypoint due to further waypoints or syncing, maybe look into scripted waypoints. examples of which can be found in "CfgWaypoints" and "\a3\functions_f\waypoints" which are available when placing a waypoint by changing the dropdown category to Advanced.

 

Your own do not necessarily need to be config defined, a script can be called by placing a waypoint of type 'scripted' and filling the script box with the script filename and an array of upto 4 arguments (all of which can be accomplished through setWaypointType and setWaypointScript). This could give you finer control over what you need to accomplish. Ignore the note on the Wiki - 'Note the On Activation script code block can be used to execute any script at any waypoint, making this waypoint type somewhat redundant.' as a scripted waypoint is how the waypoint is accomplished NOT what it does once you get there which is what the activation is.

 

Just an idea that maybe a valid solution, as i cannot think of another way to precisely pinpoint a waypoint position.

 

I was using waypoints just because I'm not familiar with anything else that will cause a UAV to fly to a given position (I want it to use its own control loop, i.e. have it pitch more in higher wind, etc.). All I need is for the UAV to fly to a precise given location, and to figure out how it needs to pitch/bank/thrust to get there. Looking at a scripted waypoint, I don't think that will work because I would have to script a path for it to follow, and it wouldn't figure that out for itself.

Share this post


Link to post
Share on other sites

Its basically nothing more than a helicopter with a invisible pilot so anything you would use on a helicopter and its pilot (driver), doMove, commandMove, waypoints, flyinHeight etc

I very much doubt there is any base/openFlight Xcopter type simulation going on, hence the reason it always turns to face the direction its going to fly in.

The invisible UAV pilot has a different simulation base but im guessing these are just routines to handle UAV connectivity.

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

×