roadAt: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Replaced <code> with <sqf>)
m (Some wiki formatting)
Line 11: Line 11:
|s1= [[roadAt]] position
|s1= [[roadAt]] position


|p1= position: [[Object]] or [[Array]] - Array in format [[Position#PositionAGL|PositionAGL]] (especially on bridges) or (since Arma 3 v2.00) [[Position#Introduction|Position2D]], in which case Z will be automatically deduced as the height of the road surface
|p1= position: [[Object]] or [[Array]] - Array in format [[Position#PositionAGL|PositionAGL]] (especially on bridges) or {{GVI|arma3|2.00|size= 0.75}} [[Position#Introduction|Position2D]], in which case Z will be automatically deduced as the height of the road surface


|r1= [[Object]] - road segment or [[objNull]]
|r1= [[Object]] - road segment or [[objNull]]
Line 25: Line 25:
}}
}}


<dl class="command_description">
{{Note
 
|user= OOKexOo
<dt></dt>
|timestamp= 20161230214000
<dd class="notedate">Posted on December 30, 2016 - 21:40 (UTC)</dd>
|text= This command does not necessarily return the segment which center is the closest to the given position.<br>
<dt class="note">[[User:OOKexOo|OOKexOo]]</dt>
In order to get such segment use [[nearRoads]].
<dd class="note">
This command does not nessecarly return the segment which center is the closest to the given position.<br>
In order to get such segment use [[nearRoads]].<br>
<sqf>_closest_road = (_pos nearRoads 0.1) select 0;</sqf>
<sqf>_closest_road = (_pos nearRoads 0.1) select 0;</sqf>
</dd>
}}
 
</dl>

Revision as of 16:57, 17 April 2023

Hover & click on the images for description

Description

Description:
Returns a road segment containing given position, objNull otherwise. Same as isOnRoad only returns the actual road object instead of boolean.
Groups:
Roads and Airports

Syntax

Syntax:
roadAt position
Parameters:
position: Object or Array - Array in format PositionAGL (especially on bridges) or Arma 3 logo black.png2.00 Position2D, in which case Z will be automatically deduced as the height of the road surface
Return Value:
Object - road segment or objNull

Examples

Example 1:
_road = roadAt ASLToAGL getPosASL player;
Example 2:
_isOnRoad = !isNull roadAt player;
Example 3:
For detecting bridges, for example:
getModelInfo (roadAt ASLToAGL getPosASL player); // ["bridgesea_01_f.p3d", "a3\structures_f_exp\infrastructure\bridges\bridgesea_01_f.p3d", true]

Additional Information

See also:
nearRoads roadsConnectedTo isOnRoad surfaceIsWater getRoadInfo nearestTerrainObjects

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
OOKexOo - c
Posted on Dec 30, 2016 - 21:40 (UTC)
This command does not necessarily return the segment which center is the closest to the given position.
In order to get such segment use nearRoads.
_closest_road = (_pos nearRoads 0.1) select 0;