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

# nearObjects

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

## Description

Find objects (Units, Vehicles, Dead, Map Objects) in a sphere with given radius. The first object in the returned array is *not* necessarily the closest one. If you need returned objects to be sorted by distance, use [nearestObjects](../commands/nearestObjects.md). If typeName is given, only objects of given type (or its subtype) are listed.

## Syntax

### Syntax 1

```sqf
position nearObjects radius
```

**Parameters:**

- `position`: [Position](../topics/Position.md), [Position2D](../topics/Position.md#introduction) or [Object](../topics/Object.md)
- `radius`: [Number](../topics/Number.md)

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

### Syntax 2

```sqf
position nearObjects [typeName, radius]
```

**Parameters:**

- `position`: [PositionAGL](../topics/Position.md#positionagl), [Position2D](../topics/Position.md#introduction) or [Object](../topics/Object.md)
- `typeName`: [String](../topics/String.md)
- `radius`: [Number](../topics/Number.md)

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

## Examples

### Example 1

```sqf
_list = position player nearObjects 50;
```

### Example 2

```sqf
_list = [_xpos,_ypos] nearObjects ["House", 20];
```

### Example 3

```sqf
_list = player nearObjects 20;
```

## See also

[findNearestEnemy](../commands/findNearestEnemy.md) · [nearestBuilding](../commands/nearestBuilding.md) · [nearestObject](../commands/nearestObject.md) · [nearestObjects](../commands/nearestObjects.md) · [nearestLocation](../commands/nearestLocation.md) · [nearEntities](../commands/nearEntities.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)

## Community notes

**Kronzky** — 2007-06-30

Units in vehicles are not detected via this command.

---

**Tankbuster** — 2011-12-15

In the second syntax, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59)

---

**Tankbuster** — 2013-01-03

If you use the first syntax, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames.

---

**Cheitan** — 2017-08-08

The syntax 2 means that the command will include all types which inherit from the given type. As an example, when using "Helipad_Base_F", the command will detect all types of helipads (Land_HelipadSquare_F, Land_HelipadCircle_F, Land_HelipadEmpty_F, etc) in the given radius.

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