API ReferenceGE Extensionsflowgraphnodesvehicle
Shift to Gear Index
- **Node Name:** `Shift to Gear Index`
Overview
- Node Name:
Shift to Gear Index - Category:
repeat_instant - File:
extensions/flowgraph/nodes/vehicle/shiftToGearIndex.lua
Shifts a vehicle to a specific gear index. Intended for vehicles with a manual gearbox. Behavior is undefined for automatic gearboxes or out-of-range gear indices.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
vehId | number | ID of the vehicle to affect. If empty, uses player vehicle |
gear | number | Gear index: 0 = Neutral, -1 = Reverse, 1 = First, 2 = Second, etc. |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Resolves vehicle and executes shiftToGearIndex action via vehicle bridge |
How It Works
- On each tick, resolves the vehicle by
vehIdor falls back togetPlayerVehicle(0). - Calls
core_vehicleBridge.executeAction(veh, 'shiftToGearIndex', gear)with the specified gear index. - Gear indices: -1 = reverse, 0 = neutral, 1+ = forward gears.
Usage Example
-- In a flowgraph - shift to first gear:
-- [Vehicle ID] → [Shift to Gear Index].vehId
-- [Number: 1] → [Shift to Gear Index].gear
-- Direct Lua equivalent:
local veh = getPlayerVehicle(0)
core_vehicleBridge.executeAction(veh, 'shiftToGearIndex', 1) -- first gear
core_vehicleBridge.executeAction(veh, 'shiftToGearIndex', 0) -- neutral
core_vehicleBridge.executeAction(veh, 'shiftToGearIndex', -1) -- reverseKey Dependencies
core_vehicleBridge.executeAction(veh, action, ...)- sends actions to the vehicle Lua environmentscenetree.findObjectById()- resolves vehicle by IDgetPlayerVehicle(0)- gets the current player vehicle
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