Bendy2D

A homegrown softbody physics engine written in Rust, the main purpose of this engine is to solve collisions between multiple soft polygons. This project was a part of my bachelor’s thesis.

Timeframe: 10 weeks in 2023

Real-Time Soft Body Physics Engine for Enhanced Convex Polygon Dynamics

(My bachelors thesis)


Abstract


This thesis covers the development process of implementation, and evaluation of a soft-body physics engine for convex polygon objects. The main feature is implementation of a dynamic polygon collider that represents a polygons shape correctly, while still being able to collide with other objects in the simulation. Objects are able to deform both temporarily and permanently using springs with distance constraints. Pressure simulation is also implemented to simulate inflated polygons. The physics bodies does not feature friction between objects, only friction against a static boundary of the simulation. The engine is then evaluated in order to determine if it can run in real-time which is one of the goals. When it comes to the simulation, Verlet-integration will be used for updating the positions of particles, and every polygon will be built using these particles, and combined using certain constraints to make the particles act as one combined object. The main problem that will be solved is the interpenetration solver, which ensures that polygons do not overlap, and two formulas will be combined to solve this problem. The collision detection method uses line intersections to determine if objects are overlapping, this method ended up being quite expensive for polygons with a lot of vertices. One optimization technique is implemented which is axis-aligned bounding boxes around objects which improved performance significantly, which also makes the engine more viable for real-time simulations. The physics engine in this report is deterministic using a fixed time-step, dynamic time-step is not tested. The engine also only supports discrete collision detection.