A simple interactive 2D physics sandbox that simulates soft body "jelly" objects using Box2D and SDL2.
Jelly objects are made from circular bodies connected with spring-like distance joints Interactive Manipulation: Click and drag individual jelly nodes to move them around Physics Controls: Adjustable joint stiffness, damping, and gravity Multiple Jellies: Spawn and manage multiple jelly objects simultaneously Real-time Rendering: Visual feedback with nodes, joints, and filled blob approximation
- CMake
- Box2D
- SDL2
Using vcpkg (recommended):
vcpkg install box2d sdl2Or download pre-built libraries:
sudo apt-get install libbox2d-dev libsdl2-dev cmake build-essential# Create build directory
mkdir build
cd build
# Configure (adjust paths if needed)
cmake .. -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake
# Build
cmake --build .
# On Windows, you may need to copy SDL2 DLL to the build directory- N - Spawn a new jelly at the center
- D - Delete the last jelly
- C - Clear all jellies
- R - Reset (clear all and spawn one jelly)
- G - Toggle gravity on/off
- SPACE - Pause/Resume simulation
- S - Step one frame forward (when paused)
- UP/DOWN - Increase/Decrease joint stiffness
- LEFT/RIGHT - Decrease/Increase joint damping
- ESC - Quit
- Left Click + Drag grab and move individual jelly nodes
- Right Click spawn a new jelly at mouse position
- Mouse Wheel - adjust joint stiffness
