nearestTerrainObjects: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "v1\.[9-9]{2}\.[0-9]{6}" to "v2.00") |
m (Text replacement - "v1\.61\.[0-9]{6}" to "v1.62") |
||
Line 11: | Line 11: | ||
Possible type names:<tt>"TREE", "SMALL TREE", "BUSH", "BUILDING", "HOUSE", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "CHURCH", "CHAPEL", "CROSS", "BUNKER", "FORTRESS", "FOUNTAIN", "VIEW-TOWER", "LIGHTHOUSE", "QUAY", "FUELSTATION", "HOSPITAL", "FENCE", "WALL", "HIDE", "BUSSTOP", "ROAD", "FOREST", "TRANSMITTER", "STACK", "RUIN", "TOURISM", "WATERTOWER", "TRACK", "MAIN ROAD", "ROCK", "ROCKS", "POWER LINES", "RAILWAY", "POWERSOLAR", "POWERWAVE", "POWERWIND", "SHIPWRECK", "TRAIL"</tt> | Possible type names:<tt>"TREE", "SMALL TREE", "BUSH", "BUILDING", "HOUSE", "FOREST BORDER", "FOREST TRIANGLE", "FOREST SQUARE", "CHURCH", "CHAPEL", "CROSS", "BUNKER", "FORTRESS", "FOUNTAIN", "VIEW-TOWER", "LIGHTHOUSE", "QUAY", "FUELSTATION", "HOSPITAL", "FENCE", "WALL", "HIDE", "BUSSTOP", "ROAD", "FOREST", "TRANSMITTER", "STACK", "RUIN", "TOURISM", "WATERTOWER", "TRACK", "MAIN ROAD", "ROCK", "ROCKS", "POWER LINES", "RAILWAY", "POWERSOLAR", "POWERWAVE", "POWERWIND", "SHIPWRECK", "TRAIL"</tt> | ||
<br><br> | <br><br> | ||
Since Arma 3 v1. | Since Arma 3 v1.62 it is possible to switch the sorting algorithm off by providing optional param, which significantly increases the performance of this command, especially if the search is performed with large radius. | ||
<br> | <br> | ||
Since Arma 3 v1.65.138818 it is possible to switch search and sorting mode between 2D and 3D. | Since Arma 3 v1.65.138818 it is possible to switch search and sorting mode between 2D and 3D. |
Revision as of 10:18, 3 April 2021
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.65.138818 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.