API ReferenceGE Extensionsflowgraphnodesvehicle
Remove Vehicle
- **Node Name:** `Remove Vehicle`
Overview
- Node Name:
Remove Vehicle - Category:
repeat_instant - File:
extensions/flowgraph/nodes/vehicle/removeVehicle.lua
Removes a vehicle from the scene by deleting its scene object. Notifies the editor if present.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
vehId | number | nil | ID of the vehicle to remove |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Finds vehicle by ID, notifies editor, and deletes the object |
How It Works
- Looks up the vehicle by
vehIdusingscenetree.findObjectById(). - If
vehIdis nil or 0, sets outflow to true but does nothing else (player vehicle fallback is commented out). - If the editor is active, calls
editor.onRemoveSceneTreeObjects({id})to notify it. - Calls
source:delete()to permanently remove the vehicle from the scene.
Usage Example
-- In a flowgraph - remove a specific vehicle:
-- [Vehicle ID Source] → (vehId) → [Remove Vehicle]
-- Direct Lua equivalent:
local veh = scenetree.findObjectById(vehId)
if veh then
if editor and editor.onRemoveSceneTreeObjects then
editor.onRemoveSceneTreeObjects({veh:getId()})
end
veh:delete()
endKey Dependencies
scenetree.findObjectById()- resolves vehicle ID to scene objecteditor.onRemoveSceneTreeObjects()- editor notification for scene tree cleanupobj:delete()- permanently removes the object from the scene
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