logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Tearable 2D Cloth Physics Simulation Experiments With Raylib

Learn how Verlet integration works and how to implement it yourself.

Simulating physics with a computer requires computing forces, acceleration, velocity, and position in discrete time steps. To do this, a method is needed to predict the object's new position at each step, and there are several different methods to choose from.

Some of them are faster, some are more stable, and some are slower but give better results. The choice of method depends on the type of simulation you're doing. Programmers often refer to these prediction methods as "integration". Common integration techniques include Euler's method, Runge-Kutta methods, and Verlet integration.

Claudio Z. shared the results of his experiments with Verlet integration, showcasing a 2D cloth physics simulation using Raylib and C++ that tears when dragged by the mouse. Verlet integration is widely used in many game physics engines today. Its stability makes it ideal for simulations with moving parts that have some degree of freedom yet are all connected and influence each other, either directly or indirectly.

If you're interested in learning more about physics simulation and want to try creating your own version, check out this article that explains how to write a cloth simulation that directly benefits from Verlet's stability.

In the past, we shared some updates to Claudio Z.'s DeformableMesh add-on for Godot Engine. It's now officially out, and you can check it out as well:

Join our 80 Level Talent platform and our new Discord server, follow us on InstagramTwitterLinkedInTelegramTikTok, and Threads, where we share breakdowns, the latest news, awesome artworks, and more.

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more