{"name":"drawRectangle","title":"drawRectangle","type":"command","url":"https://community.bistudio.com/wiki/drawRectangle","revid":377559,"updated":"2026-01-02T06:55:02Z","groups":["GUI Control - Map"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","description":"Draws a rectangle on the map.","syntaxes":[{"syntax":"map drawRectangle [centre, halfWidth, halfHeight, angle, color, fill, alignWithMap]","params":[{"name":"map","type":"Control","type_expr":"Control"},{"name":"centre","type":"Object or Position2D or Position3D","description":"rectangle's centre","type_expr":"Object | Position2D | Position3D"},{"name":"halfWidth","type":"Number","description":"1/2 width of rectangle in meters","type_expr":"Number"},{"name":"halfHeight","type":"Number","description":"1/2 height of rectangle in meters","type_expr":"Number"},{"name":"angle","type":"Number","description":"angle of rotation in degrees","type_expr":"Number"},{"name":"color","type":"Color (RGBA)","description":"line color","type_expr":"Color"},{"name":"fill","type":"String","description":"fill texture file or Procedural Textures. Note that the file texture will not rotate with rectangle, use drawIcon for that. If fill texture is not empty, set line color to white `[1,1,1,1]`","type_expr":"String"},{"name":"alignWithMap","type":"Boolean","optional":true,"default":"true","description":"when false the shape will not follow map rotation.","type_expr":"Boolean","since":"arma3 2.18","text":"alignWithMap: Boolean - (Optional, default true) - when false the shape will not follow map rotation."}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"map"},"right":{"text":"[centre, halfWidth, halfHeight, angle, color, fill, alignWithMap]"}}],"examples":[{"text":"```sqf\n_ctrl drawRectangle [\n    getPos player,\n    20,\n    20,\n    getDir player,\n    [0,0,1,1],\n    \"\"\n];\n```","code":["_ctrl drawRectangle [\n\tgetPos player,\n\t20,\n\t20,\n\tgetDir player,\n\t[0,0,1,1],\n\t\"\"\n];"]},{"text":"```sqf\n_ctrl drawRectangle [\n    player,\n    10,\n    20,\n    getDir player,\n    [1,1,1,1],\n    \"#(rgb,8,8,3)color(1,0,0,1)\"\n];\n```","code":["_ctrl drawRectangle [\n\tplayer,\n\t10,\n\t20,\n\tgetDir player,\n\t[1,1,1,1],\n\t\"#(rgb,8,8,3)color(1,0,0,1)\"\n];"]}],"see_also":["drawArrow","drawEllipse","drawIcon","drawLine","drawPolygon","drawTriangle","drawXPolygon"],"notes":[{"user":"Waffle SS.","date":"2014-03-23T00:21:00Z","text":"Map example:\n\n```sqf\n(findDisplay 12 displayCtrl 51) ctrlAddEventHandler [\"Draw\",{\n    (_this select 0) drawRectangle [\n        getPos player,\n        20,\n        20,\n        getDir player,\n        [0,0,1,1],\n        \"\"\n    ];\n}];\n```\n\nBe careful when using this command. Unlike map markers, the draw commands can decrease your framerate."}]}