API ReferenceGE Extensionsflowgraphnodesvehicle
Apply Velocity to Vehicle
- **Node Name:** `Apply Velocity to Vehicle`
Overview
- Node Name:
Apply Velocity to Vehicle - Category:
repeat_p_duration - File:
extensions/flowgraph/nodes/vehicle/applyVelocity.lua
Instantly sets a velocity on a vehicle each frame. Can use a custom direction vector or the vehicle's current facing direction. The coefficient multiplies the direction vector to control speed.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
vehId | number | - | Vehicle ID. Uses player vehicle if not set. |
dirVec | vec3 | - | Direction vector. Uses vehicle's forward direction if not set. |
coefficient | number | 1 | Multiplier for the direction vector (controls speed magnitude). |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Resolves vehicle, computes direction × coefficient, sends to thrusters.applyVelocity(). |
How It Works
- Each frame, resolves the vehicle from
vehIdor falls back to the player vehicle. - If
dirVecis provided, uses it; otherwise readsveh:getDirectionVector(). - Scales the vector by
coefficient. - Sends
thrusters.applyVelocity(vec)to the vehicle's Lua VM.
Tip: To prevent triggering emergency systems (ESC, ABS) on some vehicles, gradually ramp up the coefficient over time rather than applying full force instantly.
Usage Example
-- Flowgraph:
-- [Hold Button] → [Apply Velocity (coefficient=20)] → vehicle flies forward
-- Equivalent vehicle-side call:
thrusters.applyVelocity({x=0, y=20, z=0})
-- Custom direction (upward launch):
-- dirVec = vec3(0, 0, 1), coefficient = 50
-- Result: vehicle launches straight up at 50 m/sKey Dependencies
thrusters.applyVelocity()- vehicle-side thruster moduleveh:getDirectionVector()- vehicle's forward direction
See Also
- Align for Coupling (Flowgraph Node) - Related reference
- Boost Vehicle (Flowgraph Node) - Related reference
- Set Vehicle Colors (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide