Feedback on Rope Swinging Mechanics [2D]

Hey, there!

Today I created something that I was wanting to create for so long, and finally achieved it! In the past I didn’t have much experience with guis, but now I do. I present to you, Rope Swinging mechanics! Not 2.5D, Not a weird camera angle, Only Guis!

Holding the mouse button, will create a rope, connect it with the cyan circle and the closest target from the mouse’s location! Then with angular motion and a bit of math, I make it swing! After you release the mouse button, gravity pulls the ball down! (Gravity is acting at all times!)

Feedback and suggestions are highly appreciated! They motivate me to make more of these never-seen-before creations! :slight_smile:

12 Likes

The ropes also pull you up towards the target if you are on the ground! This can also be used as a grappling gun!

3 Likes

How did you make it? could you tell

woah thats amazing. if only i could make one

1 Like

Well I won’t reveal the whole script right now :smirk:

But I can give you an idea.

Firstly, I made a few targets (pink boxes) and a circle. Then for the rope. I made a simple script that calculates the theta between the circle and the target using trigonometry. Using this theta I rotate the rope and connect its end and start points with the circle and the target.

Finding the target is fairly easy. Just find the minimum magnitude between the target and the mouse location.

Then using angular motion physics, I calculate the force that has to be applied to the circle to make it swing!

For the bouncing on the ground, i just reverse the direction of velocity.y and damp it down!

I have detailed out how I make physics simulations in this tutorial:

You can make stuff like:

It isn’t hard to apply physics on guis if you know what you are doing! Stuff like this isn’t impossible to make using guis!

1 Like

Nice I’m working on something similar with verlet integration too, also I haven’t tried collisions yet but wouldn’t checking if the updated position collides before updating the ball frame itself stop it from clipping into colliders or do you already do that

I have a spring constant that slows down the velocity causing it to clip through each other. removing it would make them rigidly collide with each other without clipping!

Risky Ropes 2D Edition :open_mouth:

Very cool, good work

2 Likes