Skip to content

๐Ÿ‰ 3D Fruit Slicer Game with PoseNet & Three.js An experimental browser-based game that uses PoseNet for real-time hand tracking and Three.js for 3D rendering. Slice fruits with your hands, dodge bombs, and score points โ€” all using your webcam! Built for fun, learning, and showcasing hand detection + 3D interaction

Notifications You must be signed in to change notification settings

SusmoyNath/Motion-controlled-3D-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅญ Motion-controlled Fruit Slicer 3D game โ€“ A Hand-Tracking Game in the Browser

Welcome to Motion-controlled 3D game, a browser-based interactive game where you slice fruits (and avoid bombs!) using just your hand movements โ€” powered by pose detection and 3D rendering.

This project combines computer vision and 3D graphics to create a fun and immersive experience directly in your browser.


๐Ÿš€ Features

  • Real-time hand pose detection using PoseNet
  • 3D environment powered by Three.js
  • Dynamic 3D fruit and bomb models
  • Hand trail animations for visual effects
  • Collision detection between hand and 3D objects
  • Sound effects and game logic (score, lives, game over)
  • Fully functional in-browser, with no downloads needed

๐Ÿง  Step 1: Breaking the Problem Down

To build this project, the process was broken down into manageable tasks:

  1. Set up hand pose detection
  2. Initialize and render a 3D scene
  3. Load and display 3D fruit and bomb models
  4. Map 2D hand coordinates to 3D space
  5. Add hand trail animation
  6. Enable collision detection
  7. Implement game logic (scoring, sounds, game over)
  8. Refactor and polish the codebase
  9. Deploy the game to the web

๐Ÿ› ๏ธ Step 2: Picking the Tools

Task Tool/Library
Pose Detection TensorFlow PoseNet
3D Rendering Three.js
3D Trail Effects TrailRendererJS
Sound Management Howler.js
Hosting Netlify
3D Models Assets from Google Poly (archived but usable)

๐Ÿ› ๏ธ Step 3: Setup & How to Run Locally

โš ๏ธ Make sure you're serving this on a local server (due to webcam/media access). You can use Live Server in VS Code or Python's http.server.

1. Clone the Repository

git clone https://github.com/SusmoyNath/Motion-controlled-3D-game.git

cd Motion-controlled-3D-game

2. Open index.html in a local server

  • Option 1: Use the Live Server extension in VS Code
  • Option 2: Serve via Python

python3 -m http.server

Visit http://localhost:8000 in your browser.


๐ŸŽฎ Gameplay Overview

  • Your hand becomes the slicer.
  • Slice fruits to earn points.
  • Avoid bombs โ€” slicing them ends the game.
  • Trails follow your hand for added visual feedback.
  • Enjoy sound effects and an immersive 3D environment.

๐Ÿ” Example Code Snippets

PoseNet Initialization

const net = await posenet.load({
  architecture: "MobileNetV1",
  outputStride: 16,
  inputResolution: 513,
  multiplier: 0.75,
});

video = await loadVideo();
detectPoseInRealTime(video);

3D Scene Setup with Three.js

scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 1, 1000);
camera.position.set(0, 0, 300);
scene.add(camera);

Load and Render 3D Models

objLoader.load("apple.obj", (object) => {
  object.position.set(0, 0, 100);
  scene.add(object);
});

๐ŸŒ Live Demo

๐Ÿ”— Play the Game Here


๐Ÿ“ฆ Deployment

This project is deployed using Netlify. Any updates pushed to the main branch are automatically deployed.


๐Ÿ™Œ Acknowledgements

About

๐Ÿ‰ 3D Fruit Slicer Game with PoseNet & Three.js An experimental browser-based game that uses PoseNet for real-time hand tracking and Three.js for 3D rendering. Slice fruits with your hands, dodge bombs, and score points โ€” all using your webcam! Built for fun, learning, and showcasing hand detection + 3D interaction

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published