Drunkin' Drivin

3D driving simulation, vehicle dynamics, and dynamic traffic rule enforcement in Unity

Unity 3DUnity 3DC#C#Custom PhysicsCustom PhysicsRaycastingRaycastingAnimation RiggingAnimation RiggingState MachinesState Machines
Physics System
Unity WheelColliders
Rule Engine
Raycast & State Machines
Animation
Procedural IK Rigging
Interactive Demo Player
8 CLIPS AVAILABLE
Speed Trap Camera Detection
// SYSTEM DEMO SPECIFICATION

Trigger volumes measure vehicle velocity over distance. If the vehicle exceeds the speed threshold, the system triggers a camera flash event and records penalty points.

Project Overview

Drunkin’ Drivin is a 3D driving simulation developed in Unity and C# as an academic group project for ICT-Project 1 at UCLL (developed with team members Aidan Gielkens, Enes Ertem, and Zeno Raymaekers).

The game simulates vehicle handling in an urban city environment while enforcing traffic laws through automated detection systems. Players must navigate urban traffic while managing their intoxication level, which dynamically degrades steering stability and visual focus.

Core Simulation Systems

System Technology Implementation Mechanics
Vehicle Physics WheelColliders Custom suspension spring/damper curves, tire slip friction, and acceleration weight transfer
Speed Enforcement Trigger Volumes Measures vehicle entry and exit timestamps to calculate speed and trigger camera flash events
Red Light Detection Directional Raycasts Intersects traffic stop lines linked to the traffic light state machine during active red phases
Steering Kinematics Inverse Kinematics Synchronizes 3D player hand models with steering wheel rotation in real time
Traffic Light Logic State Machine Coordinates 4-phase traffic junction signal cycles and pedestrian crossings
Infraction HUD Unity UI Overlay Real-time penalty point accumulator tracking license deductions and fines

Technical Implementation Details

1. Physics-based vehicle handling & suspension

The vehicle controller (CarController.cs, Wheel.cs) avoids arcade physics in favor of realistic simulation:

  • Uses Unity WheelCollider components with calibrated forward and sideways friction curves.
  • Dynamically shifts the center of mass during acceleration and hard braking to simulate body roll and suspension dive.
  • Models front-wheel Ackerman steering geometry to ensure realistic turning radius.

2. Automated traffic infraction & camera detection

  • Speed Trap Cameras (SpeedCameraController.cs): Dual trigger volumes calculate average vehicle velocity over a known physical distance. If the vehicle exceeds the posted speed limit, the camera fires a dynamic flash event and captures violation data.
  • Red Light Detection (TrafficLightController.cs): When traffic lights enter the red phase, directional raycasts activate across the stop line. Any vehicle collider crossing the boundary registers an immediate traffic violation.

3. Procedural rigging & UI intoxication shaders

  • Steering Wheel IK: Inverse kinematics rigs bound to player hand bones follow the rotational axis of the steering wheel mesh without requiring pre-baked animation clips.
  • Intoxication Shaders: High blood alcohol content triggers post-processing radial blur, input response lag, and camera sway to simulate physical impairment.