I got my hands on Verlet Integeration, so I created this

2D Gui Based Ragdoll using Verlet Integration

Earlier today, I got my hands on Verlet Integration, Verlet integration is straight up amazing for physics in games. Its widely known by many developers. So, I went ahead to watch a few videos and read a few articles to create this Ragdoll using Verlet integration and Guis!


There are points for each joint of the ragdoll, these points are always connected with line segments (Gui Frames), these points move according to each other and the length of each line segment. The points can be held with the mouse and can be used to drag the ragdoll here and there.

Verlet integration is truly magical, you should surely check out its working since you can create amazing stuff that includes physics when developing games or computing graphics! The next step for me is to create a controllable active ragdoll! It will be amazing to use it to create a 2D Stickman fighting game using guis!

Feedback, suggestions and queries are always welcome! I would love to answer your questions regarding this creation.



wow thats so cool i wish that the ragdoll mans body part collided with other parts instead of going through them but good work and i like all you gui related posts

1 Like

How did you make OBB collision detection or are you?

So basically, there are different joints, which act as points for the line segments. The beauty of verlet integration helps me out a lot here, Here’s an example of how OBB collisions work in this creation and require no complex math!

In the image above, when the red point collides with the blue wall, a bounce force is applied causing it to reverse it’s velocity’s direction. After sometime, the red point takes the place of the green point, hence a change in the orientation and position of the line segment is seen, which simulates OBB collisions!

that’s actually smart idea, to create fake OBB.

1 Like

Did sebastian lague’s newest video inspired you?

I saw that video a few days ago, but the creation that inspired me was a cloth made with verlet integration, and now that I think about it, its so easy to make one!


Yeah, but you should add value, how much the stick can handle
Just for the future.

local n = 0
local function WaitEveryN(N)
      if (n>=N) then
           n = 0

Makes iterating much faster

1 Like

Better visualization of how I fake elastic OBB Collisions using verlet integration:

One more thing that impresses me is turning position into a rotation.
How do you do that?

So here, using two points, I find the angle between those two vectors!

Here’s a visualization:

Here’s some pseudocode:

point1 = Vector2(0, 0)
point2 = Vector2(100, 100)

-- By mental maths, you expect the angle between those points to be 45 degree.

-- Actually finding the angle now:

theta = math.atan2(point1.y - point2.y, point1.x - point2.x)
theta /= math.pi
theta *= 180 -- theta in the form of feasible rotation for the Gui object

And then, I just rotate the frame by that theta!

Check this out:


Thank you!
I always wanted to understand this part of math :slight_smile:

1 Like

Can you make the game open source? I’m really interested in how you made it!

People playground remake please?

There are a few things I need to fix and make my code optimal, I’ll surely do so after I feel confident about my code!



Send me a DM of the game if you make it :wink:


This is really awesome, I’m sure some great games could be made with this!

Thats what I immediately thought of when I saw this post lmao
I’d love to play it if you actually make the game @OP

1 Like