dmarkwick 261 Posted July 30, 2007 A while back people were very helpful in suggesting ways for me to get wind strength, which turned out to look like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_WindStrength = (SQRT((wind select 0)^2 + (wind select 1)^2)); Now, for two rather cool micro-projects, I need to know the wind direction too. Can any maths gurus suggest a formula for getting wind direction? I suggest using wind select 0 and wind select 1 as I only need lateral direction. They will give you a positive or negative number depending on wind direction and speed, which should give you a vector from which a direction should be got, using some sort of trigonometry witchcraft I expect Share this post Link to post Share on other sites
mtlgd 0 Posted July 31, 2007 http://community.bistudio.com/wiki/wind I would suspect it works on the same principle as VectorDir does for players. 0,1,0 for north..... Mtl Share this post Link to post Share on other sites
mtlgd 0 Posted July 31, 2007 I was wrong, doesn't work out quite the same, interesting though, appears to have a slight updraft if this read vaguely the same. Share this post Link to post Share on other sites
ManDay 0 Posted July 31, 2007 You know what cosine and sine are? Share this post Link to post Share on other sites
ManDay 0 Posted July 31, 2007 Heard of tangent as well? :P Share this post Link to post Share on other sites
t_d 47 Posted July 31, 2007 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_fVectorLength = { sqrt( ((_this select 0)^2)+((_this select 1)^2)+((_this select 2)^2) ) }; _fVectorDotProduct = { private["_v1","_v2"]; _v1=_this select 0; _v2=_this select 1; (_v1 select 0)*(_v2 select 0) + (_v1 select 1)*(_v2 select 1) + (_v1 select 2)*(_v2 select 2) }; _fVectorAngle = { private["_v1","_v2","_v1l","_v2l"]; _v1=_this select 0; _v2=_this select 1; _v1l=_v1 call _fVectorLength; _v2l=_v2 call _fVectorLength; acos(([_v1,_v2] call _fVectorDotProduct)/(_v1l*_v2l)) }; _wind2D = [wind select 0, wind select 1, 0]; _angle = [_wind2D,[0,1,0]] call _fVectorAngle; _windDir = if((_wind2D select 0) < 0)then{360 - _angle}else{_angle}; Share this post Link to post Share on other sites
raedor 8 Posted July 31, 2007 A bit easier...<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_wind = wind; hint ("Wind dir: " + str ((_wind select 0) atan2 (_wind select 1))) Share this post Link to post Share on other sites
Master85 1 Posted July 31, 2007 ... and with full 360° ... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_wind = wind; hint str((((_wind select 0) atan2 (_wind select 1)) + 360) mod 360); Share this post Link to post Share on other sites
dmarkwick 261 Posted July 31, 2007 Ooh thanks guys atan2 was exactly the thing Share this post Link to post Share on other sites
[GLT] Legislator 66 Posted October 9, 2007 Hmm very interesting. This script only shows the wind strength, right? Is it possible to influence the wind strength depending on meteological data? I had the idea of influencing the behaviour of air vehicles during a huge storm and connecting it with mission. Share this post Link to post Share on other sites