Jump to content
Sign in to follow this  
bangabob

getPos within X and Y

Recommended Posts

Hello. I am trying to make a unit spawn within a marker area. However this is harder than it seems.

If the marker is a perfect circle then i can use the following code since the marker is the same for both X and Y axis.

_eosMkr="m1";
_eosPOS=markerpos _eosMkr;
_eosMkrSizeX= getMarkerSize _eosMkr select 0;
_eosMkrSizeY= getMarkerSize _eosMkr select 1;

_spwnposNew = [_eosPOS,_eosMkrSizeY , random 360] call BIS_fnc_relPos;

However, if the marker is a rectangle or non-symmetrical then i can get positions outside the marker zone since my current code only draws distance from the Y size of the marker.

Thanks for reading. Any help is appreciated

Share this post


Link to post
Share on other sites

I use this method to check if something is inside ELLIPSE or RECTANGLE. Perhaps you can adapt it too.

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  

×