Modular Vehicle Physics & Drivetrain System
Unity / C# / WheelColliders • Transmission, Rev Matching, Stall Logic & Audio Synthesis
> System_Overview
Modular Vehicle Physics & Drivetrain System is a solo-developed vehicle simulation engine built from scratch in Unity 3D using native WheelCollider physics.
Engineered to model real-world automotive mechanics, the system features dynamic drivetrain configuration (AWD/FWD/RWD), manual gear synchronization, rev matching on downshifts, low-speed stall logic, WheelCollider kinetics, and custom synthesized audio.
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.