{"name":"getDir","title":"getDir","type":"command","url":"https://community.bistudio.com/wiki/getDir","revid":364132,"updated":"2024-05-04T22:14:16Z","groups":["Object Manipulation"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"global"},"description":"Returns the object heading in the range 0..360.\n\n> [!NOTE]\n> **Arma 3:** The alternative syntax gets heading from one object or position to another object or position, and should be used instead of BIS_fnc_dirTo.","syntaxes":[{"syntax":"getDir object","params":[{"name":"object","type":"Object","type_expr":"Object"}],"returns":{"type":"Number","type_expr":"Number"},"form":"unary","right":{"text":"object"}},{"syntax":"pos1 getDir pos2","since":"arma3 1.56","params":[{"name":"pos1","type":"Object, Position2D or Position3D","description":"from where","type_expr":"Object | Position2D | Position3D"},{"name":"pos2","type":"Object, Position2D or Position3D","description":"to where","type_expr":"Object | Position2D | Position3D"}],"returns":{"type":"Number","type_expr":"Number"},"form":"binary","left":{"text":"pos1"},"right":{"text":"pos2"}}],"examples":[{"code":["_azimuth = getDir player;"]},{"code":["_azimuth = player getDir tank;"]}],"see_also":["getDirVisual","direction","getRelDir"],"notes":[{"user":"AgentRev01","date":"2013-10-23T10:31:00Z","text":"Be careful when using this command in conjunction with BIS_fnc_rotateVector2D, which rotates vectors counterclockwise as per trigonometric conventions, while getDir returns a clockwise angle.\nTo counter this, simply negate the output of getDir:\n\n```sqf\n[[0,1,0], -(getDir _object)] call BIS_fnc_rotateVector2D;\n```"}]}