nearestTerrainObjects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <!-- (DIS)?CONTINUE Notes -->" to "")
m (Text replacement - "{{GVI|A3|" to "{{GVI|arma3|")
Line 19: Line 19:
<syntaxhighlight lang="cpp"></syntaxhighlight><!---THIS IS HERE TO MAKE SYNTAX HIGHLIGHTING WORK INSIDE THE SPOILER (BLACKMAGIC)--->
<syntaxhighlight lang="cpp"></syntaxhighlight><!---THIS IS HERE TO MAKE SYNTAX HIGHLIGHTING WORK INSIDE THE SPOILER (BLACKMAGIC)--->
<spoiler text="Terrain object counts">
<spoiler text="Terrain object counts">
{{Feature|Informative|Types which are missing are not present in the given world. [[Virtual Reality]] has no terrain objects. Last updated {{GVI|A3|1.99}}}}
{{Feature|Informative|Types which are missing are not present in the given world. [[Virtual Reality]] has no terrain objects. Last updated {{GVI|arma3|1.99}}}}
<big>[[Stratis]]</big>
<big>[[Stratis]]</big>
<div style="columns: 5">
<div style="columns: 5">

Revision as of 17:33, 23 May 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Object Detection

Syntax

Syntax:
Syntax needed
Parameters:
position: Object, PositionAGL or Position2D - where to find objects, center position
types: Array - list of case-insensitive types of the objects to search for. [] to search without filters
radius: Number - range from center position to search for objects
sort: Boolean - (Optional, default true) sort objects by distance to the center or not Template:Since
2Dmode: Boolean - (Optional, default false) the object search and sorting mode: true - 2D, false - 3D Template:Since
Return Value:
Return value needed

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 sorted, closest first:nearestTerrainObjects [player, [], 50];
Example 5:
Return every terrain object in 50 metres radius around player unsorted:nearestTerrainObjects [player, [], 50, false];
Example 6:
Hide all terrain objects nearestTerrainObjects could find: if (isServer) then { private _allTerrainObjects = nearestTerrainObjects [ [worldSize / 2, worldSize / 2], [], worldSize * sqrt 2 / 2, false ]; { _x hideObjectGlobal true } forEach _allTerrainObjects; };

Additional Information

See also:
nearestObjectsfindNearestEnemyhideObjectnearestBuildingnearestObjectnearObjectsnearestLocationnearEntitiesnearTargetsnearSuppliesnearestLocationWithDubbingnearObjectsReadynearRoadsroadsConnectedToroadAtisOnRoadgetRoadInfo

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


Posted on October 31, 2016 - 00:20 (UTC)
Killzone Kid
Since Arma 3 v1.66 the default sorting is done according to 3D distance not distance2D as before. This is an attempt to correct some very old bug in implementation.
Posted on December 28, 2016 - 20:21 (UTC)
Demellion
Be aware that some terrain objects types might be tricky to be found, such as terrain rocks and boulders which are not considered to be "ROCKS" or "ROCK", but "HIDE". Example: nearestTerrainObjects [player, ["HIDE"], 20]; // [939688: bluntstone_01.p3d,939691: garbagebags_f.p3d,939671: wreck_car_f.p3d,939692: junkpile_f.p3d]
Posted on June 7, 2020 - 14:16 (UTC)
killzone_kid
Large bridges are map type "ROAD". Small foot bridges are not roads and not included into road net.