---
name: "drawRectangle"
type: command
status: ok
groups: ["GUI Control - Map"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/drawRectangle
revid: 377559
updated: 2026-01-02T06:55:02Z
---

# drawRectangle

*Command · GUI Control - Map · Arma 3 v0.50 · introduced in Armed Assault v1.00*

## Description

Draws a rectangle on the map.

## Syntax

```sqf
map drawRectangle [centre, halfWidth, halfHeight, angle, color, fill, alignWithMap]
```

**Parameters:**

- `map`: [Control](../topics/Control.md)
- `centre`: [Object](../topics/Object.md) or [Position2D](../topics/Position.md#introduction) or [Position3D](../topics/Position.md#introduction) - rectangle's centre
- `halfWidth`: [Number](../topics/Number.md) - 1/2 width of rectangle in meters
- `halfHeight`: [Number](../topics/Number.md) - 1/2 height of rectangle in meters
- `angle`: [Number](../topics/Number.md) - angle of rotation in degrees
- `color`: [Color (RGBA)](../topics/Color.md) - line color
- `fill`: [String](../topics/String.md) - fill texture file or Procedural Textures. Note that the file texture will not rotate with rectangle, use [drawIcon](../commands/drawIcon.md) for that. If fill texture is not empty, set line color to white `[1,1,1,1]`
- `alignWithMap`: [Boolean](../topics/Boolean.md) - (Optional, default [true](../commands/true.md)) - when [false](../commands/false.md) the shape will not follow map rotation. *(since Arma3 2.18)*

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
_ctrl drawRectangle [
    getPos player,
    20,
    20,
    getDir player,
    [0,0,1,1],
    ""
];
```

### Example 2

```sqf
_ctrl drawRectangle [
    player,
    10,
    20,
    getDir player,
    [1,1,1,1],
    "#(rgb,8,8,3)color(1,0,0,1)"
];
```

## See also

[drawArrow](../commands/drawArrow.md) · [drawEllipse](../commands/drawEllipse.md) · [drawIcon](../commands/drawIcon.md) · [drawLine](../commands/drawLine.md) · [drawPolygon](../commands/drawPolygon.md) · [drawTriangle](../commands/drawTriangle.md) · [drawXPolygon](../commands/drawXPolygon.md)

## Community notes

**Waffle SS.** — 2014-03-23

Map example:

```sqf
(findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",{
    (_this select 0) drawRectangle [
        getPos player,
        20,
        20,
        getDir player,
        [0,0,1,1],
        ""
    ];
}];
```

Be careful when using this command. Unlike map markers, the draw commands can decrease your framerate.

<sub>Source: [BI Community Wiki — drawRectangle](https://community.bistudio.com/wiki/drawRectangle) (revision 377559).</sub>
