BIS fnc nearestPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "= <code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-_]+)\]\]([^<]*)<\/code>" to "= <code>$1$2$3</code>")
m (Text replacement - "= <code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-_]+)\]\]([^<]*)<\/code>" to "= <code>$1$2$3</code>")
Line 26: Line 26:


|x1= <code>// Find the nearest marker from player
|x1= <code>// Find the nearest marker from player
_nearestMarker = [allMapMarkers, player] [[call]] [[BIS_fnc_nearestPosition]];</code>
_nearestMarker = [allMapMarkers, player] call [[BIS_fnc_nearestPosition]];</code>


|x2= <code>// Find the nearest marker to trigger using trigger onActivation code
|x2= <code>// Find the nearest marker to trigger using trigger onActivation code
_nearestMarker = [allMapMarkers, thisTrigger] [[call]] [[BIS_fnc_nearestPosition]];</code>
_nearestMarker = [allMapMarkers, thisTrigger] call [[BIS_fnc_nearestPosition]];</code>


|seealso= [[nearObjects]] [[nearestObject]] [[nearestObjects]] [[BIS_fnc_nearestPoint]] [[BIS_fnc_nearestNum]] [[BIS_fnc_nearestRoad]] [[BIS_fnc_nearestHelipad]] [[BIS_fnc_isPosBlacklisted]]
|seealso= [[nearObjects]] [[nearestObject]] [[nearestObjects]] [[BIS_fnc_nearestPoint]] [[BIS_fnc_nearestNum]] [[BIS_fnc_nearestRoad]] [[BIS_fnc_nearestHelipad]] [[BIS_fnc_isPosBlacklisted]]
}}
}}

Revision as of 17:56, 13 July 2022

Hover & click on the images for description

Description

Description:
Function to find the nearest Object or position from a list, when compared to a given reference.
Execution:
call
Groups:
Positions

Syntax

Syntax:
[items, origin] call BIS_fnc_nearestPosition
Parameters:
items: Array of Object, Location, Group, String (marker) and/or Position - note that for a group, leader's position is used
origin: Object, Location, Group, String (marker) or Position
Return Value:
Object, Location, Group, String (marker) or Position - the closest from items

Examples

Example 1:
// Find the nearest marker from player _nearestMarker = [allMapMarkers, player] call BIS_fnc_nearestPosition;
Example 2:
// Find the nearest marker to trigger using trigger onActivation code _nearestMarker = [allMapMarkers, thisTrigger] call BIS_fnc_nearestPosition;

Additional Information

See also:
nearObjects nearestObject nearestObjects BIS_fnc_nearestPoint BIS_fnc_nearestNum BIS_fnc_nearestRoad BIS_fnc_nearestHelipad BIS_fnc_isPosBlacklisted

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