OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: myke13021 on 08 Oct 2007, 01:18:22
-
Hi
I'm trying to make a simple weather report script (showing actual weather and an average forecast, really really simple) and i run into troubles to get wind direction and speed. I know that the command "wind" does return a vector but as a complete idiot in maths, i don't know how to treat these values to get a wind direction and a wind speed.
If someone could help me out at this point, it would be great.
Myke out
P.S.
Looked at seven's sniper/spotter script but he's using particle to determine wind data. I like to use the wind command.
-
Direction of the wind (-180 to +180 from North):
_windDirInDegrees = (wind select 0) atan2 (wind select 1);
Direction of the wind (0 to 360 from North):
_windDirInDegrees = (((wind select 0) atan2 (wind select 1)) + 360) mod 360;
For the wind speed:
_windSpeedInMetresPerSecond = sqrt (((wind select 0) ^ 2) + ((wind select 1) ^ 2) + ((wind select 2) ^ 2));
_windSpeedInKilometersPerHour = _windSpeedInMetresPerSecond * 3.6;
I think the particle method of determining wind pre-dates the wind command, so just use the command.
-
thx Spooner
i can be arsed with these math, great work!
Myke out
:EDITH:
Works like a charm. Solved and closed.