unfurl

Vehicles

Modular physics vehicles for Unreal Engine: cars, karts, trucks, bikes, and hover vehicles.

Modular physics vehicles for Unreal Engine: cars, karts, trucks, bikes, and hover vehicles.

👀 Summary

NsVehicles drives physics vehicles in Unreal Engine: cars, karts, trucks, bikes, and hover vehicles. One physics body moves the vehicle. Suspension components trace the ground and push the body up. Module components add the drive, brake, steering, and other forces. It is for gameplay programmers and designers who want a vehicle that they can tune in the Details panel.

NsVehicles is not a full tire model, and it is not a Chaos Vehicles replacement. The wheels are traces, not colliders. The drive force acts on the body, not on each wheel. There is no clutch.

📦 Features

⚙️ Requirements

🛠️ Installation

  1. Clone or download this repository.
  2. Copy the NsVehicles folder into the Plugins folder of your project.
  3. For C++, add "NsVehicle" and "AsyncTickPhysics" to PublicDependencyModuleNames in the Build.cs file of your game module. ANsVehicle derives from AAsyncTickPawn.
  4. Generate the project files.
  5. In Edit > Plugins, enable NsVehicle.

🚀 Getting Started

  1. Make a Blueprint class with NsVehicle as the parent.
  2. Add a Static Mesh component as the root. Give it a mesh with simple collision, and enable Simulate Physics.
  3. Add four NsVehicleSuspensionComponent components under the root, one above each wheel position.
  4. On each suspension component, set Wheel Mesh. On the two front ones, enable Is Steering Wheel.
  5. In the input events, call Get Controls, then Set Throttle Input, Set Brake Input, and Set Steering Input.

The default Engine module uses the arcade powertrain, so the vehicle drives with no other setup. In C++:

#include "Modules/Control/NsVehicleControlsComponent.h"
#include "Vehicle/NsVehicle.h"

void AMyPlayerController::DriveForward(ANsVehicle* Vehicle, const float Input)
{
    Vehicle->GetControls()->SetThrottleInput(Input);
}

🧩 Modules

Module Getter What it does
Controls GetControls Holds the driver input and sends it to the server
Engine GetEngine Makes the torque and the RPM. Selects arcade or standard
Transmission GetTransmission Owns the gears, the differential, and the automatic gearbox
Drivetrain GetDrivetrain Removes power when the driven wheels slip
Brakes GetBrakes Owns the brakes, the reverse drive, and the handbrake
Steering GetSteering Limits the steering by speed and turns the steering wheels
BodyDynamics GetBodyDynamics Adds the body pitch and the bike lean
Aerodynamics GetAerodynamics Adds the air drag in the standard powertrain
AirControl GetAirControl Turns the vehicle in the air
AntiGravity GetAntiGravity Pulls the vehicle to the surface under it
IdleLock GetIdleLock Holds the vehicle in place when it stops
Network GetNetwork Replicates the vehicle state
Animation GetAnimation Spins the wheels for the take recorder

🔧 API

Main Classes

Main Functions

🚧 Limits

📚 Documentation


Contact