roadAt: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|Game Version= (number surrounded by NO SPACES)" to "|Game Version (number surrounded by NO SPACES)=") |
Lou Montana (talk | contribs) m (Text replacement - " (\|[pr][0-9]+ *= *[^-]+) *- *A([a-z])" to " $1 - a$2") |
||
(42 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma3 | | |game1= arma3 | ||
|version1= 1.58 | |||
|arg= global | |arg= global | ||
| | |gr1= Roads and Airports | ||
| | |descr= Returns a road segment containing given position, [[objNull]] otherwise. Same as [[isOnRoad]] only returns the actual road object instead of boolean. | ||
| | |s1= [[roadAt]] position | ||
| [[Object]] - | |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]] | ||
| | |x1= <sqf>_road = roadAt ASLToAGL getPosASL player;</sqf> | ||
| | |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]] | |seealso= [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[surfaceIsWater]] [[getRoadInfo]] [[nearestTerrainObjects]] | ||
}} | |||
| | {{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> | |||
}} | }} | ||
Latest revision as of 12:39, 8 November 2023
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 2.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:
- Example 2:
- 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
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 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.