API ReferenceGE Extensionsflowgraphnodesmission
KnockAway Check (Flowgraph Node)
- **Node Name:** `KnockAway Check`
Overview
- Node Name:
KnockAway Check - Category:
repeat_instant - File:
extensions/flowgraph/nodes/mission/knockAwayCheck.lua
Detects if vehicles from a prefab have been knocked away (tipped over or moved from their original position). Used for destruction/bowling-style missions. Supports overhead markers and minimap indicators.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Inflow for this node |
reset | flow (impulse) | Resets the detection state |
prefabId | number | ID of the prefab containing target vehicles |
considerTipping | bool | Count vehicles as knocked if tipped (default: true, hidden) |
tippingMinAngle | number | Minimum tipping angle in degrees (default: 45, hidden) |
considerMoving | bool | Count vehicles as knocked if moved (default: true, hidden) |
movingMinDist | number | Minimum displacement in meters (default: 1, hidden) |
showMarkers | bool | Show overhead markers above targets (default: true, hidden) |
defaultPoints | number | Default points per vehicle (hidden) |
Output Pins
| Pin | Type | Description |
|---|---|---|
flow | flow | Outflow for this node |
done | flow | Active when all vehicles have been knocked away |
count | number | Number of vehicles knocked away so far |
total | number | Total number of target vehicles |
points | number | Current points earned (hidden) |
maxPoints | number | Maximum possible points (hidden) |
Internals
| Field | Purpose |
|---|---|
self.originalVehicleTransforms | Original positions/rotations of all prefab vehicles |
self.vehicleHit | Table tracking which vehicles have been knocked |
self.vehiclePoints | Per-vehicle point values (from knockAwayPoints dynamic field or default) |
self.markers | scenario/race_marker module for overhead markers |
self.positions | Stored positions for minimap rendering |
self.data.zOffset | Vertical offset for marker positions |
How It Works
- Setup (first frame): Reads all
BeamNGVehiclechildren from the prefab, records their original transforms (position, rotation, up-vector). Vehicles withignorein their internal name are excluded. - Tipping Detection: Compares current
dirVecUpdot product with original up-vector against the minimum angle threshold. - Movement Detection: Measures distance between current and original positions against
movingMinDist. - Markers: Overhead markers appear above un-knocked vehicles and hide when knocked. Uses
scenario/race_markermodule. - Minimap: Orange circle indicators and edge pointers show remaining targets.
- Points: Each vehicle can have a custom
knockAwayPointsdynamic field, or uses thedefaultPointspin value, or defaults to 1. - Completion:
donefires whenhitCount == totalCount.
Lua Example
-- Setup in level editor:
-- 1. Create a prefab with multiple vehicles (e.g., parked cars)
-- 2. Optionally set dynamic field "knockAwayPoints" on high-value targets
-- 3. Set "ignore" in internal name for vehicles that shouldn't count
-- Flowgraph:
-- prefabId → this node
-- count/total → UI progress display
-- done → mission complete triggerKey Dependencies
self.mgr.modules.prefab- prefab data and vehicle transformsself.mgr.modules.vehicle- vehicle tracking registrationmap.objects- runtime vehicle position/rotation datascenario/race_marker- overhead marker renderingui_apps_minimap_utils- minimap indicators_flowgraph_createNode()- standard flowgraph node registration
Additional Methods
C:_executionStarted()
Called when graph execution starts. Used for initialization/reset.
C:_executionStopped()
Called when graph execution stops. Used for cleanup.
C:getOriginalVehicleTransforms(data)
Node method.
Parameters:
data
C:init()
Initializes the node, setting up pins and default properties.
C:onDrawOnMinimap(td)
Node method.
Parameters:
td
C:onPreRender(dt, dtSim)
Node method.
Parameters:
dtdtSim
C:work()
Main work function called each frame/tick when the node is active.
See Also
- ARunForLife (Flowgraph Node) - Related reference
- Update Display Drag Race (Flowgraph Node) - Related reference
- Clear Lights Drag Race (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide