Skip to main content
100%

Bouncing Spheres

✓ Published1🌍 Public
CCurran Kelleher
Last edited Mar 19, 2025
Created on Mar 19, 2025
Forked from 3D Cube of Spheres

An interactive 3D physics simulation renders 50 spheres bouncing within a transparent cube, with gravity, dampening, wall collisions, and sphere-to-sphere repulsion. Mouse drags can grab and pull spheres, while orbit controls navigate the scene. Three.js handles the WebGL rendering, and the Web Audio API synthesizes collision sounds whose pitch and volume vary with impact velocity.

AI-generated description

Manifested using Claude 3.7 Sonnet with VizHub's "Edit with AI" feature. It's truly incredible how good it is with ThreeJS! I gave it this older example Bouncing Balls and told it to make it work in 3D!

Here's the full description Claude wrote:

3D Physics Simulation with Sound

This project demonstrates a 3D physics simulation with gravity, bouncing spheres, and audio feedback.

Features

  • 3D spheres with realistic physics
  • Gravity and bouncing
  • Sphere-to-sphere collision detection
  • Interactive container walls
  • Mouse interaction to grab and pull spheres
  • Camera controls for 3D navigation (orbit, zoom, pan)
  • Audio feedback for collisions with different sounds

Physics Features

  • Gravity pulls spheres downward
  • Dampening factor reduces velocity over time
  • Spheres bounce off container walls
  • Spheres collide and repel each other
  • Mouse interaction allows pulling spheres

Audio Features

  • Distinct sounds for wall collisions and ball-to-ball collisions
  • Wall collisions produce a higher-pitched sine wave
  • Ball collisions produce a lower-pitched triangle wave
  • Sound volume varies with impact velocity
  • Ability to mute/unmute sounds

Technologies Used

  • Three.js for 3D rendering
  • JavaScript ES modules
  • Custom physics implementation
  • Interactive camera controls
  • Web Audio API for sound generation
MIT Licensed

Similar vizzes