AA Vehicle Controller Banner

AA Vehicle Controller

A production-ready, physics-based vehicle simulation system for Unity. Features realistic driving mechanics, advanced AI with A* GPS pathfinding, multi-layer audio, damage deformation, mobile controls, and a one-click Vehicle Creator Wizard.

Version 1.0.0 • Unity 2022.3+ • © 2026 Abyssal Ababeel

Requirements

Minimum setup needed to use this package.

Unity Version

Unity 2022.3 LTS or newer. Supports Unity 6+.

Render Pipeline

Works with Built-in, URP, and HDRP. Emission intensity adapts automatically.

Input System

Supports both Legacy Input Manager and New Input System. Auto-detects at runtime.

TextMeshPro

Required for Dashboard UI. Included in Unity by default.

Quick Start Guide

Get a driveable vehicle in under 2 minutes.

Method 1: Vehicle Creator Wizard (Recommended)

  1. Go to Tools → Abyssal Ababeel → Vehicle Creator Wizard
  2. Drag your vehicle 3D model into the Vehicle Model slot
  3. Assign the 4 wheel meshes (FL, FR, RL, RR)
  4. Select a preset (Sports, Sedan, SUV, Racing, etc.)
  5. Enable desired systems: Audio, AI, Nitro, Damage, Lights, etc.
  6. Click "Create Vehicle" — done!

Method 2: Manual Setup

  1. Add a Rigidbody to your vehicle root object
  2. Add 4 child WheelCollider components at each wheel position
  3. Add the VehicleController component (auto-adds WheelManager, SoundManager, VehicleInput)
  4. Assign wheel colliders in the WheelManager
  5. Configure the VehiclePreset in the inspector
  6. Add a VehicleCamera to your Main Camera
  7. Press Play!
💡 TipThe Vehicle Creator Wizard handles all Rigidbody, WheelCollider, and component setup automatically. Use it to avoid manual configuration errors.

🛠 Architecture Overview

How the package components connect together.

VehicleController
←→
VehicleInput
←→
WheelManager
SoundManager
NitroSystem
LightingSystem
DamageSystem
SkidMarkSystem
TireSmokeSystem
AIVehicleController
GPS Pathfinder (A*)
AIForesight

Namespace Structure

AbyssalAbabeel.VehicleController           // Core (VehicleController, VehicleInput, VehiclePreset, Events)
AbyssalAbabeel.VehicleController.Audio     // SoundManager, VehicleAudio
AbyssalAbabeel.VehicleController.AI        // AIVehicleController, AIForesight
AbyssalAbabeel.VehicleController.Systems   // Nitro, Damage, Lighting, SkidMark, TireSmoke
AbyssalAbabeel.VehicleController.Camera    // VehicleCamera
AbyssalAbabeel.VehicleController.UI        // VehicleDashboard
AbyssalAbabeel.VehicleController.Mobile    // MobileInputHandler, SteeringWheel/Drag/Buttons
Pathfinder.Runtime                         // PathGrid, AStarSolver, PathNode, RuntimePathfinder

🚗 Vehicle Controller

Core physics and driving simulation component. Attach to the vehicle root GameObject.
Script: Runtime/Core/VehicleController.cs • Requires: Rigidbody, WheelManager, SoundManager, VehicleInput

Engine Settings

PropertyTypeDefaultDescription
maxRPMfloat5000Maximum engine RPM before rev limiter kicks in.
minRPMfloat900Minimum RPM the engine will hold (prevents stalling).
idleRPMfloat800RPM when stationary with no throttle input.
enginePowerCurveAnimationCurve100→500Torque output over RPM range (X: 0–1 normalized RPM, Y: Nm).
engineSmoothTimefloat0.2Smoothing for RPM changes (lower = snappier response).

Transmission

PropertyTypeDefaultDescription
driveTypeenumAWDFrontWheelDrive, RearWheelDrive, or AllWheelDrive.
maxSpeedKPHfloat150Top speed in kilometers per hour.
numberOfGearsint5Number of forward gears (ratios auto-generated if empty).
finalDrivefloat2.5Final drive ratio — higher = more acceleration, lower top speed.
reverseSpeedKPHfloat40Maximum reverse speed.
isAutomaticbooltrueAuto gear shifting. Set false for manual (use Q/E keys).

Physics

PropertyTypeDefaultDescription
vehicleWeightfloat1900Vehicle mass in kg. Applied to Rigidbody.
torqueMultiplierfloat2Global torque scale. Increase for more power.
downForceValuefloat12Downforce applied at speed for grip (N per m/s).
dragAmountfloat0.015Aerodynamic drag coefficient.
brakeMultiplierfloat1Scales brake force for both foot brake AND handbrake. Range: 0.5–5.
maxSteeringAnglefloat38Maximum wheel steering angle in degrees.
centerOfMassTransformTransformnullCustom center of mass position. Critical for handling balance.

Drift System

PropertyTypeDefaultDescription
enableDriftbooltrueEnable drift mechanics on handbrake.
driftIntensityfloat0How aggressively the rear breaks loose (0 = mild, 1+ = extreme).
driftStiffnessReductionfloat6Rear tire sideways stiffness reduction during drift.

Launch Control

PropertyTypeDefaultDescription
enableLaunchControlboolfalseEnable launch control system.
launchControlRPMfloat4500RPM limit while arming (hold handbrake + throttle).
launchBoostMultiplierfloat1.3Torque boost on launch release.
🔨 How Launch Control WorksHold Space (handbrake) + W (throttle) while stationary. RPM builds to launchControlRPM. Release Space to launch with boosted torque for 0.3 seconds.

Read-Only Properties

PropertyTypeDescription
engineRPMfloatCurrent engine RPM.
KPHfloatCurrent speed in km/h (negative when reversing).
RPMPercentfloatNormalized RPM (0–1). Useful for UI gauges.
EngineLoadfloatCurrent engine load (0–1). Used by audio systems.
currentGearintCurrent gear number (1–N).
isReversingboolTrue when vehicle is in reverse gear.
engineRunningboolTrue when engine is on.

🎮 Vehicle Input

Unified input handler supporting Legacy, New Input System, and Mobile modes.
Script: Runtime/Core/VehicleInput.cs • Auto-added with VehicleController

Input Modes

ModeDescriptionSetup
LegacyInputUnity's classic Input Manager (GetAxis, GetKey).Works out of the box. Configure axis names in inspector.
NewInputSystemUnity's new Input System package.Assign InputActionAsset. Create "Vehicle" action map with: Steer, Throttle, Handbrake actions.
MobileTouch-based on-screen controls.Input handled by MobileInputHandler component. Add UI buttons.

Legacy Input Key Bindings

PropertyDefault KeyDescription
horizontalAxis"Horizontal"Steering (A/D or Arrow keys).
verticalAxis"Vertical"Throttle/Brake (W/S or Arrow keys).
handbrakeKeySpaceHandbrake / Drift trigger.
shiftUpKeyEManual shift up.
shiftDownKeyQManual shift down.
engineToggleKeyFStart/Stop engine.
nitroKeyLeft ShiftActivate nitro boost.
cameraSwitchKeyTabCycle camera modes.
💡 AI OverrideWhen isAIControlled = true, all human input is skipped. The AIVehicleController writes directly to horizontal, vertical, and handbrake fields.

📦 Vehicle Presets

ScriptableObject-based vehicle configuration. Save and share vehicle setups as assets.
Script: Runtime/Core/VehiclePresetAsset.cs • Menu: Abyssal Ababeel → Vehicle Preset

Built-in Factory Presets

PresetTop SpeedMax RPMWeightDriveDriftLaunch Control
Sports260 km/h80001400 kgRWDYes (1.2)Yes
Sedan200 km/h65001600 kgFWDNoNo
SUV180 km/h60002200 kgAWDNoNo
Racing320 km/h90001100 kgRWDYes (0.8)Yes (1.5x)
Truck140 km/h45003500 kgRWDNoNo
Offroad160 km/h55002000 kgAWDNoNo
Van160 km/h50002800 kgFWDNoNo

Usage

// Create preset from code
var preset = VehiclePresetAsset.CreateSportsPreset();

