Setup Guide

Prerequisites

  • Unity 2022.3+
  • Input System Package (com.unity.inputsystem)

Installation

  1. Copy SimpleDriftController/ into your project's Assets/ folder
  2. If prompted, let Unity recompile the scripts
  3. The package should appear in your Project window

Creating a Vehicle

Auto-Configure (Recommended)

  1. Create an empty GameObject → add DriftVehicle component
  2. In the inspector, click Auto-Configure

Step 1: Body (Optional)

wizard-step1

Drop a body mesh (prefab or scene object) into the Body field. Scene objects are reparented; prefabs are instantiated. The body receives a BoxCollider only if no colliders already exist. All body renderers are set to Ignore Raycast layer.

Step 2: Wheel Selection

wizard-step2

Assign all 4 wheel meshes — Left Front, Right Front, Left Rear, Right Rear. Radius and width are auto-detected from mesh bounds.

Create Vehicle

Click Create Vehicle — the wizard creates:

Created Item Details
FrontAxle DriftAxle with left/right wheel children
RearAxle DriftAxle with left/right wheel children
DriftWheel (×4) Per-wheel components with preset radius/width
CenterOfMass Empty transform positioned low
Body Reparented or instantiated with BoxCollider if needed

Manual Setup

  1. Create an empty GameObject → add DriftVehicle + Rigidbody
  2. Create axle GameObjects as children → add DriftAxle
  3. Create wheel GameObjects as children of axles → add DriftWheel
  4. Set leftWheel/rightWheel references on each axle
  5. Set axles array on the vehicle
  6. Create a CenterOfMass child and set the reference

Configure Axles

axle-inspector

Each DriftAxle has per-axle settings for suspension, camber, tire curve, steering, differential, and anti-roll bar.

Vehicle Presets

vehicle-presets

One-click buttons that set weight, engine, transmission, suspension, differential, and traction control for common drift builds.

Engine Presets

engine-presets

Preset Max Torque Max RPM Character
I4 NA 250 Nm 7,500 High-revving, peaky
I4 Turbo 380 Nm 7,000 Broad torque, responsive
I6 NA 400 Nm 7,000 Smooth, linear
V6 NA 500 Nm 6,500 Torquey mid-range
V6 Turbo 600 Nm 6,500 Big torque
I6 TD 550 Nm 5,500 Diesel, low-end grunt
V8 NA 650 Nm 6,000 Classic muscle
V8 S/C 750 Nm 6,500 Supercharged

Transmission Presets

transmission-presets

Preset Ratios Final Drive
4-Speed 4.0 / 2.5 / 1.7 / 1.0 4.1
5-Speed 4.0 / 2.5 / 1.7 / 1.2 / 0.9 3.9
6-Speed 4.0 / 2.5 / 1.7 / 1.3 / 1.0 / 0.8 3.9

Input Setup

input-setup

  1. Add PlayerInput component to the vehicle
  2. Set Actions to SimpleDriftController/Input/CarInputs.inputactions
  3. Set Default Map to "Car"
  4. The DriftInputSystem script will auto-detect the PlayerInput

Camera Setup

  1. Create a Camera GameObject
  2. Add DriftCameraController component
  3. Drag the vehicle into the vehicle slot
  4. Tune for your scene:
    • Swing-Out: swingOutDistance (default 2.5) controls lateral offset during drifts
    • Velocity Look: velocityLookBlend (0–1) blends camera look between car forward and velocity direction
    • Spin Threshold: lower spinYawThreshold to make the camera focus on the car sooner during spins

For multiple cameras, add DriftCameraManager to the vehicle and assign cameras to the list.

Audio Setup

audio-setup

  1. Add DriftAudio to the vehicle
  2. An AudioSource is auto-created if none exists — no manual AudioSource setup needed
  3. Assign runningClip (engine loop while driving) and optionally idleClip (idle rumble)
  4. The running clip always has a minimum volume floor at idle, so you'll always hear the engine

Default values: pitchMultiplier = 1.0, volumeMultiplier = 1.0

