This project is a 2D real time cloth simulation built in Python using Raylib. It focuses on interactive cloth creation, manipulation, and constraint based physics simulation, similar to techniques used in games and visual simulation systems.
The goal of this project is to explore how cloth physics works under the hood, with an emphasis on real time interaction, stability, and extensibility.
- Interactive drawing of points, lines, and custom polygons
- Support for both stationary (hooked) and dynamic points
- Custom cloth structures created by connecting points manually
- Adjustable physical parameters including stiffness, damping, and mass
- Real time slicing and cutting of fabric
- Grid based cloth generation with optional triangulation
- Real time constraint solving for stable cloth behavior
The simulation is based on a point mass and constraint system. Cloth is represented as a collection of points connected by distance constraints. Each update step applies forces, integrates motion, and resolves constraints to preserve cloth structure.
Raylib is used for rendering and real time input handling, enabling interactive creation and manipulation of the cloth during simulation.
- Draw points and connect them with constraints
- Mark points as fixed or movable
- Adjust simulation parameters at runtime
- Slice through fabric to dynamically remove constraints
- Generate structured cloth grids for rapid prototyping
Planned and possible extensions include:
- Wind force simulation
- Collision handling with shapes and boundaries
- Exporting cloth meshes for use in other tools or pipelines
- Performance optimizations for larger cloth systems
This project was built as a hands on exercise in physics simulation, constraint solving, and real time systems. It provided practical insight into how cloth physics is implemented in interactive applications such as games and visual simulations.
- Python
- Raylib
Actively developed and open to future extensions and experimentation.
