nearestTerrainObjects

From Bohemia Interactive Community
Revision as of 16:06, 17 January 2016 by NeoArmageddon (talk | contribs)
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Returns a list of nearest terrain objects of the given types to the given position or object, within the specified distance. If more than one object is found they will be ordered according to distance2D to the object (i.e. the closest one will be first in the array). In contrast to nearestObjects this command returns terrain placed objects like trees, rocks and buildings which don't necessarily need an associated config class.

position can use the format: [[x,y,z], ["Type",...], radius] or [object, ["Type",...], radius] To use it without any type filter: [object or position, [], radius].

A list of Typenames can be found in Map_Symbols#Objects
Groups:
Uncategorised

Syntax

Syntax:
nearestTerrainObjects [position, types, radius]
Parameters:
position: Object or Array in format PositionAGL or Position2D - where to find objects, center position.
types: Array - list of types of the objects to search for.
radius: Number - range from center position to search for objects.
Return Value:
Array - array of terrain objects sorted according to distance2D

Examples

Example 1:
nearestTerrainObjects [player, ["Tree","Bush"], 200];
Example 2:
nearestTerrainObjects [player, ["House"], 200];
Example 3:
nearestTerrainObjects [[2716,2949,0], ["Chapel","Fuelstation"], 100];
Example 4:
Return every terrain object in 50 metres radius around player:nearestTerrainObjects [player, [], 50]

Additional Information

See also:
findNearestEnemyhideObjectnearestBuildingnearestObjectnearObjectsnearestLocationnearEntitiesnearTargetsnearSuppliesnearestLocationWithDubbingnearObjectsReadynearRoads

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section