API ReferenceGE Extensionsflowgraphnodesutil
Road Properties
- **Node Name:** `Road Properties`
Overview
- Node Name:
Road Properties - Category:
repeat_instant - File:
extensions/flowgraph/nodes/util/roadSegment.lua
Outputs detailed properties of a road segment defined by two navgraph node names, including direction, width, speed limit, drivability, and lane information.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
n1 | string | - | First node of the road segment |
n2 | string | - | Second node of the road segment |
xnorm | number | 0.5 | Normalized distance along the segment (0–1) (hidden) |
Output Pins
| Pin | Type | Description |
|---|---|---|
roadDir | vec3 | Road direction vector (respects one-way direction) |
length | number | Road segment length |
width | number | Road width at xnorm position |
drivability | number | Road drivability value (0–1) |
speedLimit | number | Road speed limit in m/s |
lanesIncoming | number | Incoming lanes count |
lanesOutgoing | number | Outgoing lanes count |
lanesTotal | number | Total lanes count |
isOneWay | bool | True if the road is one-way only (hidden) |
isPrivate | bool | True if the road is private / gated (hidden) |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Clears cached node IDs |
_executionStarted() | Resets cached node IDs |
work() | Reads navgraph data for the given segment and outputs properties |
Caching Strategy
The node caches n1 and n2 and only recalculates static properties (direction, length, drivability, speed limit, lanes) when the node pair changes. The width output updates every frame since it depends on the dynamic xnorm input.
Lane Parsing
Lanes are parsed from the link's lanes string (default '-+'). The - characters count as incoming lanes, + as outgoing lanes.
Direction Handling
The direction vector points from n1 to n2, but is flipped if the link's inNode matches n2 (respecting one-way road direction).
How It Works
- Retrieves navgraph map data via
map.getMap().nodes. - Looks up the link between
n1andn2for segment properties. - Computes direction vector, normalized, between the two node positions.
- Width is calculated as
lerp(a.radius, b.radius, xnorm) * 2. - Lane counts are derived by counting
-and+characters in the lane string.
Usage Example
-- Get properties of a road segment:
-- n1 = "wp_road_001", n2 = "wp_road_002"
-- xnorm = 0.5 (midpoint)
-- Outputs: length, width, speedLimit, drivability, lane counts, direction
-- Check if road is one-way:
-- isOneWay output will be true/false
-- Get width at a specific point:
-- xnorm = 0.0 → width at node n1
-- xnorm = 1.0 → width at node n2Key Dependencies
map.getMap()- navgraph map data access
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide