Jump to content
Sign in to follow this  
scottb613

DirTo X/Y COS/TAN

Recommended Posts

Hi Folks,

 

OK - school was a long time ago - yet I think my math is correct... This is my first attempt at Arma scripting and I am trying to make a medium sized air assault compatible with both Arma 2 and Arma 3 (hooked on the old Unsung)...  I'm trying to identify a good IP (_wpip) some distance prior to the LZ (_wplz) when an air assault is inbound from BASE (_wpbs)... After marking the point with green smoke - it's very apparent the point I am calculating doesn't seem to be anywhere near being inline between the BASE and LZ... I did read not to use radians - that COS and SIN just take the actual angle as input... Any idea where I went wrong  - as I said school was a long time ago ???

// var - LZ pad and BASE pad //
_wplz = getPos LzPad;
_wpbs = getPos BsPad1;

// var - direction/distance from LZ to BASE for IP //
_disip = 250;
_dirip = nil;

// get LZ position and break down array //
_arrX = _wplz select 0;
_arrY = _wplz select 1;
_arrZ = _wplz select 2;
	
// get slick IP waypoint - bearing relative to start posit //
_dirip = [_wplz, _wpbs] call BIS_fnc_dirTo;
_arrXn = ((cos _dirip) * _disip) + _arrX;
_arrYn = ((sin _dirip) * _disip) + _arrY;
_wpip = [_arrXn,_arrYn,_arrZ];
	
// green smoke for identifying position //
_1Rnd_SmokeGreen_GP25 = "G_40mm_SmokeGreen" createVehicle _wpip;

Thanks...

 

Regards,

Scott

Share this post


Link to post
Share on other sites

Hi Folks,

Please disregard - I found a reference where BIS did it a bit bass ackwards - you need to swap the SIN/COS functions from normal use to accommodate...

_arrXn = ((sin _dirip) * _disip) + _arrX;
_arrYn = ((cos _dirip) * _disip) + _arrY;
Regards,

Scott

Share this post


Link to post
Share on other sites

Hi - thanks kid - yeah - each new thing I try to do has me searching the wiki for functions that allow me to complete the task at hand - appreciate the pointers - I'll take a gander...

Regards,

Scott

Sent from my iPhone using Tapatalk

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  

×