roadAt: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\{\{GameCategory\|(arma[0123])\|[ _]?New[ _]Scripting[ _]Commands[ _]List\}\}" to "{{GameCategory|$1|New Scripting Commands}}")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| arma3 |Game name=
| arma3 |Game name=
Line 7: Line 6:


|gr1= Roads and Airports |GROUP1=
|gr1= Roads and Airports |GROUP1=
____________________________________________________________________________________________


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


| '''roadAt''' position |SYNTAX=
| '''roadAt''' position |SYNTAX=
Line 24: Line 21:
|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=
|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=


____________________________________________________________________________________________


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


|  |MPBEHAVIOUR=  
|  |MPBEHAVIOUR=  
____________________________________________________________________________________________
}}
}}



Revision as of 03:20, 17 January 2021

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 in format PositionAGL (especially on bridges) or (since Arma 3 v1.99.146460) 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 examplegetModelInfo (roadAt ASLToAGL getPosASL player); // ["bridgesea_01_f.p3d","a3\structures_f_exp\infrastructure\bridges\bridgesea_01_f.p3d",true]

Additional Information

See also:
nearRoadsroadsConnectedToisOnRoadsurfaceIsWatergetRoadInfonearestTerrainObjects

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

Posted on December 30, 2016 - 21:40 (UTC)
OOKexOo
This command does not nessecarly 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;