// Apply preset to vehicle at runtime
vehicleController.activePreset = preset.ToRuntimePreset();

// Save current settings to preset asset
preset.FromRuntimePreset(vehicleController.activePreset);

🔔 Vehicle Events

UnityEvent-based callbacks for game logic integration.
Script: Runtime/Core/VehicleEvents.cs

EventTypeFires When
onEngineStartedUnityEventEngine successfully starts.
onEngineStoppedUnityEventEngine is turned off.
onGearChangedUnityEvent<int,int>Gear changes. Args: (oldGear, newGear).
onShiftUp / onShiftDownUnityEventGear shifts up or down.
onDriftStarted / onDriftEndedUnityEventVehicle enters/exits drift state.
onHandbrakeChangedUnityEvent<bool>Handbrake state toggles.
onSpeedChangedUnityEvent<float>Speed changes (KPH value).
onNitroActivated / DeactivatedUnityEventNitro boost starts/stops.
onCollisionUnityEvent<float>Vehicle collides. Arg: impact force.
onReverseEngaged / DisengagedUnityEventReverse gear toggled.
onAllWheelsGrounded / onAirborneUnityEventGrounding state changes.

🎵 Sound Manager

Advanced positional audio with 11 independent sound components, interior/exterior switching, and per-component volume control.
Script: Runtime/Audio/SoundManager.cs • Auto-added with VehicleController

Sound Components

ComponentDefault VolumePositionDescription
engineRunning0.21EngineMain engine loop, RPM-driven pitch.
engineStart0.10EngineOne-shot starter motor sound.
engineFan0.071EngineCooling fan / belt whine.
exhaustPop0.415ExhaustBackfire pops on deceleration.
turboWhistle0.012EngineTurbo spool-up whistle.
turboFlutter0.052EngineBlow-off valve flutter on throttle release.
gearShift0.763TransmissionGear change clunk sound.
transmissionWhine0.006TransmissionTransmission gear whine.
tireSkid0.30WheelsTire screech on slip.
suspensionBump0.225WheelsBump/thud on suspension compression.
crash1.0VehicleCollision impact sound.

Master Settings

PropertyTypeDefaultDescription
masterVolumefloat1.0Global volume multiplier (0–2).
spatialBlendfloat00 = 2D, 1 = full 3D positional audio.
enableInteriorAudiobooltrueToggle interior/exterior audio based on camera mode.
interiorVolumeMultiplierfloat0.5Volume when in interior camera mode.
interiorLowPassCutofffloat1700Low-pass filter frequency for muffled interior sound.

Positional Audio Offsets

PropertyDefaultDescription
enginePosition(0, 0.5, 1.2)Local offset for engine sounds (front of car).
exhaustPosition(0, 0.2, -2)Local offset for exhaust sounds (rear).
transmissionPosition(0, 0.3, 0)Local offset for transmission sounds (center).

🎧 Vehicle Audio (Legacy)

Simpler audio system with two modes: Multi-Clip (4 crossfaded loops) or Single-Clip (pitch-based).
Script: Runtime/Audio/VehicleAudio.cs

Audio Modes

Multi-Clip Mode

4 engine loops (lowAccel, lowDecel, highAccel, highDecel) crossfaded by RPM and throttle. Most realistic.

4 Clips Required

Single-Clip Mode

One engine loop with pitch/volume mapped to RPM. Easy setup, good for mobile or simple games.

1 Clip Required

🔥 Nitro System

Boost system with fuel management, particle effects, and auto-refill.
Script: Runtime/Systems/NitroSystem.cs

PropertyTypeDefaultDescription
enableNitrobooltrueMaster enable toggle.
boostForceMultiplierfloat2.5Speed multiplier during boost.
maxBoostFuelfloat100Total fuel capacity.
boostConsumptionRatefloat20Fuel used per second while boosting.
autoRefillbooltrueAuto-refill fuel when not boosting.
autoRefillRatefloat10Fuel recovered per second.
useNitroBottlesbooltrueEnable bottle-based instant refills.
boostParticlesParticleSystem[]nullFlame/glow particles during boost.

💥 Damage System

