{"name":"drawRectangle","operator":null,"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","replaced_by":[],"games":[{"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":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Draws a rectangle on the map.","syntaxes":[{"syntax":"map drawRectangle [centre, halfWidth, halfHeight, angle, color, fill, alignWithMap]","since":null,"effect":null,"exec":null,"params":[{"name":"map","type":"Control","optional":false,"default":null,"description":null,"types":["Control"],"since":null,"text":"map: Control"},{"name":"centre","type":"Object or Position2D or Position3D","optional":false,"default":null,"description":"rectangle's centre","types":["Object","Position2D","Position3D"],"since":null,"text":"centre: Object or Position2D or Position3D - rectangle's centre"},{"name":"halfWidth","type":"Number","optional":false,"default":null,"description":"1/2 width of rectangle in meters","types":["Number"],"since":null,"text":"halfWidth: Number - 1/2 width of rectangle in meters"},{"name":"halfHeight","type":"Number","optional":false,"default":null,"description":"1/2 height of rectangle in meters","types":["Number"],"since":null,"text":"halfHeight: Number - 1/2 height of rectangle in meters"},{"name":"angle","type":"Number","optional":false,"default":null,"description":"angle of rotation in degrees","types":["Number"],"since":null,"text":"angle: Number - angle of rotation in degrees"},{"name":"color","type":"Color (RGBA)","optional":false,"default":null,"description":"line color","types":["Color"],"since":null,"text":"color: Color (RGBA) - line color"},{"name":"fill","type":"String","optional":false,"default":null,"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]`","types":["String"],"since":null,"text":"fill: String - 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]`"},{"name":"alignWithMap","type":"Boolean","optional":true,"default":"true","description":"when false the shape will not follow map rotation.","types":["Boolean"],"since":"Arma3 2.18","text":"alignWithMap: Boolean - (Optional, default true) - when false the shape will not follow map rotation."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"map","types":["Control"]},"right":{"text":"[centre, halfWidth, halfHeight, angle, color, fill, alignWithMap]","types":["Array"]}}],"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];"]}],"multiplayer":null,"problems":null,"aliases":[],"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."}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control - Map","Introduced with Armed Assault version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}