{"name":"BIS_fnc_rotateVector2D","operator":null,"title":"BIS fnc rotateVector2D","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_rotateVector2D","revid":348898,"updated":"2023-11-08T14:39:55Z","groups":["Vectors"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"This function returns a 2D vector rotated a specified number of degrees around the origin.","syntaxes":[{"syntax":"[vector2D, angle] call BIS_fnc_rotateVector2D","since":null,"effect":null,"exec":null,"params":[{"name":"vector2D","type":"Array","optional":false,"default":null,"description":"2D vector","types":["Array"],"since":null,"text":"vector2D: Array - 2D vector"},{"name":"angle","type":"Number","optional":false,"default":null,"description":"angle in degree","types":["Number"],"since":null,"text":"angle: Number - angle in degree"}],"returns":{"type":"Array","types":["Array"],"description":"new vector","text":"Array - new vector"}}],"examples":[{"text":"```sqf\n[[5,3], 60] call BIS_fnc_rotateVector2D;//Returns[-0.0980766,5.83013]\n```","code":["[[5,3], 60] call BIS_fnc_rotateVector2D;//Returns[-0.0980766,5.83013]"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_crossProduct","BIS_fnc_magnitudeSqr","BIS_fnc_vectorFromXToY"],"notes":[{"user":"AgentRev","date":"2015-01-21T14:15:00Z","text":"Be careful when using this function in conjunction with getDir or BIS_fnc_dirTo, which return a clockwise angle, while the rotation is done counterclockwise as per trigonometric conventions.\n\nTo counter this, simply negate their output:\n\n```sqf\n[[0,1,0], -(getDir _object)] call BIS_fnc_rotateVector2D;\n[[0,1,0], -([_unit, _vehicle] call BIS_fnc_dirTo)] call BIS_fnc_rotateVector2D;\n```"}],"categories":["Arma 2: Functions","Arma 2: New Functions","Arma 2: Operation Arrowhead: Functions","Arma 3: Functions","Function Group: Vectors","Functions","Introduced with Arma 2 version 1.00","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}