ScratchData LogoScratchData
Back to Dot32-TEST's profile

Rope Physics Engine

DODot32-TEST•Created July 29, 2023
Rope Physics Engine
3
4
40 views
View on Scratch

Instructions

This is a physics engine built using verlet integration! Unfortunately the only way to decrease the springiness is to increase the simulation iterations, which increases lag. One of the scripts I built was simply enormous, click see inside and scroll down to see it. It brings nodes that are too far away closer together, and is what keeps all the nodes in the rope from falling apart!

Description

This engine works by storing multiple lists for all the nodes in the scene (referred to as entities in the code). There is a list for the nodes' x positions, a list for the nodes' y positions, and more. The nodes also have lists to store their previous position, and the nodes speed can be calculated every frame by the getting the difference from the current position to the last position. The reason this is done instead of just directly storing its speed is that by this method, directly moving the points will automatically correctly update the speed. This allows us to constrain the nodes to each other without them continuing to build up speed against each other!! This technique is called verlet integration.

Project Details

Project ID878367646
CreatedJuly 29, 2023
Last ModifiedOctober 7, 2023
SharedJuly 30, 2023
Visibilityvisible
CommentsAllowed