roadAt: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - " (\|[pr][0-9]+ *= *[^-]+) *- *A([a-z])" to " $1 - a$2")
 
(46 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|1.58|Game Version= (number surrounded by NO SPACES)
|version1= 1.58
|arg= global|Multiplayer Arguments=
|arg= global
____________________________________________________________________________________________


| Returns road segment at given position, [[objNull]] otherwise. Same as [[isOnRoad]] only returns the actual road object instead of boolean. |DESCRIPTION=
|gr1= Roads and Airports
____________________________________________________________________________________________


| '''roadAt''' position |SYNTAX=
|descr= Returns a road segment containing given position, [[objNull]] otherwise. Same as [[isOnRoad]] only returns the actual road object instead of boolean.


|p1= position: [[Object]] or  [[Array]] in format [[PositionAGL]] (especially on bridges)  |PARAMETER1=
|s1= [[roadAt]] position


| [[Object]] - road segment or [[objNull]] |RETURNVALUE=  
|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


|x1= <code>_road = [[roadAt]] [[ASLToAGL]] [[getPosASL]] [[player]];</code>|EXAMPLE1=
|r1= [[Object]] - road segment or [[objNull]]


|x2= <code>_isOnRoad = ![[isNull]] [[roadAt]] [[player]];</code>|EXAMPLE2=
|x1= <sqf>_road = roadAt ASLToAGL getPosASL player;</sqf>


|x3= For detecting bridges, for example<code>[[getModelInfo]] ([[roadAt]] [[ASLToAGL]] [[getPosASL]] [[player]]); {{cc|["bridgesea_01_f.p3d","a3\structures_f_exp\infrastructure\bridges\bridgesea_01_f.p3d",true]}}</code>|EXAMPLE3=
|x2= <sqf>_isOnRoad = !isNull roadAt player;</sqf>


____________________________________________________________________________________________
|x3= For detecting bridges, for example:
<sqf>getModelInfo (roadAt ASLToAGL getPosASL player); // ["bridgesea_01_f.p3d", "a3\structures_f_exp\infrastructure\bridges\bridgesea_01_f.p3d", true]</sqf>


| [[nearRoads]], [[roadsConnectedTo]], [[isOnRoad]], [[surfaceIsWater]] |SEEALSO=
|seealso= [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[surfaceIsWater]] [[getRoadInfo]] [[nearestTerrainObjects]]
}}


| |MPBEHAVIOUR=  
{{Note
____________________________________________________________________________________________
|user= OOKexOo
|timestamp= 20161230214000
|text= This command does not necessarily return the segment which center is the closest to the given position.<br>
In order to get such segment use [[nearRoads]].
<sqf>_closest_road = (_pos nearRoads 0.1) select 0;</sqf>
}}
}}
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma 3: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on December 30, 2016 - 21:40 (UTC)</dd>
<dt class="note">[[User:OOKexOo|OOKexOo]]</dt>
<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>
<code>_closest_road &#61; (_pos [[nearRoads]] 0.1) select 0;</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 13:39, 8 November 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;