{"name":"BIS_fnc_transformVectorDirAndUp","title":"BIS fnc transformVectorDirAndUp","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp","revid":352125,"updated":"2024-02-01T23:25:06Z","groups":["Vectors"],"status":"ok","games":{"arma3":"1.98"},"since":"arma3 1.98","arma3_since":"1.98","description":"Rotates both vectorDir and vectorUp on 3 axes: z (yaw), x (pitch) and y (roll). Positive angle direction is according to the [right hand rule](https://en.wikipedia.org/wiki/Right-hand_rule).\n\n> [!NOTE]\n> The vectors are rotated first on **z** axis then on **x** axis then on **y** axis. For example standard [[0,1,0],[0,0,1]] pair rotated 90 degrees on every axis will result in [[0,0,1],[0,-1,0]]","syntaxes":[{"syntax":"[vectorDirAndUp, yaw, pitch, roll] call BIS_fnc_transformVectorDirAndUp","params":[{"name":"vectorDirAndUp","type":"Array in format [vectorDir, vectorUp] -","optional":true,"default":"[[0,1,0],[0,0,1]]","type_expr":"Array","text":"vectorDirAndUp: Array in format [vectorDir, vectorUp] -(Optional, default [[0,1,0],[0,0,1]])"},{"name":"yaw","type":"Number","optional":true,"default":"0","description":"yaw angle","type_expr":"Number","text":"yaw: Number - (Optional, default 0) yaw angle"},{"name":"pitch","type":"Number","optional":true,"default":"0","description":"pitch angle","type_expr":"Number","text":"pitch: Number - (Optional, default 0) pitch angle"},{"name":"roll","type":"Number","optional":true,"default":"0","description":"roll angle","type_expr":"Number","text":"roll: Number - (Optional, default 0) roll angle"}],"returns":{"type":"Array","type_expr":"Array","description":"in format [vectorDir, vectorUp]","text":"Array in format [vectorDir, vectorUp]"}}],"examples":[{"code":["private _vDirUp = [[vectorDirVisual uav, vectorUpVisual uav], 0, 0, 90] call BIS_fnc_transformVectorDirAndUp;"]},{"text":"Create UAV object and make it pitch with mouse up/down and roll with mouse left/right:\n\n```sqf\nuav = \"B_UAV_05_F\" createVehicle [0,0,0];\nuav attachTo [player, [0,30,10]];\nfindDisplay 46 displayAddEventHandler [\"MouseMoving\",\n{\n    uav setVectorDirAndUp\n    (\n        [\n            [vectorDirVisual uav, vectorUpVisual uav],\n            getDirVisual uav,\n            _this select 2,\n            _this select 1\n        ]\n        call BIS_fnc_transformVectorDirAndUp\n    );\n}];\n```","code":["uav = \"B_UAV_05_F\" createVehicle [0,0,0];\nuav attachTo [player, [0,30,10]];\nfindDisplay 46 displayAddEventHandler [\"MouseMoving\", \n{\n\tuav setVectorDirAndUp\n\t(\n\t\t[\n\t\t\t[vectorDirVisual uav, vectorUpVisual uav],\n\t\t\tgetDirVisual uav,\n\t\t\t_this select 2,\n\t\t\t_this select 1\n\t\t]\n\t\tcall BIS_fnc_transformVectorDirAndUp\n\t);\n}];"]}],"see_also":["vectorDir","vectorUp","setVectorDirAndUp"]}