Effects Setup (Skid Marks & Smoke)

effects-setup

DriftEffects spawns prefabs per wheel and drives them by slip. You can provide one, both, or neither.

Creating a Skid Mark Prefab

skidmark-prefab

  1. Create an empty GameObject
  2. Add a TrailRenderer component
  3. Configure the trail:
    • Set a dark/black material
    • Time: ~2–4s (how long marks persist)
    • Start Width: ~0.05, End Width: ~0.01
    • Min Vertex Distance: ~0.1
    • Autodestruct: off
  4. Save as a prefab (drag to Project window)
  5. Assign to skidPrefab on DriftEffects

Creating a Smoke Prefab

smoke-prefab

  1. Create an empty GameObject
  2. Add a ParticleSystem component
  3. Configure the particles:
    • Set a smoke/cloud material
    • Duration: 1, Looping: on
    • Start Lifetime: 0.5–1.5s
    • Start Speed: 0.5–2
    • Start Size: 0.2–0.8
    • Start Color: white/grey with low opacity
    • Shape: Box or Cone (small)
    • Renderer: use a smoke material
  4. Save as a prefab
  5. Assign to smokePrefab on DriftEffects

The DriftWheelEffects component is auto-added if missing — it finds TrailRenderer and ParticleSystem on the prefab root and toggles emission on/off based on slip thresholds. Width and rate are whatever you configure on the prefab — the code doesn't override them.

Exclude steering axles: Check excludeSteeringAxles on DriftEffects to prevent skid marks and smoke on front wheels — for an arcade feel where only the rears lay down effects.

Tire Noise

Assign an AudioSource and clip on the tireAudioSource/tireAudioClip fields. Optional — if null, no tire noise plays.

Drift State (Scoring)

  1. Add DriftState to the vehicle
  2. Configure detection thresholds (minDriftAngle, minDriftSpeed)
  3. Access IsDrifting, DriftScore, DriftCount, MaxDriftAngle at runtime
  4. Call ResetScore() to zero everything

Lights (Optional)

lights-setup

Add DriftLightManager to the root. Create child GameObjects with Light components and assign them to the headlight, brake, and reverse light lists. Brake lights auto-illuminate when braking; reverse lights auto-illuminate in reverse.

Telemetry Display

telemetry-inspector

  1. Add DriftInfo to the vehicle
  2. In Play Mode, the DriftInfoEditor shows live data in the inspector:
    • Speed, throttle, steering
    • Engine RPM, gear, drive torque
    • Per-axle articulation, compression, steer angle, camber
    • Drift angle, drifting status, score
    • 0–60 / 0–100 timers
  3. Press F12 to log telemetry to the console
  4. Click Copy to Clipboard to export the current data

Final Checks

vehicle-hierarchy

  • Verify the Center of Mass position in the Scene view
  • Check suspension visualization: ride height rings, travel lines, steer cone
  • Test drive!

Camber Tuning Tips

  • Street / Beginner: -1.5° front and rear — mild turn-in improvement
  • Tuner / Aggressive: -3° front, -1.5° rear — sharper turn-in, stable exit
  • Pro Drift: -4° to -6° front, -2° to -3° rear — max angle entry, strong rear grip
  • Formula D / Competition: -6° to -10° front — extreme angle kit
  • Dynamic Camber Factor: 1–2× for mild body-roll response, 3–5× for aggressive
  • Static Camber: negative values tilt wheel tops inward (both sides), positive tilts outward

Tips

  • Drift Angle Kit: Increase maxSteerAngle on steerable axles (45°–70°) for wider drift angles
  • Camber: Start with -1.5° to -3° static camber on front for turn-in, less on rear for stability
  • Clutch Kick: Bind to a convenient button for initiating drifts — spikes torque briefly to break traction
  • Traction Control: Set to 0 for full control, 0.5+ for more forgiving handling
  • Suspension: Stiffer rear springs promote oversteer, stiffer front promotes understeer
  • Anti-Roll Bar: Higher values reduce body roll but can cause inside wheel lift — 5000–15000 is typical for drift