---
name: "nearEntities"
type: command
status: ok
groups: ["Object Detection"]
arma3_since: "0.50"
locality: {"argument": "global", "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/nearEntities
revid: 377403
updated: 2026-01-02T06:44:59Z
---

# nearEntities

*Command · Object Detection · Arma 3 v0.50 · introduced in Arma 2 v1.00*

Locality: arguments **global**

## Description

Finds entities inside a sphere with the given radius. If the alternative syntax is used, only entities of given types or subtypes are listed.
Entities returned are not sorted by distance.

The main syntax does not return dead entities or entities inside vehicles. If you need to return those, use the [alternative syntax](../commands/nearEntities.md#syntax-3) (with *includeCrew* set to [true](../commands/true.md)) or the [entities](../commands/entities.md) command.

> [!NOTE]
> This command is [much faster](../topics/Code_Optimisation.md#nearentities-and-nearestobjects) than [nearestObjects](../commands/nearestObjects.md) for on-foot soldier and vehicle detection.

## Syntax

### Syntax 1

```sqf
position nearEntities radius
```

**Parameters:**

- `position`: [Object](../topics/Object.md) or [PositionAGL](../topics/Position.md#positionagl) or [Position2D](../topics/Position.md#introduction) - search centre
- `radius`: [Number](../topics/Number.md) - radius of the sphere

**Returns:** [Array](../topics/Array.md) of [Object](../topics/Object.md)s - not sorted

### Syntax 2

```sqf
position nearEntities [type, radius]
```

**Parameters:**

- `position`: [Object](../topics/Object.md) or [PositionAGL](../topics/Position.md#positionagl) or [Position2D](../topics/Position.md#introduction) - search centre
- `type`: [String](../topics/String.md) or [Array](../topics/Array.md) of [String](../topics/String.md)s - type(s) to search for. See [isKindOf](../commands/isKindOf.md)
- `radius`: [Number](../topics/Number.md) - radius of the sphere

**Returns:** [Array](../topics/Array.md) of [Object](../topics/Object.md)s - not sorted

### Syntax 3

*since arma3 2.18*

```sqf
area nearEntities [types, matchExactType, aliveOnly, includeCrew]
```

**Parameters:**

- `area`: [String](../topics/String.md), [Object](../topics/Object.md) or [Array](../topics/Array.md):
  - [String](../topics/String.md) - marker name
  - [Object](../topics/Object.md) - trigger
  - [Array](../topics/Array.md) - format [center, a, b, angle, isRectangular, c] or Arma 3 v2.22 [center, a, b, angle, isRectangular, c, usePosWorld] (see [inArea](../commands/inArea.md))
- `types`: [Array](../topics/Array.md) of [String](../topics/String.md)s - type(s) to search for or [] empty array to return every type
- `matchExactType`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) [true](../commands/true.md) for an exact type match, [false](../commands/false.md) for an [isKindOf](../commands/isKindOf.md) match
- `aliveOnly`: [Boolean](../topics/Boolean.md) - (Optional, default [true](../commands/true.md)) [true](../commands/true.md) to ignore dead entities, [false](../commands/false.md) to include them
- `includeCrew`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) [true](../commands/true.md) to include crew of vehicles in search

**Returns:** [Array](../topics/Array.md) of [Object](../topics/Object.md)s - not sorted

## Examples

### Example 1

```sqf
_list = player nearEntities 20;
_list = ASLToAGL getPosASL player nearEntities 50;
_list = player nearEntities ["Man", 1000];
_list = ASLToAGL getPosASL player nearEntities ["LaserTarget", 3000];
_list = player nearEntities [["Car", "Motorcycle", "Tank"], 50];
_list = ASLToAGL getPosASL player nearEntities [["Man", "Air", "Car", "Motorcycle", "Tank"], 200];
```

## See also

[entities](../commands/entities.md) · [findNearestEnemy](../commands/findNearestEnemy.md) · [nearestBuilding](../commands/nearestBuilding.md) · [nearestObject](../commands/nearestObject.md) · [nearestObjects](../commands/nearestObjects.md) · [nearObjects](../commands/nearObjects.md) · [nearestLocation](../commands/nearestLocation.md) · [nearTargets](../commands/nearTargets.md) · [nearSupplies](../commands/nearSupplies.md) · [nearestLocationWithDubbing](../commands/nearestLocationWithDubbing.md) · [nearObjectsReady](../commands/nearObjectsReady.md) · [nearRoads](../commands/nearRoads.md) · [nearestMines](../commands/nearestMines.md)

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