Real-time mesh deformation on collision. Supports MeshFilter and SkinnedMeshRenderer.
Script: Runtime/Systems/DamageSystem.cs

PropertyTypeDefaultDescription
maxHealthfloat100Vehicle health points.
deformationRadiusfloat0.7Radius of vertex deformation from impact point (meters).
deformationStrengthfloat0.4How much vertices displace per unit of force.
maxDeformationfloat0.4Maximum vertex displacement cap (meters).
smoothDampingfloat0.3Deformation interpolation (lower = more gradual).
deformableMeshesList[]Meshes that receive deformation (body panels, bumpers, etc.).
💡 RepairCall damageSystem.Repair() or use the context menu "Repair Vehicle" to restore original mesh vertices and reset health.

💡 Lighting System

Configurable light groups with key bindings, plus automatic brake and reverse lights.
Script: Runtime/Systems/LightingSystem.cs

Light Groups

Create unlimited light groups (headlights, fog lights, interior lights, etc.). Each group has a toggle key and list of GameObjects to enable/disable.

Brake & Reverse Lights

PropertyDefaultDescription
brakeLightObjects[]GameObjects activated when braking.
brakeColorRedEmission color for brake lights.
brakeIntensity2.0HDR emission intensity.
reverseLightColorWhiteEmission color for reverse lights.
reverseIntensity3.0HDR emission intensity for reverse.

🏇 Skid Mark System

Dynamic tire mark rendering using procedural mesh generation.
Script: Runtime/Systems/SkidMarkSystem.cs

PropertyTypeDefaultDescription
enableSkidMarksbooltrueMaster enable.
minSlipThresholdfloat0.4Min wheel slip to start rendering marks.
markWidthfloat0.2Width of each tire mark (meters).
maxMarksint1024Maximum stored mark segments (ring buffer).
skidMarkMaterialMaterialnullCustom material. Auto-creates dark material if null.
⚡ PerformanceBuilt-in LOD: marks skip rendering beyond 150m from camera, and reduce to every 3rd frame beyond 100m.

💨 Tire Smoke System

Per-wheel smoke particles driven by wheel slip. Auto-spawns from prefab or creates procedural particles.
Script: Runtime/Systems/TireSmokeSystem.cs

PropertyTypeDefaultDescription
smokePrefabParticleSystemnullCustom smoke prefab (auto-cloned to each wheel). If null, creates procedural smoke.
minSlipThresholdfloat0.35Min combined slip to emit smoke.
maxEmissionRatefloat80Maximum particles per second.
driftEmissionMultiplierfloat2.5Extra smoke during handbrake drift.
minSpeedKPHfloat8No smoke below this speed.

🎥 Vehicle Camera

3-mode camera system: Follow, Orbit, and Interior. Attach to Main Camera.
Script: Runtime/Camera/VehicleCamera.cs

Camera Modes

Follow Mode

Third-person chase camera with smooth damping, reverse-aware blending, and configurable distance/height.

Orbit Mode

Free orbit around vehicle with mouse. Includes collision detection to prevent clipping through walls.

Interior Mode

First-person cockpit view. Mouse look with angle limits. Triggers interior audio mode in SoundManager.

Follow Mode Properties

PropertyDefaultDescription
followDistance7.5Distance behind vehicle.
followHeight1.0Height above vehicle.
followSmoothTime0.08Camera lag (lower = tighter).
reverseConfirmDelay0.5sSeconds before camera flips for reverse.
directionBlendSpeed2.0Camera flip transition speed.

📈 Dashboard UI

In-game HUD showing speed, RPM gauge, gear indicator, nitro bar, and engine status.
Script: Runtime/UI/VehicleDashboard.cs • Requires: TextMeshPro

UI Slots

SlotTypeDescription
speedTextTMP_TextDisplays current KPH.
rpmTextTMP_TextDisplays current RPM.
gearTextTMP_TextCurrent gear or "R" for reverse.
rpmNeedleImageRotated based on RPM (needleMinAngle to needleMaxAngle).
nitroSliderSliderNitro fuel bar with color gradient (red→cyan).
engineStatusTextTMP_Text"ENGINE: ON/OFF" with color coding.

