---
name: "lineIntersects"
type: command
status: ok
groups: ["Math - Geometry"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/lineIntersects
revid: 377702
updated: 2026-01-02T09:03:32Z
---

# lineIntersects

*Command · Math - Geometry · Arma 3 v0.50 · introduced in Arma 2: Operation Arrowhead v1.62*

Locality: arguments **global**

## Description

Checks for object intersection with a virtual line between two positions. Since Arma 3 v2.20, there is an alternative syntax that does multiple checks in parallel, faster than multiple calls.

> [!NOTE]
> - Does not work under water.
> - Max hardcoded distance is 1000m.

## Syntax

### Syntax 1

```sqf
lineIntersects [begPos, endPos, objIgnore1, objIgnore2]
```

**Parameters:**

- `begPos`: [PositionASL](../topics/Position.md#positionasl)
- `endPos`: [PositionASL](../topics/Position.md#positionasl)
- `objIgnore1`: [Object](../topics/Object.md) - (Optional, default [objNull](../commands/objNull.md)) object to ignore. When testing intersections from an object/unit/vehicle, pass that object here to prevent intersections inside of the object
- `objIgnore2`: [Object](../topics/Object.md) - (Optional, default [objNull](../commands/objNull.md)) another object to ignore. When testing intersections of a line between two objects, pass the second object here to prevent intersections inside of it being reported

**Returns:** [Boolean](../topics/Boolean.md) - [true](../commands/true.md) if an intersection happens with an object (not with terrain)

### Syntax 2

*since arma3 2.20*

```sqf
lineIntersects [[element1, element2, ...]]
```

**Parameters:**

- `elementN`: [Array](../topics/Array.md) with [begPos, endPos, objIgnore1, objIgnore2]
  - begPos: [PositionASL](../topics/Position.md#positionasl)
  - endPos: [PositionASL](../topics/Position.md#positionasl)
  - objIgnore1: [Object](../topics/Object.md) - (Optional, default [objNull](../commands/objNull.md)) object to ignore. When testing intersections from an object/unit/vehicle, pass that object here to prevent intersections inside of the object
  - objIgnore2: [Object](../topics/Object.md) - (Optional, default [objNull](../commands/objNull.md)) another object to ignore. When testing intersections of a line between two objects, pass the second object here to prevent intersections inside of it being reported

**Returns:** [Array](../topics/Array.md) with [result1, result2, ...] - [true](../commands/true.md) if an intersection happens with an object (not with terrain) for the Nth element

## Examples

### Example 1

```sqf
private _hasStraightLineToChopper = lineIntersects [eyePos player, aimPos chopper, player, chopper];
```

### Example 2

Alternative syntax to check intersections in parallel:

```sqf
private _enemies = units opfor;
private _enemyDataArray = _enemies apply { [eyePos player, aimPos _x, player, _x] };
private _result = lineIntersects [_enemyDataArray];
```

## See also

[lineIntersectsSurfaces](../commands/lineIntersectsSurfaces.md) · [lineIntersectsObjs](../commands/lineIntersectsObjs.md) · [lineIntersectsWith](../commands/lineIntersectsWith.md) · [terrainIntersect](../commands/terrainIntersect.md) · [terrainIntersectASL](../commands/terrainIntersectASL.md) · [terrainIntersectAtASL](../commands/terrainIntersectAtASL.md) · [intersect](../commands/intersect.md) · [cursorObject](../commands/cursorObject.md) · [cursorTarget](../commands/cursorTarget.md) · [checkVisibility](../commands/checkVisibility.md)

## Community notes

**Lou Montana** — 2012-05-31

Please note the difference:
- [terrainIntersect](../commands/terrainIntersect.md)
- [terrainIntersectASL](../commands/terrainIntersectASL.md)
- [lineIntersects](../commands/lineIntersects.md)
- [lineIntersectsWith](../commands/lineIntersectsWith.md)
- [lineIntersectsObjs](../commands/lineIntersectsObjs.md)
- [intersect](../commands/intersect.md)

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