Real World Rope Physics!

Real World Rope Physics!

by mathNinja9

👁 198 ❤️ 43 ⭐ 33 🔄 0
Created: Feb 10, 2021 Last modified: Oct 11, 2021 Shared: Feb 12, 2021

Instructions

Welcome to my Rope Physics! I do believe I have created the most physically accurate rope simulation on Scratch! This project revolves around real-world math, and I do believe I can make this project even better! (Read Below) I created this project on my test account, @mathNinja9. On here you can find some interesting tests, such as terrain generation, epic multiplayer engines, and much more! Check out my real account at @superfireninja9 for fun games and some silly animations :P IMPORTANT: When you run it right here on Scratch, it will be pretty stretchy unlike ropes in the real world. To make it better, you can increase the accuracy. This will lag a ton, so go ahead and run this project on TurboWarp and turn the accuracy up as much as you can! https://turbowarp.org/486240132 YOU CAN USE THIS ENGINE: Feel free to use this engine in your own projects! Please include a link to my project explaining where you got the rope physics, as it has taken me over a year to finally grasp the concept of Soft-Body physics! I do suggest making sure the rope accuracy never exceeds 15 on a normal scratch project, though. If it is being run in TurboWarp, you can turn it up to 1000! The higher the accuracy, the more realistic it is! HOW I CAN IMPROVE THIS ENGINE: I simulate this engine by having little particles, connected by constraints or links, almost like a chain. I need to make sure these particles all stay the perfect distance from each other. When you do this once per particle (reduce ACCURACY to 1), it stretches out because each particle is overriding each other. In theory, I would need to relax the particles infinite times per frame to get a perfect rope. But, it looks just fine with a finite number from about 200-1000. The higher, the more accurate. The problem is, it lags so much! I need to create a better algorithm to move the particles together without repeatedly moving them together until they are correct with brute force, but precisely calculating how each of them should move. Ok. If you just sat through that, wow! REAL WORLD PHYSICS: Ok. Now to explain the physics! I divide each frame into 3 steps: Simulate, Relax, and Render. The Simulate step simulates the gravity and other forces from the rope. It uses something called the Verlet Integration, another way of solving the Euler Equation, and is much more stable than some other methods of simulation. You may see that the rope does NOT keep track of the velocity in this project, yet it moves as if it had a velocity! This is because I only keep track of the current position and the previous position. I can basically just subtract the last position from the current position to get the velocity! The nice thing is, when I am Relaxing the rope, moving the particles together, the Simulate algorithm sees the change in movement and calculates the new velocity without anything fancy! The Relax step moves all particles together to ensure they stay the correct distance from each other like a rope. It goes through all of the constraints and moves the particles towards the particles they are connected to, from one end of the rope to the other. The issue is, these particles are connected to 2 particles each, correct? That means that each particle is needed to move two directions at once, which is not possible. Instead, we let the two cancel out, only moving in one direction a little bit. The problem with this is that it is not completely relaxing the rope! We have to do this over and over, hundreds of times per frame to get an almost perfect simulation! In theory, you would have to relax the constraints infinite times, but of course, no computer can simulate that. Instead, we show that we can accurately simulate a rope with a finite number. But still, the higher the number, the better! The ACCURACY variables is how many times per frame the constraints are relaxed. On Scratch, 15 is pretty much the MAX we can go. Run this on turbo warp, we can go up to 1000, though 200 is accurate enough! The Render step is extremely simple. I just go through all of the particles and draw a line between them! :P If you really did read through all of that, you have earned the title of Rope Nerd. Comment Rope Nerd to show your pride! xD

Project Details

Visibility
Visible
Comments
Enabled

More Cool Projects

Project thumbnail
View Project

epic red light green light game cloud test

by Erichungery

Project thumbnail
View Project

[3D]ころんくんころころ4

by rinringo2

Project thumbnail
View Project

Scrach連射でアタック

by TOMO43

Project thumbnail
View Project

Beat up e-mail!

by Olek32167xv

Project thumbnail
View Project

Beat up Rolcata

by jacejim1809

Project thumbnail
View Project

Beat Up Bandu (pls dont)

by BanduYT_Real

Project thumbnail
View Project

Skate!

by Unrealisation

Project thumbnail
View Project

Add characters crying cuz Mametchi crying

by ChamametchiArt

Project thumbnail
View Project

☁️ Among Us Scratch v4.0 (beta)

by IZEMSammy

Project thumbnail
View Project

Endless alphabet C-3 - CLUMSY remix

by mantonio3131

Project thumbnail
View Project

home AMV // DTAE

by abbybaby88

Project thumbnail
View Project

Geometry Dash 2.2 (SR) w/hitbox :)

by reoreo333

Project thumbnail
View Project

プロセカっぽい音ゲーを作ってみた

by spacediver

Project thumbnail
View Project

Patty's World - 1.3.4

by MrCheeseBun8181

Project thumbnail
View Project

Underfell sans fight [my take]

by leaf_san

Project thumbnail
View Project

超高性能素数判定機-Is the number entered a prime number?-

by yoshiki_i

Project thumbnail
View Project

(FW!!) Good Evening Sun Sim // Meme

by ShiningSaphire

Project thumbnail
View Project

ママに鯖缶隠された!2 / 脱出風ゲーム[モバイル対応]

by hgwrs16

Project thumbnail
View Project

A Platformer - Classic

by dominicp16

Project thumbnail
View Project

Among Us! Online and mobile Alpha v0.2.1

by awsomeezra88

Project thumbnail
View Project

Phone battery be like #Animations #Stories #Trending #Art #All

by Thunder_mate

Project thumbnail
View Project

Army Attack v0.2.3 WIP

by mami2370

Project thumbnail
View Project

Beat up Kick The Buddy V5.2

by juliescott12

Project thumbnail
View Project

マイクラ実況Part10古代の残骸ィィ!!

by ultimaterocking