{"name":"vectorDir","title":"vectorDir","type":"command","url":"https://community.bistudio.com/wiki/vectorDir","revid":379398,"updated":"2026-10-31T00:01:12Z","groups":["Math - Vectors"],"status":"ok","games":{"ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofpe 1.00","arma3_since":"0.50","locality":{"argument":"global"},"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\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","params":[{"name":"object","type":"Object","type_expr":"Object"}],"returns":{"type":"Vector3D","type_expr":"Vector3D"},"form":"unary","right":{"text":"object"}}],"examples":[{"code":["_vecDir = vectorDir MyObject;"]}],"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":[{"user":"Killzone_Kid","date":"2019-02-02T01:03:00Z","text":"vectorDir 2D:\n\n```sqf\n[sin _azimuth, cos _azimuth, 0]\n```\n\nvectorDir 3D:\n\n```sqf\n[sin _azimuth * cos _altitude, cos _azimuth * cos _altitude, sin _altitude]\n```"}]}