{"name":"BIS_fnc_transformVectorDirAndUp","operator":null,"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","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.98"}],"since":{"game":"arma3","name":"Arma 3","version":"1.98"},"arma3_since":"1.98","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"vectorDirAndUp","type":"Array in format [vectorDir, vectorUp] -","optional":true,"default":"[[0,1,0],[0,0,1]]","description":null,"types":["Array"],"since":null,"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","types":["Number"],"since":null,"text":"yaw: Number - (Optional, default 0) yaw angle"},{"name":"pitch","type":"Number","optional":true,"default":"0","description":"pitch angle","types":["Number"],"since":null,"text":"pitch: Number - (Optional, default 0) pitch angle"},{"name":"roll","type":"Number","optional":true,"default":"0","description":"roll angle","types":["Number"],"since":null,"text":"roll: Number - (Optional, default 0) roll angle"}],"returns":{"type":"Array in format [vectorDir, vectorUp]","types":["Array"],"description":null,"text":"Array in format [vectorDir, vectorUp]"}}],"examples":[{"text":"```sqf\nprivate _vDirUp = [[vectorDirVisual uav, vectorUpVisual uav], 0, 0, 90] call BIS_fnc_transformVectorDirAndUp;\n```","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}];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["vectorDir","vectorUp","setVectorDirAndUp"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Vectors","Functions","Introduced with Arma 3 version 1.98"],"docblock":null,"filled_from_docblock":[]}