📱 Mobile Controls

Touch-based input with 3 steering modes.
Script: Runtime/Mobile/MobileInputHandler.cs

Steering Modes

Buttons

Left/Right arrow buttons for steering. Simple and reliable.

Drag

Touch and drag horizontally on screen to steer. Intuitive for casual games.

Wheel

Virtual steering wheel UI element. Most realistic mobile experience.

Button Assignments

ButtonTypeDescription
gasButtonUI ButtonHold to accelerate.
brakeButtonUI ButtonHold to brake/reverse.
handbrakeButtonUI ButtonHold for handbrake/drift.
nitroButtonUI ButtonHold for nitro boost.
engineToggleButtonUI ButtonTap to start/stop engine.
cameraSwitchButtonUI ButtonTap to cycle camera modes.

🤖 AI Vehicle Controller

Autonomous driving AI with 4 behavior modes, integrated GPS pathfinding, obstacle avoidance, and predictive targeting.
Script: Runtime/AI/AIVehicleController.cs • Requires: VehicleController

Detection Settings

PropertyDefaultDescription
forwardRays9Number of forward-facing detection rays.
forwardMaxDistance30Forward ray detection range (meters).
forwardRaySpread80Angular spread of forward rays (degrees).
sideRays / rearRays5 / 7Side and rear detection rays.
obstacleDetectionRadius1.0SphereCast radius for obstacle detection.

Intelligence

PropertyDefaultDescription
safeDistance12Comfortable distance from obstacles.
dangerDistance5Active avoidance begins.
emergencyDistance2Emergency steering/braking.
steeringHelper3.0How aggressively AI corrects steering (higher = sharper).
enablePredictiveTargetingtrueAI predicts where moving target will be.
maxPredictionTime2.5sMax time ahead for target prediction.

Speed & Handling

PropertyDefaultDescription
maxSpeedPercent1.0Throttle cap (0.5 = half speed).
cornerSpeedMultiplier0.65Speed reduction in turns.
brakingDistance20Distance to start braking for target.
waypointReachedDistance10How close to reach before advancing waypoint.

🗺 GPS Pathfinder

Integrated A* pathfinding with async grid scanning for zero FPS impact. Finds optimal paths around complex obstacles.

PropertyRangeDefaultDescription
enableGPSbooltrueEnable A* pathfinding navigation.
gpsGridSizeVector2(80, 80)World size of scanning grid.
gpsNodeRadius0.5–20.75Grid cell size. Smaller = more precise.
gpsObstaclePadding0.5–62.0Extra clearance around obstacles.
gpsProximityPenalty0–15050A* cost penalty near obstacles.
gpsSmoothingClearance0.5–31.2SphereCast radius for path smoothing.
gpsLookahead5–3015How far ahead on path to steer toward.
gpsInfluence0–10.45Blend between GPS and reactive steering.
⚡ Async Grid ScanningGrid construction is spread across multiple frames (~300 nodes/frame). A 6400-node grid completes in ~20 frames with zero FPS impact. Old path stays active during scanning.

🛠 AI Modes

4 behavior modes for different gameplay scenarios.

General

Follows waypoint sequence. Stops at final waypoint. Best for traffic, patrols, cutscenes.

Waypoints Required

Racing

Follows waypoint circuit with loop. Optimizes speed, takes racing lines. Best for racing AI opponents.

Waypoints Required

Follow Aggressive

Pursues target vehicle at close range (3m). Uses GPS + reactive avoidance. Best for police chases.

Follow Target Required

Follow Friendly

Follows target at comfortable distance (25m). Gentle braking, safe pursuit. Best for escort missions.

Follow Target Required

Drive States

The AI operates through an internal state machine: ForwardSlowingDownTurningReversingEscapingStuckAggressiveChase. States are shown in the Debug Info section of the inspector.

🔧 Vehicle Creator Wizard

One-click vehicle setup editor window.
Script: Editor/VehicleCreatorWindow.cs • Menu: Tools → Abyssal Ababeel → Vehicle Creator Wizard

