Skip to content

djad04/JellyPhysics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jelly Physics Sandbox

Demo

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

Requirements

Dependencies

  • CMake
  • Box2D
  • SDL2

Installing Dependencies

Windows

Using vcpkg (recommended):

vcpkg install box2d sdl2

Or download pre-built libraries:

Linux (Ubuntu/Debian)

sudo apt-get install libbox2d-dev libsdl2-dev cmake build-essential

Building

Using CMake

# 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

Keyboard

  • 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

Mouse

  • Left Click + Drag grab and move individual jelly nodes
  • Right Click spawn a new jelly at mouse position
  • Mouse Wheel - adjust joint stiffness

About

A simple interactive 2D physics sandbox that simulates soft body "jelly" objects using Box2D and SDL2.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages