{"name":"BIS_fnc_rotateVector2D","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","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"This function returns a 2D vector rotated a specified number of degrees around the origin.","syntaxes":[{"syntax":"[vector2D, angle] call BIS_fnc_rotateVector2D","params":[{"name":"vector2D","type":"Array","description":"2D vector","type_expr":"Array"},{"name":"angle","type":"Number","description":"angle in degree","type_expr":"Number"}],"returns":{"type":"Array","type_expr":"Array","description":"new vector"}}],"examples":[{"code":["[[5,3], 60] call BIS_fnc_rotateVector2D;//Returns[-0.0980766,5.83013]"]}],"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.\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```"}]}