Features

  • Auto-creates Rigidbody, WheelColliders, and all components
  • 7 built-in presets (Sports, Sedan, SUV, Racing, Truck, Offroad, Van)
  • Optional systems: AI, Nitro, Damage, Lighting, SkidMarks, TireSmoke, Dashboard
  • Auto-generates gear ratios based on speed and RPM
  • Creates center of mass transform
  • Supports both SoundManager and VehicleAudio

🗻 Runtime Pathfinder

Standalone A* pathfinding component with visual debugging. Can be used independently of the AI system.
Script: Runtime/Pathfinder/RuntimePathfinder.cs

PropertyDefaultDescription
gridWorldSize(40, 40)Grid coverage area in meters.
nodeRadius0.5Cell size (smaller = higher resolution).
obstacleMask-LayerMask for obstacles.
initialPoint / targetPoint-Path start and end transforms.
autoUpdatePathfalseRecompute path every frame.
showPath / showGridtrueGizmo visualization toggles.

Default Controls

Default keyboard bindings (all configurable in VehicleInput inspector).

ActionKeyNotes
AccelerateW / Throttle input (0–1 analog).
Brake / ReverseS / Brake when moving forward, reverse when stopped.
Steer LeftA / Analog steering.
Steer RightD / Analog steering.
HandbrakeSpaceRear wheel lock. Hold for drift (if enabled).
Shift UpEManual transmission only.
Shift DownQManual transmission only.
Engine ToggleFStart/Stop engine.
Nitro BoostLeft ShiftHold while driving. Requires NitroSystem.
Switch CameraTabCycle: Follow → Orbit → Interior.

💻 Public API Reference

Key methods available for scripting integration.

VehicleController

// Engine control
vehicleController.StartEngine();
vehicleController.StopEngine();
vehicleController.ToggleEngine();

// Runtime properties
float speed = vehicleController.KPH;
float rpm = vehicleController.engineRPM;
float rpmNorm = vehicleController.RPMPercent;    // 0-1
float load = vehicleController.EngineLoad;       // 0-1
int gear = vehicleController.currentGear;
bool reversing = vehicleController.isReversing;

NitroSystem

float fuelPercent = nitroSystem.GetBoostFuelPercent();  // 0-1
float fuelCurrent = nitroSystem.GetCurrentBoostFuel();
float fuelMax = nitroSystem.GetMaxBoostFuel();
bool boosting = nitroSystem.IsBoosting();

DamageSystem

damageSystem.Repair();  // Restore all meshes to original state

VehicleCamera

vehicleCamera.CycleCamera();   // Next camera mode
vehicleCamera.currentMode = VehicleCamera.CameraMode.Interior;

VehicleInput

vehicleInput.SetInputMode(VehicleInput.InputMode.Mobile);
vehicleInput.isAIControlled = true;  // Disable human input

AIVehicleController

aiController.GPSForceRescan();  // Force new pathfinding scan

🔍 Troubleshooting

Common issues and solutions.

Vehicle flips on startSet Center of Mass Transform to a point low and centered on the chassis. Use Vehicle Creator Wizard for automatic placement.
Vehicle doesn't moveCheck: 1) Engine is running (press F). 2) WheelColliders are properly assigned in WheelManager. 3) Rigidbody is not kinematic.
No soundEnsure SoundManager component exists (auto-added). Assign audio clips in the inspector. Check masterVolume > 0.
AI doesn't moveCheck: 1) enableAI is true in preset. 2) Waypoints or followTarget assigned. 3) obstacleLayer is set. 4) Engine starts automatically for AI.
New Input System not workingInstall the Input System package from Package Manager. Create an InputActionAsset with a "Vehicle" action map containing Steer, Throttle, Handbrake actions.
FPS drop with AI GPSGPS uses async grid scanning (v1.0.0+). If issues persist: increase gpsNodeRadius, reduce gpsGridSize, or disable showDebugGizmos in builds.
💡 Performance Tips1) Disable showDebugGizmos in production builds. 2) Use Object Pooling (included) for projectiles/effects. 3) SkidMarks auto-LOD beyond 100m. 4) GPS grid is cached and reused when vehicle stays within 40m of grid center.