{"name":"BIS_fnc_dirTo","title":"BIS fnc dirTo","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_dirTo","revid":327975,"updated":"2022-07-13T14:37:05Z","groups":["Geometry"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Function which returns vector direction from pos1 to pos2.\n\n> [!NOTE]\n> **Arma 3:** Use `obj1 getDir obj2` instead of BIS_fnc_dirTo.","syntaxes":[{"syntax":"[param1, param2] call BIS_fnc_dirTo","params":[{"name":"param1","description":"vector starting point, Position **or** Object","type_expr":"Position | Object"},{"name":"param2","description":"vector ending point, Position **or** Object","type_expr":"Position | Object"}],"returns":{"type":"Number","type_expr":"Number"}}],"examples":[{"text":"sets unit1 in the direction of unit2\n\n```sqf\nunit1 setDir ([unit1, unit2] call BIS_fnc_dirTo);\n```","code":["unit1 setDir ([unit1, unit2] call BIS_fnc_dirTo);"]}],"see_also":["getDir","setDir"],"notes":[{"user":"AgentRev","date":"2015-01-21T14:20:00Z","text":"Be careful when using this function in conjunction with BIS_fnc_rotateVector2D, which rotates vectors counterclockwise as per trigonometric conventions, while BIS_fnc_dirTo returns a clockwise angle.\nTo counter this, simply negate the output of BIS_fnc_dirTo:\n\n```sqf\n[0,1,0], -([_unit, _vehicle] call BIS_fnc_dirTo)] call BIS_fnc_rotateVector2D;\n```"}]}