Jump to content

Photo
- - - - -

Formula to convert "wind"-values into degree (0-359) ?


  • Please log in to reply
3 replies to this topic
Thread Starter
roguetrooper
roguetrooper

    Master Sergeant

  • Members
  • 672 posts

Posted 26 March 2012 - 17:54 #1

Since I'm not an expert in maths, does anyone know a/the formula to convert the wind-values into a number (0-359 degree)?

Further, is there a possibility to return the wind force in knots and km/h ?

wind
setWind

MadDogX
MadDogX

    Mindless F@nb0!

  • Moderator
  • 9050 posts

Posted 26 March 2012 - 18:13 #2

This should get you the direction in degrees:

(wind select 0) atan2 (wind select 1)

Note that wind does have a vertical direction, but I think that is safe to ignore. As for the wind strength:

sqrt((wind select 0)^2 + (wind select 1)^2)
This will give you the correct value, but I'm not sure what unit the wind command returns. Meters per second perhaps?


EDIT: Looks like the atan2 command doesn't return values in the 0...359 range, but rather -180...+180. Easy enough to convert though.

Edited by MadDogX, 26 March 2012 - 18:29.


Gigabyte Z97-HD3 Motherboard | Intel Core i5 4690k @ 4.5GHz | NVidia GTX 970
16GB G-Skill Ripjaws 2133MHz RAM | Kingston HyperX SSD | be Quiet! 750W PSU

Thread Starter
roguetrooper
roguetrooper

    Master Sergeant

  • Members
  • 672 posts

Posted 27 March 2012 - 15:35 #3

Thanks for the formulas. Is there a dev or anyone else who certainly knows the speed the wind command returns?

dna
dna

    BI Developer

  • 1702 posts

Posted 28 March 2012 - 07:33 #4

Further, is there a possibility to return the wind force in knots and km/h ?


The wind vector is meters per second if I'm not mistaken. You can convert numbers (note: not vectors) to different units using BIS_fnc_convertUnits. Check the in-game function viewer in the editor on how to use it. This is a scripted function, so performance is slower than true script command.

[32, 2, 9] call BIS_fnc_convertUnits; //Convert 32 mps to kts

Bohemia Interactive
Arma 3 - Project Lead
Watch us, tweet us, poke us

Take On Helicopters - Project Lead
Take On Noisecontrollers!