Python component for the "Run the Bath" hackathon game. Detects player pose via webcam using MediaPipe and streams gesture data to Unity over UDP.
conda activate run-the-bath
pip install -r requirements.txtRun the pose detector:
python pose_detector.pyWith debug overlay (skeleton + terminal output):
python pose_detector.py --debugTest without a webcam:
python pose_detector.py --testTest UDP sending:
python udp_sender.py --debugThe pose detector captures webcam frames, runs MediaPipe Pose to extract body landmarks, and calculates two values:
- lean — float from -1.0 (left) to +1.0 (right), based on shoulder-to-hip offset
- jump — bool, triggered by rapid upward wrist movement
These are sent as JSON over UDP to localhost:5005 at ~30fps:
{ "lean": -0.3, "jump": false }UdpReceiver.cs is a MonoBehaviour that listens on port 5005 and exposes Lean (float) and Jump (bool) properties. Attach it to any GameObject in your Unity scene.
| File | Description |
|---|---|
pose_detector.py |
Webcam capture + MediaPipe pose detection |
udp_sender.py |
UDP socket wrapper |
UdpReceiver.cs |
Unity UDP consumer |
requirements.txt |
Python dependencies |