API ReferenceGE Extensionsflowgraphnodesutil
Route Position
- **Node Name:** `Route Position`
Overview
- Node Name:
Route Position - Category:
once_instant - File:
extensions/flowgraph/nodes/util/routePosition.lua
Gets a position and direction along a navgraph route at a specified distance ahead. Useful for placing objects, triggers, or checkpoints along a pre-computed route.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
navgraphRoute | table (navgraphPath) | - | Array of waypoints forming a route |
distance | number | - | Distance ahead on the route |
Output Pins
| Pin | Type | Description |
|---|---|---|
pos | vec3 | Target position at the given distance along the route |
dirVec | vec3 | Direction vector of the road segment at that position |
n1 | string | First node of the road segment |
n2 | string | Second node of the road segment |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Calls onNodeReset() |
_executionStopped() | Calls onNodeReset() |
onNodeReset() | Creates a fresh route object |
workOnce() | Sets up the route path and steps ahead by the given distance |
Route Object
Uses gameplay/route/route module internally. A new route instance is created on reset. The route is set up via setupPathMultiWaypoints() and then stepAhead() returns the road segment and interpolated position.
How It Works
- On reset, instantiates a fresh
routeobject fromgameplay/route/route. - When executed, calls
route:setupPathMultiWaypoints()with the input waypoint array. - Calls
route:stepAhead(distance)to find the position at the given distance. - Outputs the interpolated position, direction vector (normalized), and the two navgraph node names of the containing segment.
Usage Example
-- Get position 50 meters ahead on a route:
-- navgraphRoute = {"wp_001", "wp_002", "wp_003", ...}
-- distance = 50
-- Output: pos = {x, y, z}, dirVec = {dx, dy, dz}, n1 = "wp_002", n2 = "wp_003"
-- Chain with Get Navgraph Route:
-- 1. routePointToPoint → navgraphRoute
-- 2. routePosition(navgraphRoute, distance) → pos, dirVec
-- Place a checkpoint 100m ahead:
-- distance = 100 → use pos output for checkpoint placementKey Dependencies
gameplay/route/route- route calculation modulemap.getMap().nodes- navgraph node positions for direction calculation
See Also
- Route Distance (Flowgraph Node) - Related reference
- Closest Road (Flowgraph Node) - Related reference
- Custom Lua (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide