Jump to content
killshot

setDir/setFormDir varying values

Recommended Posts

Hey everybody!

 

I have saved 4 different positions and their relative directions to spawn a unit, but unit's direction never matches the one I saved.

 

First, this is the code I am using:

_pos = [
                [3144.13,3984.86,1.24656],
                [3148.41,3982.62,1.1283],
                [3148.64,3979.73,1.10767],
                [3153.13,3977,1.0178]
];
_dir = [16.0291,308.932,328.367,320];
_dice = count _pos;
_dice = floor (random _dice);    
_grp = createGroup EAST;
_unit = _grp createUnit ["O_G_Soldier_F", markerPos "marker", [], 0, "NONE"];
_unit setPosATL (_pos select _dice);
sleep 1;
_unit allowFleeing 0;
_unit setDir(_dir  select _dice);
_unit setUnitPos "MIDDLE";

I check unit's direction after it's creation with _dirTarget = getDir cursorTarget; hint str(_dirTarget);

 

For example my last 3 spawns:

 

Instead of 308.9 it's 338.9

Instead of 328.3 it's 358.3

Instead of 16.02 it's 0.011

 

How is that possible and how am I able to stop this behaviour? It's driving me crazy, because I need them quite accurate.

 

I tried with different sleep values, with and without allowFleeing or setUnitPos. I don't get it.

 

 

Kind Regards.

Share this post


Link to post
Share on other sites

Thank you so much kk, you made my night, I was getting kind of frustrated.

 

I would have never thought of combining them...

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

×