{"name":"vectorDir","operator":null,"title":"vectorDir","type":"command","url":"https://community.bistudio.com/wiki/vectorDir","revid":377247,"updated":"2026-01-02T05:27:32Z","groups":["Math - Vectors"],"status":"ok","replaced_by":[],"games":[{"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":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Returns an object's direction vector in world space.\n\n> [!IMPORTANT]\n> The vector is **not necessarily normalized**. The magnitude of the vector depends on the object's scale.\n\nFor an object facing one of the cardinal directions on perfectly flat ground (parallel to the XY-plane of the world space), vectorDir returns simple values:\n- `[0, 1, 0]` if the object is facing directly north\n- `[1, 0, 0]` if the object is facing directly east\n- `[0, -1, 0]` if the object is facing directly south\n- `[-1, 0, 0]` if the object is facing directly west","syntaxes":[{"syntax":"vectorDir 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":"Vector3D","types":["Vector3D"],"description":null,"text":"Vector3D"},"form":"unary","operator":null,"left":null,"right":{"text":"object","types":["Object"]}}],"examples":[{"text":"```sqf\n_vecDir = vectorDir MyObject;\n```","code":["_vecDir = vectorDir MyObject;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["vectorModelToWorld","vectorDirVisual","vectorSide","vectorSideVisual","vectorUp","setVectorDir","setVectorUp","setVectorDirAndUp","vectorDiff","vectorAdd","vectorMultiply","vectorCrossProduct","vectorDistance","vectorMagnitudeSqr","vectorDistanceSqr","vectorCos","vectorMagnitude","vectorDotProduct","vectorNormalized","vectorFromTo","BIS_fnc_transformVectorDirAndUp"],"notes":[],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Math - Vectors","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}