roadAt: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<dd class="note">([^}]*)<code>([^<]*)<\/code>" to "<dd class="note">$1<sqf>$2</sqf>") |
m (Replaced <code> with <sqf>) |
||
Line 19: | Line 19: | ||
|x2= <sqf>_isOnRoad = !isNull roadAt player;</sqf> | |x2= <sqf>_isOnRoad = !isNull roadAt player;</sqf> | ||
|x3= For detecting bridges, for example< | |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> | |||
|seealso= [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[surfaceIsWater]] [[getRoadInfo]] [[nearestTerrainObjects]] | |seealso= [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[surfaceIsWater]] [[getRoadInfo]] [[nearestTerrainObjects]] | ||
Line 32: | Line 33: | ||
This command does not nessecarly return the segment which center is the closest to the given position.<br> | 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> | In order to get such segment use [[nearRoads]].<br> | ||
<sqf>_closest_road | <sqf>_closest_road = (_pos nearRoads 0.1) select 0;</sqf> | ||
</dd> | </dd> | ||
</dl> | </dl> |
Revision as of 15:37, 14 May 2022
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 (since Arma 3 v2.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