DriveSync redefines racing game controls by replacing traditional input devices with hand gesture recognition powered by real-time computer vision. Built in Unity and leveraging OpenCV, Mediapipe, and Python, DriveSync allows you to steer, accelerate, and brake using intuitive hand movements.

Click the image to view or download the gameplay demo video.
- 🖐️ Hand Gesture Controls: Powered by Python and Mediapipe for accurate and responsive input.
- 🕹️ Real-Time Steering: Seamlessly integrated with Unity for a smooth gaming experience.
- 🔁 Seamless Communication: Utilizes UDP sockets for efficient data transfer between Python and Unity.
- 🎮 Immersive, Controller-Free Gameplay: Enjoy a fully immersive experience without traditional controllers.
- 🧠 Skill Showcase: Ideal for demonstrating expertise in computer vision and Unity development.
- Python 3.x installed
- Unity Hub and Unity Editor (version compatible with the project)
- A webcam for gesture detection
-
Install Python Dependencies
Install the required Python packages:pip install opencv-python mediapipe pydirectinput
-
Enable UDP Communication
DriveSync uses UDP sockets to transmit gesture data from Python to Unity. Ensure your network settings allow UDP communication (default port specified in scripts). -
Run the Gesture Recognition Script
Execute the Python script to start gesture detection:- Opens the webcam for real-time hand tracking.
- Detects gestures (left, right, open palm, closed fist).
- Sends control data to Unity via UDP.
python gesture_recognition.py
-
Open the Unity Project
- Launch Unity Hub and open the DriveSync project.
- Locate the
handgesture.csscript in the Unity project. - This script listens for UDP packets from Python and maps them to in-game controls.
-
Play the Game
- Press the Play button in the Unity Editor.
- Use hand gestures to control the car! ✋➡️🏎️
Webcam → Python (OpenCV + Mediapipe) → gesture_recognition.py
↓
UDP Socket (Python → Unity)
↓
Unity → handgesture.cs → Car Control
gesture_recognition.py: Captures webcam input, processes hand gestures using Mediapipe, and sends control signals over UDP.handgesture.cs: Listens for UDP packets in Unity and translates them into car movements (steering, acceleration, braking).- Result: Fluid, controller-free car control using hand gestures.
- Unity (C#): Game logic and rendering
- Python (OpenCV + Mediapipe): Real-time gesture detection
- UDP Sockets: Data transmission between Python and Unity
- pydirectinput: Optional keyboard emulation for testing
| Hand Gesture | Action |
|---|---|
| Hand Right | Turn Right |
| Hand Left | Turn Left |
| Open Palm | Accelerate |
| Closed Fist | Brake |
- 🎨 Customizable gestures through a user interface
- 🌐 Online multiplayer support
- 🔧 Improved gesture calibration and noise filtering
- 🧠 Machine learning for advanced gesture recognition
- 🕶️ Integration with AR headsets
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a clear description of your changes.
Please report bugs or suggest features via the Issues page.
This project is licensed under the MIT License.
- 📧 Email: mizh48.ansar@gmail.com
- 💼 LinkedIn: Mizhab Ansar
- 🧑💻 GitHub: haveyoumetmiz
- 📷 Instagram: @haveyoumetmiz