Car Controller
High-Fidelity 3D Vehicle Dynamics & Physics Engine
> System_Overview
Realistic Car Controller is a solo-developed 3D vehicle physics engine and modular asset prototype built from scratch in Unity 3D using native WheelCollider physics.
Engineered to model real-world automotive mechanics, the system features accurate gear ratio alignment, rev matching on downshifts, authentic engine stalling when vehicle speed drops below threshold in high gear, and a fully modular drivetrain switcher supporting All-Wheel Drive (AWD/4WD), Front-Wheel Drive (FWD), and Rear-Wheel Drive (RWD).
Project Post-Mortem: The project stands as a complete technical physics exploration. During development, tuning tire friction curves resulted in an over-drifty handling dynamic ("not sticky enough"), which became an active tuning challenge before the project was archived as an internal prototype asset. (No live WebGL demo is hosted, as WebGL browsers do not reliably support heavy Unity 3D physics).
> Core_Mechanics & Vehicle Architecture
-
Gear Alignment, Rev Matching & Engine Stalling
Engineered realistic transmission ratios with built-in rev matching on downshifts to align engine speed. Implemented stalling physics that cut engine power if speed drops too low relative to high gear selection without clutching.
-
Modular Drivetrain Architecture (AWD / FWD / RWD)
Built a modular drivetrain selector enabling developers to toggle torque distribution dynamically between All-Wheel Drive (AWD), Front-Wheel Drive (FWD), and Rear-Wheel Drive (RWD) with custom differential bias settings.
-
Custom Exhaust Audio Synthesis & Pitch Mapping
Synthesized custom exhaust audio loops mapped dynamically to engine RPM, throttle load, rev pops, and shifting deceleration sounds for realistic acoustic feedback.
-
Unity WheelCollider Physics Tuning
Utilized Unity 3D native
WheelCollidercomponents for spring suspension, dampening, steer angle geometry, and lateral friction slip curves.
> Code_Snippet: Gear Matching & Engine Stall Check
// Transmission Drivetrain, Rev Matching & Engine Stall Check (Unity 3D C#)
private void UpdateDrivetrainPhysics() {
float currentSpeed = rigidBody.velocity.magnitude * 3.6f; // KM/H
float targetRPM = (currentSpeed / maxSpeedInGear[currentGear]) * maxRPM;
// Check for Engine Stall: Low speed in high gear without clutch
if (currentSpeed < minStallSpeed[currentGear] && currentGear > 1 && !isClutchPressed) {
StallEngine(); // Triggers engine kill and custom stall audio
return;
}
// Rev Matching on Downshift
if (isDownshifting) {
currentRPM = Mathf.Lerp(currentRPM, targetRPM * 1.2f, revMatchSpeed * Time.deltaTime);
}
}
> Learnings_&_Post_Mortem
Mastered complex gear ratios, rev matching algorithms, engine stalling mechanics, and modular AWD/RWD/FWD torque routing.
Gained valuable experience troubleshooting WheelCollider lateral grip and tire friction curves during complex 3D vehicle physics development.