getRoadInfo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (2.00 update)
No edit summary
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 2.00


|2.00 |Game version=
|gr1= Roads and Airports


|gr1= Roads and Airports |GROUP1=
|descr= Returns road piece information.
____________________________________________________________________________________________
{{Feature|informative|
 
* Bridges are special case. Only large bridges are part of Road Net. Small pedestrian bridges are not recognized as roads. Bridge "mapType" is {{hl|"ROAD"}} so the best way to detect bridges is to check "isBridge" value. Bridges are not part of new roads and don't have the same info as other new roads, so only "mapType", "texture" (maybe "textureEnd"), "begPos", "endPos" and "isBridge" are  updated.
|Returns road info in format [mapType, width, isPedestrian, texture, textureEnd, material, begPos, endPos, isBridge]
* Pedestrian roads "mapType" is usually {{hl|"TRAIL"}}. They are part of Road Net but excluded from path finding. Use [[roadsConnectedTo]] with alternative flag to find the connections between pedestrian roads.
<br><br>
}}
{{Informative | The bridges are special case. Only large bridges are part of Road Net. Small pedestrian bridges are not recognized as roads. Bridge `mapType` is <tt>"ROAD"</tt> so the best way to detect bridges is to check `isBridge` boolean. Bridges are not part of new roads and don't have the same info as other new roads, so only `mapType`, `texture` (maybe `textureEnd`), `begPos`, `endPos` and `isBridge` are  updated.}}
{{Informative | Pedestrian roads `mapType` is usually <tt>"TRAIL"</tt>. They are part of Road Net but excluded from path finding. Use [[roadsConnectedTo]] with alternative flag to find the connections between pedestrian roads.}} |DESCRIPTION=
____________________________________________________________________________________________


| [[getRoadInfo]] road |SYNTAX=
|s1= [[getRoadInfo]] road


|p1= road: [[Object]] |PARAMETER1=
|p1= road: [[Object]]


| [[Array]] in format [mapType, width, isPedestrian, texture, textureEnd, material, begPos, endPos, isBridge], where:
|r1= [[Array]] in format [mapType, width, isPedestrian, texture, textureEnd, material, begPos, endPos, isBridge, AIpathOffset], where:
* mapType: [[String]] - road segment type, could be <tt>"ROAD"</tt>, <tt>"MAIN ROAD"</tt>, <tt>"TRACK"</tt>, <tt>"TRAIL"</tt> (see [[nearestTerrainObjects]])
* mapType: [[String]] - road segment type, could be {{hl|"HIDE"}}, {{hl|"ROAD"}}, {{hl|"MAIN ROAD"}}, {{hl|"TRACK"}}, {{hl|"TRAIL"}} (see [[nearestTerrainObjects]])
* width: [[Number]] - road segment width
* width: [[Number]] - road segment width
* isPedestrian: [[Boolean]] - when [[true]] road is for pedestrian use only
* isPedestrian: [[Boolean]] - when [[true]] road is for pedestrian use only
Line 26: Line 23:
* textureEnd: [[String]] - road segment surface texture
* textureEnd: [[String]] - road segment surface texture
* material: [[String]] - road segment surface material  
* material: [[String]] - road segment surface material  
* begPos: [[PositionASL]] - start of the road segment
* begPos: [[Array]] format [[Position#PositionASL|PositionASL]] - start of the road segment
* endPos: [[PositionASL]] - finish of the road segment
* endPos: [[Array]] format [[Position#PositionASL|PositionASL]] - finish of the road segment
* isBridge: [[Boolean]] - when [[true]] road segment is a bridge
* isBridge: [[Boolean]] - when [[true]] road segment is a bridge
|RETURNVALUE=
* {{GVI|arma3|2.12|size= 0.75}} AIpathOffset: [[Number]] - config value of `AIpathOffset`
 
____________________________________________________________________________________________


|x1= <code>[[getRoadInfo]] _road</code>|EXAMPLE1=
|x1= <sqf>
|x2= Get direction of the road segment:<code>[[private]] _info = [[getRoadInfo]] _road;
private _info = getRoadInfo _road;
[[private]] _dir = (_info [[select]] 6) [[getDir]] (_info [[select]] 7);</code>|EXAMPLE2=
_info params ["_mapType", "_width", "_isPedestrian", "_texture", "_textureEnd", "_material", "_begPos", "_endPos", "_isBridge"];
____________________________________________________________________________________________
private _roadDirection = _begPos getDir _endPos;
 
</sqf>
| [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[roadAt]] [[nearestTerrainObjects]]|SEEALSO=


|seealso= [[nearRoads]] [[roadsConnectedTo]] [[isOnRoad]] [[roadAt]] [[nearestTerrainObjects]]
}}
}}
<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:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]

Latest revision as of 19:15, 30 December 2022

Hover & click on the images for description

Description

Description:
Returns road piece information.
  • Bridges are special case. Only large bridges are part of Road Net. Small pedestrian bridges are not recognized as roads. Bridge "mapType" is "ROAD" so the best way to detect bridges is to check "isBridge" value. Bridges are not part of new roads and don't have the same info as other new roads, so only "mapType", "texture" (maybe "textureEnd"), "begPos", "endPos" and "isBridge" are updated.
  • Pedestrian roads "mapType" is usually "TRAIL". They are part of Road Net but excluded from path finding. Use roadsConnectedTo with alternative flag to find the connections between pedestrian roads.
Groups:
Roads and Airports

Syntax

Syntax:
getRoadInfo road
Parameters:
road: Object
Return Value:
Array in format [mapType, width, isPedestrian, texture, textureEnd, material, begPos, endPos, isBridge, AIpathOffset], where:
  • mapType: String - road segment type, could be "HIDE", "ROAD", "MAIN ROAD", "TRACK", "TRAIL" (see nearestTerrainObjects)
  • width: Number - road segment width
  • isPedestrian: Boolean - when true road is for pedestrian use only
  • texture: String - road segment surface texture
  • textureEnd: String - road segment surface texture
  • material: String - road segment surface material
  • begPos: Array format PositionASL - start of the road segment
  • endPos: Array format PositionASL - finish of the road segment
  • isBridge: Boolean - when true road segment is a bridge
  • Arma 3 logo black.png2.12 AIpathOffset: Number - config value of `AIpathOffset`

Examples

Example 1:
private _info = getRoadInfo _road; _info params ["_mapType", "_width", "_isPedestrian", "_texture", "_textureEnd", "_material", "_begPos", "_endPos", "_isBridge"]; private _roadDirection = _begPos getDir _endPos;

Additional Information

See also:
nearRoads roadsConnectedTo isOnRoad roadAt 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