Raceline Parking (Flowgraph Node)
- **Node Name:** `Raceline Parking`
Overview
- Node Name:
Raceline Parking - Category:
repeat_instant - File:
extensions/flowgraph/nodes/scene/raceLineParking.lua
Manages raceline-style parking detection. Checks whether a vehicle's front wheels are within a defined parking spot, tracks alignment and stopping state, and provides debug visualization.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Standard inflow |
clear | flow (impulse) | Removes the markers |
imgui | bool | (Hidden) Enable ImGui debug preview |
vehId | number | ID of the vehicle to track |
position | vec3 | Position of the parking spot |
rotation | quat | Rotation of the parking spot |
scale | vec3 | Scale of the parking spot |
onlyForward | bool | (Hidden) Restrict to forward parking only |
visibleMarkers | bool | (Hidden) Show visible markers |
stop_timer | number | (Hidden) Seconds until vehicle is considered parked (default 1) |
color_out | color | (Hidden) Color when outside |
color_in | color | (Hidden) Color when inside |
Output Pins
| Pin | Type | Description |
|---|---|---|
inside | flow | Vehicle is fully inside the spot |
stopped | flow | Vehicle has been stopped for stop_timer seconds |
stopping | flow | (Hidden) Vehicle is currently stopping |
stoppedPercent | number | (Hidden) Progress toward the stop timer |
dotAngle | number | Alignment: 1 = perfectly aligned, 0 = perpendicular |
forward | bool | True if parked forward, false if backward |
sideDistance | number | Lateral distance from vehicle center to spot center |
forwardDistance | number | Longitudinal distance from front wheels to spot |
How It Works
- Each frame,
checkParking()identifies front wheels viagetVehicleFrontwheelsCenterPosition(). - Computes alignment (dot product of vehicle direction vs. spot Y-axis) and distances (side/forward offsets).
- Checks if both front wheels are within the spot's scale bounds.
- Tracks a stop timer - when the vehicle is inside and velocity ≤ 0.05, counts down. Once expired,
stoppedfires. drawDebug()renders colored triangles in the 3D scene (green=OK, yellow=close, red=outside).- Optional
drawImgui()renders a top-down 2D preview with parking boundaries and vehicle outline.
Key Dependencies
map.objects[vehId]- vehicle tracking data (position, velocity, direction)veh:getSpawnWorldOOBB()- oriented bounding box for corner checksveh:getWheelAxisNodes()/getWheelCount()- front wheel identificationdebugDrawer:drawTriSolid()- 3D debug rendering
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:_executionStopped()
Called when graph execution stops. Used for cleanup.
C:_onDeserialized(res)
Called after the node is deserialized (loaded from file). Restores runtime state from saved data.
Parameters:
res
C:_onSerialize(res)
Called when the node is serialized (saved to file). Returns data to persist.
Parameters:
res
C:drawLine(line, color, thickness)
Custom ImGui drawing function for the node editor.
Parameters:
linecolorthickness
C:drawMiddle(builder, style)
Custom ImGui drawing in the middle section of the node in the editor.
Parameters:
builderstyle
C:init(mgr, ...)
Initializes the node, setting up pins and default properties.
Parameters:
mgr...
C:onClientEndMission()
Cleanup callback when the mission/level ends.
C:toInternal2d(pos)
Node method.
Parameters:
pos
C:work(args)
Main work function called each frame/tick when the node is active.
Parameters:
args
C:worldLineToMapLine(line)
Node method.
Parameters:
line
See Also
- Collection Marker (Flowgraph Node) - Related reference
- Custom Lua Command (Flowgraph Node) - Related reference
- Get Object Field (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide