{"name":"nearObjects","title":"nearObjects","type":"command","url":"https://community.bistudio.com/wiki/nearObjects","revid":377428,"updated":"2026-01-02T06:45:43Z","groups":["Object Detection"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","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. If typeName is given, only objects of given type (or its subtype) are listed.","syntaxes":[{"syntax":"position nearObjects radius","params":[{"name":"position","type":"Position, Position2D or Object","type_expr":"Position | Position2D | Object"},{"name":"radius","type":"Number","type_expr":"Number"}],"returns":{"type":"Array of Objects","type_expr":"Array<Object>"},"form":"binary","left":{"text":"position"},"right":{"text":"radius"}},{"syntax":"position nearObjects [typeName, radius]","params":[{"name":"position","type":"PositionAGL, Position2D or Object","type_expr":"PositionAGL | Position2D | Object"},{"name":"typeName","type":"String","type_expr":"String"},{"name":"radius","type":"Number","type_expr":"Number"}],"returns":{"type":"Array of Objects","type_expr":"Array<Object>"},"form":"binary","left":{"text":"position"},"right":{"text":"[typeName, radius]"}}],"examples":[{"code":["_list = position player nearObjects 50;"]},{"code":["_list = [_xpos,_ypos] nearObjects [\"House\", 20];"]},{"code":["_list = player nearObjects 20;"]}],"see_also":["findNearestEnemy","nearestBuilding","nearestObject","nearestObjects","nearestLocation","nearEntities","nearTargets","nearSupplies","nearestLocationWithDubbing","nearObjectsReady","nearRoads","nearestMines"],"notes":[{"user":"Kronzky","date":"2007-06-30T08:21:00Z","text":"Units in vehicles are not detected via this command."},{"user":"Tankbuster","date":"2011-12-15T23:17:00Z","text":"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)"},{"user":"Tankbuster","date":"2013-01-03T19:59:00Z","text":"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."},{"user":"Cheitan","date":"2017-08-08T16:08:00Z","text":"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."}]}