nearObjects: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<dd class="notedate">Posted on ([^<>]+) " to "<dd class="notedate">Posted on $1</dd> ")
m (Text replacement - "<dt class="note">([^<>]+) " to "<dt class="note">$1</dt> ")
Line 41: Line 41:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on June 30, 2007 - 08:21</dd>
<dd class="notedate">Posted on June 30, 2007 - 08:21</dd>
<dt class="note">[[User:Kronzky|Kronzky]]
<dt class="note">[[User:Kronzky|Kronzky]]</dt>
<dd class="note">
<dd class="note">
Units in vehicles are not detected via this command.
Units in vehicles are not detected via this command.


<dd class="notedate">Posted on December 15, 2011 - 23:17</dd>
<dd class="notedate">Posted on December 15, 2011 - 23:17</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
<dd class="note">
In the second example, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59)
In the second example, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59)


<dd class="notedate">Posted on January 3, 2013 - 19:59</dd>
<dd class="notedate">Posted on January 3, 2013 - 19:59</dd>
<dt class="note">[[User:Tankbuster|Tankbuster]]
<dt class="note">[[User:Tankbuster|Tankbuster]]</dt>
<dd class="note">
<dd class="note">
If you use the first example, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames.
If you use the first example, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames.

Revision as of 01:29, 30 January 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Object Detection

Syntax

Syntax:
Syntax needed
Parameters:
position: Position, Position2D or Object
radius: Number
Return Value:
Return value needed

Alternative Syntax

Syntax:
position nearObjects [typeName, radius]
Parameters:
position: PositionAGL, Position2D or Object
[typeName, radius]: Array
typeName: String
radius: Number
Return Value:
Array

Examples

Example 1:
_list = position player nearObjects 50;
Example 2:
_list = [_xpos,_ypos] nearObjects ["House", 20];
Example 3:
_list = player nearObjects 20;

Additional Information

See also:
See also needed

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 June 30, 2007 - 08:21
Kronzky
Units in vehicles are not detected via this command.
Posted on December 15, 2011 - 23:17
Tankbuster
In the second example, you can't omit the typeName parameter. It's required and you'll get an error if you don't supply it. Use "All" as an alternative to leaving it out. (CO 1.59)
Posted on January 3, 2013 - 19:59
Tankbuster
If you use the first example, it will return objects many more objects such as pollen, honeybees and crucially, triggers. Triggers will show in the returned array as "no shape" but you can use typeOf to get the classname, which will give "EmptyDetector". This will not return objects that don't have classnames such as plants, stones and some map objects like vehicle wrecks. nearestObjects will find objects without classnames.
Posted on August 8, 2017 - 16:08 (UTC)
Cheitan
The example 2 means that the command will include all types which inherit from the given type. As an example, when using "Helipad_Base_F", the command will detect all types of helipads (Land_HelipadSquare_F, Land_HelipadCircle_F, Land_HelipadEmpty_F, etc) in the given radius.