Car Controller
A simple demo vehicle controller showcasing WheelController3D integration. This barebones controller is intended for standalone use only - for a complete vehicle physics solution with advanced features, use NWH Vehicle Physics instead.
Overview
The CarController component provides basic arcade-style car control: steering, acceleration, braking and handbrake. It accepts any wheel inheriting from the WheelUAPI interface, which is currently:
- WheelController - The main wheel physics component
WheelColliderUAPI- An extension to the Unity WheelCollider that providesWheelUAPIbindings for compatibility
Setup
For step-by-step setup instructions including how to configure the CarController, see:
- Quick Start Guide - Step 7: Add Vehicle Control (Standalone Only)
- Wheel Controller Setup - Car Controller section
Configuration
The CarController is configured per-wheel through the _Wheel struct properties:
- Steer - Enable steering for this wheel (typically front wheels)
- Power - Enable motor torque for this wheel (front for FWD, rear for RWD, all for AWD)
- Handbrake - Enable handbrake application for this wheel (typically rear wheels)
Behavior
The CarController provides the following features:
- Steering - Dynamic steering angle based on vehicle speed (ranges between
maxSteeringAngleandminSteeringAngle) - Acceleration - Motor torque applied to powered wheels up to
maxMotorTorque - Braking - Brake torque applied to wheels up to
maxBrakeTorque - Handbrake - High brake torque applied to handbrake-enabled wheels
Input
The CarController uses Unity's Input System package for input handling. The input bindings are defined in the CarInputActions asset located in Runtime/Input/.
Default Controls:
| Action | Keyboard | Gamepad |
|---|---|---|
| Steering | A/D | Left Stick Horizontal |
| Throttle/Brake | W/S | Left Stick Vertical |
| Handbrake | Space | South Button (A/X) |
To customize bindings, modify the CarInputActions.inputactions file in the package.
Note: Ensure Project Settings > Player > Active Input Handling is set to
Input System Package (New)orBoth.
Important Notes
- This is a simple demo controller and is not a replacement for a complete vehicle physics solution
- The controller uses Unity's new Input System package (not the legacy Input Manager)
- Wheels are found automatically but the Steer, Power, and Handbrake settings must be configured per wheel
- For full vehicle physics including transmission, traction control, and advanced suspension tuning, use NWH Vehicle Physics
- The CarController inherits from the
Vehicleclass for compatibility with NWH's VehicleChanger and other vehicle management systems