API ReferenceGE Extensionsflowgraphnodesvehicle
Static Object Touch
- **Node Name:** `Static Object Touch`
Overview
- Node Name:
Static Object Touch - Category:
repeat_instant - File:
extensions/flowgraph/nodes/vehicle/touchingStatic.lua
Detects if a vehicle is intersecting with static objects or terrain by casting rays from the vehicle's center toward 8 bounding-box perimeter points.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle to check. |
widthOffset | number | Width offset relative to vehicle (hidden). |
lengthOffset | number | Length offset relative to vehicle (hidden). |
heightOffset | number | Height offset from ground (hidden, default 0.5). |
debugMode | bool | Display debug drawings for collision checks (hidden). |
Output Pins
| Pin | Type | Description |
|---|---|---|
touching | flow | Active when any static collision is detected. |
touchFL–touchL | flow | Per-direction collision (FL, F, FR, R, BR, B, BL, L - all hidden). |
isTouching | bool | True while any collision is active (hidden). |
Internals
Key Methods
| Method | Description |
|---|---|
init() | Calls reset(). |
_executionStarted() | Allocates vec3 structures for the 8 perimeter points and center. |
_executionStopped() | Cleans up allocated vectors and resets state. |
reset() | Sets all output pins to false. |
work() | Computes 8 perimeter points from the OOBB, casts rays from center, and sets per-direction outputs. |
onPreRender() | Draws debug spheres (green/red) when debug mode is enabled. |
How It Works
- Gets the vehicle's spawn world OOBB (Oriented Object Bounding Box).
- Computes 8 perimeter points (4 corners + 4 edge midpoints) with configurable offsets.
- For each point, casts a ray from the vehicle center using
castRayStatic(). - If the ray hits something before reaching the perimeter point, that direction registers as touching.
- Sets individual per-direction flow pins and the aggregate
touching/isTouchingoutputs. - In debug mode, renders coloured spheres at each check point (red = hit, green = clear).
Usage Example
-- Flowgraph:
-- [Vehicle ID] → vehId → [Static Object Touch]
-- ↓ touching → [Wall Hit Penalty]
-- ↓ touchF → [Front Impact Logic]
-- Equivalent GE Lua raycast:
local center = veh:getSpawnWorldOOBB():getCenter()
local frontPoint = -- computed from OOBB
local dist = frontPoint:distance(center)
local hitDist = castRayStatic(center, frontPoint - center, dist)
if hitDist <= dist then
-- front is touching a static object
endKey Dependencies
veh:getSpawnWorldOOBB()- oriented bounding boxcastRayStatic()- engine raycast against static geometry and terraindebugDrawer- visual debug rendering
See Also
- Align for Coupling (Flowgraph Node) - Related reference
- Apply Velocity to Vehicle (Flowgraph Node) - Related reference
- Boost Vehicle (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide