---
name: "inPolygon"
type: command
status: ok
groups: ["Positions"]
arma3_since: "1.54"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/inPolygon
revid: 377566
updated: 2026-01-02T06:55:31Z
---

# inPolygon

*Command · Positions · Arma 3 v1.54*

## Description

Checks whether position is inside given polygon. The polygon is only checked in 2 dimensions, i.e. the value of Z is ignored.

## Syntax

```sqf
position inPolygon polygon
```

**Parameters:**

- `position`: [Position3D](../topics/Position.md#introduction), Arma 3 v2.14 [Object](../topics/Object.md) or [Group](../topics/Group.md)
- `polygon`: [Array](../topics/Array.md) of [Position3D](../topics/Position.md#introduction) - positions in format: [position1, position2...., positionN]

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

## Examples

### Example 1

```sqf
private _isInside = [100, 100, 0] inPolygon [[0, 0, 0], [1000, 1000, 0], [1000, 0, 0]];
```

### Example 2

```sqf
private _markerName = "_USER_DEFINED #0/0/1";

private _xy2DPositions = markerPolyline _markerName;
private _positions = [];

// let's convert these x,y coordinates to "normal" position arrays
for "_i" from 0 to count _xy2DPositions - 1 step 2 do
{
    _positions pushBack [_xy2DPositions select _i, _xy2DPositions select (_i + 1), 0];
};

player inPolygon _positions; // true if in the drawn shape, false if not
```

## See also

[in](../commands/in.md) · [inArea](../commands/inArea.md) · [inAreaArray](../commands/inAreaArray.md) · [drawPolygon](../commands/drawPolygon.md)

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