nearestObject: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Reverd mistaken edit)
m (Added SEEALSO)
Line 39: Line 39:
____________________________________________________________________________________________
____________________________________________________________________________________________


|  [[nearestObjects]], [[nearObjects]] |= See also
|  [[nearestObjects]], [[nearObjects]], [[nearEntities]] |= See also


}}
}}

Revision as of 18:40, 19 January 2011

Hover & click on the images for description

Description

Description:
Nearest object of given type to given position within a range of 50 meters. If class types are used in the filter, then in Arma any object derived from the type is found as well. In OFP, only objects with exactly the type given are found.
Groups:
Uncategorised

Syntax

Syntax:
nearestObject filter
Parameters:
filter: Array - Can be one of the following:
[x,y,z]: Any objects near position
[[x,y,z], "type"]: Objects of class "type" near position [x,y,z]
[object, "type"]: Objects of class "type" near position of "object"
Return Value:
Object - Found object, or objNull if nothing in range.

Alternative Syntax

Syntax:
position nearestObject filter
Parameters:
position: Array - Position2D or Position3D.
filter: Number or String - Either ID of object, or class type.
Return Value:
Found object, or objNull if nothing in range.

Examples

Example 1:
_nObject = nearestObject [2345,6789]
_nObject = nearestObject [player, "StreetLamp"] 
Example 2:
_nObject = getPos player nearestObject 123456 
Example 3:
_nObject = getPos player nearestObject "StreetLamp" 

Additional Information

See also:
nearestObjectsnearObjectsnearEntities

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