{"name":"getDir","operator":null,"title":"getDir","type":"command","url":"https://community.bistudio.com/wiki/getDir","revid":364132,"updated":"2024-05-04T22:14:16Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"}],"returns":{"type":"Number","types":["Number"],"description":null,"text":"Number"},"form":"unary","operator":null,"left":null,"right":{"text":"object","types":["Object"]}},{"syntax":"pos1 getDir pos2","since":"arma3 1.56","effect":null,"exec":null,"params":[{"name":"pos1","type":"Object, Position2D or Position3D","optional":false,"default":null,"description":"from where","types":["Object","Position2D","Position3D"],"since":null,"text":"pos1: Object, Position2D or Position3D - from where"},{"name":"pos2","type":"Object, Position2D or Position3D","optional":false,"default":null,"description":"to where","types":["Object","Position2D","Position3D"],"since":null,"text":"pos2: Object, Position2D or Position3D - to where"}],"returns":{"type":"Number","types":["Number"],"description":null,"text":"Number"},"form":"binary","operator":null,"left":{"text":"pos1","types":["Object","Position2D","Position3D"]},"right":{"text":"pos2","types":["Object","Position2D","Position3D"]}}],"examples":[{"text":"```sqf\n_azimuth = getDir player;\n```","code":["_azimuth = getDir player;"]},{"text":"```sqf\n_azimuth = player getDir tank;\n```","code":["_azimuth = player getDir tank;"]}],"multiplayer":null,"problems":null,"aliases":[],"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.\n\nTo counter this, simply negate the output of getDir:\n\n```sqf\n[[0,1,0], -(getDir _object)] call BIS_fnc_rotateVector2D;\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}