Verlet integration is a numerical method used to calculate the trajectory of particles in molecular dynamics. But it's widely used in computer graphics and software simulations to simulate physical phenomena and visual effects.
In each time step, it calculates the position of the particle in the next time step using current position, previous position and its accelaration. Then it applies constraints (if there's any) to maintain the right position of each particle.
We see a rope as a string of particles/nodes connected to each other with a fixed distance from each other. By running the Verlet integration for each node in the rope, we can simualte its physics with good accuracy.
We apply the constraint of nodes having the same distance from each other in each frame, and resolve collisions.
I also render a cylender-like mesh for the rope, which is generated procedurally in each timestep.
SampleScene
scene in the scenes folder.In the Prefabs
folder you can find the Rope
prefab which has two components.
The first is the Verlet Rope
component. It has some fields:
The other component is the Rope Renderer
. It has only one field: