Skip to main content

Vehicles

HELIX uses the HVehicle class to handle all drivable vehicles -- cars, trucks, boats, you name it. The system handles physics, engine simulation, fuel, and lighting so you can focus on building great driving experiences.

Spawning a Vehicle

Drop a vehicle into your world by creating a new HVehicle instance with a position, rotation, and Blueprint asset reference.

// Spawn a vehicle at a specific location
AHVehicle* MyCar = HVehicle::Spawn(
FVector(1000, 0, 50),
FRotator(0, 90, 0),
"/Game/Vehicles/BP_Sedan.BP_Sedan_C"
);

Driving Controls

HVehicle exposes direct input controls for throttle, steering, braking, and the handbrake. You can also manage the engine lifecycle and fuel system.

// Apply full throttle and steer left
MyCar->SetThrottleInput(1.0f);
MyCar->SetSteeringInput(-0.5f);

// Apply brakes
MyCar->SetBrakeInput(1.0f);

// Engage handbrake
MyCar->SetHandBrakeInput(true);

Steering input ranges from -1.0 (full left) to 1.0 (full right). Throttle and brake range from 0.0 to 1.0.

Fuel & Engine

HVehicle includes a fuel system and engine lifecycle controls. You can set fuel levels, start and stop the engine, and monitor engine health.

// Set fuel to full
MyCar->SetFuel(1.0f);

// Start the engine
MyCar->HoldStarter(0.5f);
MyCar->ReleaseStarter();

// Check engine health
float Health = MyCar->GetEngineHealth();

Lights & Sirens

HVehicle provides fine-grained control over vehicle lighting, including indicators, brake lights, hazard lights, and sirens for emergency vehicles.

// Turn on hazard lights
MyCar->SetHazardLight(true);

// Enable siren for emergency vehicles
MyCar->SetSirenState(true);

// Turn on left indicator
MyCar->SetLeftIndicator(true);
tip

You can find a variety of ready-to-use vehicle assets in the Vault, or import your own custom meshes with custom seat and door configurations.